This guide explains how to deploy AMVRS ARMED to production using GitHub Actions, Docker, or traditional hosting.
Never commit .env files or hardcoded credentials. Instead, use GitHub repository secrets for CI/CD pipelines.
https://github.com/ajiko2505/WorksClick New repository secret for each of the following:
| Secret Name | Value | Example |
|---|---|---|
MAIL_HOST |
Your SMTP server hostname | smtp.gmail.com |
MAIL_USER |
SMTP username/email | your-email@gmail.com |
MAIL_PASS |
SMTP password or app password | (Gmail app password, not regular password) |
MAIL_PORT |
SMTP port | 587 |
MAIL_ENCRYPTION |
Encryption type | tls or ssl |
MAIL_FROM |
Sender email | your-email@gmail.com |
MAIL_FROM_NAME |
Sender display name | AMVRS Admin |
| Secret Name | Value | Example |
|---|---|---|
DB_HOST |
Database host | localhost or AWS RDS endpoint |
DB_USER |
Database username | amvrs_user |
DB_PASS |
Database password | (Strong password) |
DB_NAME |
Database name | amvrss |
If using Gmail SMTP:
MAIL_PASS secret (NOT your regular Gmail password)●●●●●●●●)The workflow file .github/workflows/ci.yml automatically runs on every push and pull request.
✅ PHP Syntax Check — Validates all PHP files for syntax errors
✅ Security Check — Searches for hardcoded credentials
✅ Mail Config Test — Validates mail_config.php loads env variables
✅ Database Schema — Imports and validates the database schema
✅ Config Loading — Tests database.php and env loading
✅ CSRF Check — Verifies CSRF protection functions exist
✅ Docker Build — Builds the Docker image (on main branch)
***)$ syntaxThe repository includes an SSH-based deploy workflow at .github/workflows/deploy.yml. It syncs the repository to a remote server using rsync over SSH and runs optional post-deploy commands.
Add these repository secrets in GitHub Settings > Secrets & variables > Actions before using the workflow:
SSH_PRIVATE_KEY — the private key (PEM) for the deploy account on the target server.SSH_HOST — server hostname or IP.SSH_USER — remote account name.SSH_PORT — optional SSH port (defaults to 22).DEPLOY_PATH — remote path to copy files into (e.g. /var/www/html/amvrs).RESTART_CMD — optional remote command to run after deploy (e.g. docker compose pull && docker compose up -d).How it works:
push to main and via manual workflow_dispatch.rsync, loads the deploy SSH key from the SSH_PRIVATE_KEY secret, and uses rsync to sync files to the remote host..git and .env by default. It then runs a small remote script to set permissions and optionally restart services (via RESTART_CMD or systemctl).Notes & server setup:
DEPLOY_PATH and is allowed to run sudo systemctl restart apache2 without an interactive password if you want automatic restarts..env file directly on the server (never store real credentials in the repo).RESTART_CMD to match your hosting (for Docker-based deployments you might use docker compose pull && docker compose up -d).This workflow provides a safe, secret-backed deploy path. If you’d like an alternative (push Docker image to registry, GitHub Packages, or use a cloud provider action), tell me which target and I will add it.
There is a workflow .github/workflows/publish-image.yml that builds the project’s Dockerfile and publishes an image to GitHub Container Registry (GHCR) on pushes to main.
Image name and tags:
ghcr.io/<owner>/<repo>:latest — latest buildghcr.io/<owner>/<repo>:<commit-sha> — commit-specific tagNo additional secrets are required for GHCR publishing because the workflow uses $ with packages: write permissions. If you’d prefer Docker Hub instead, I can switch the workflow to use DOCKERHUB_USERNAME and DOCKERHUB_TOKEN repository secrets.
cd "C:\xampp\htdocs\AMVRS ARMED"
docker compose up --build
Open: http://localhost:8080
Option 1: Pass secrets as environment variables
docker run \
-e DB_HOST=mysql-server \
-e MAIL_HOST=smtp.gmail.com \
-e MAIL_USER=your-email@gmail.com \
-e MAIL_PASS=your-app-password \
-p 80:80 \
amvrs-armed:latest
Option 2: Use docker-compose with .env (local only)
version: '3.8'
services:
web:
environment:
- MAIL_HOST=${MAIL_HOST}
- MAIL_USER=${MAIL_USER}
- MAIL_PASS=${MAIL_PASS}
# ... other vars
Then create .env locally (not in git):
MAIL_HOST=smtp.gmail.com
MAIL_USER=your-email@gmail.com
MAIL_PASS=your-app-password
Run:
docker compose up
Option 3: Use Docker secrets (for Swarm/orchestration)
Create a secrets.txt:
mail_pass=your-app-password
db_pass=strong-db-password
.git, .env, docker-compose.yml)/public_html/
├── index.php
├── login.php
├── database.php
├── mail_config.php
├── csrf.php
├── database/
├── assets/
└── ... (other files)
.env on Server.env file:
nano .env
DB_HOST=localhost
DB_USER=db_username
DB_PASS=db_password
DB_NAME=amvrss
MAIL_HOST=smtp.gmail.com
MAIL_USER=your-email@gmail.com
MAIL_PASS=your-app-password
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_FROM=your-email@gmail.com
MAIL_FROM_NAME="AMVRS Admin"
# Restrict .env to owner only
chmod 600 .env
# Set directory ownership
chown -R www-data:www-data .
chmod 755 .
chmod 644 *.php
chmod 755 assets database
mysql -h localhost -u db_username -p db_name < database/amvrss.sql
# Enter password when prompted
https://yourdomain.com/amvrs/ (or your path)tail -f /var/log/apache2/error.log
Before deploying to production:
.env file created and never committed.gitignore includes .env and sensitive filesmail_config.php properly loads from .envdatabase.php uses env variables.env or GitHub secrets (never in code)test_mail.php.env readable only by app user (chmod 600).envphp test_mail.php to validate.envphp -r "echo getenv('DB_HOST');"***) in logsdocker compose upLast Updated: February 9, 2026
Version: 1.0.0