- Deleted .env.dev.example and .env.production.example files to streamline configuration management. - Updated Dockerfile to install production dependencies recursively, ensuring all necessary packages are included during the build process.
2.2 KiB
2.2 KiB
🚀 Deployment Guide
📁 Environment Files Overview
Development:
.env- Your local development environment (active).env.example- Development template for new developers
Production:
.env.production- Production environment for Plesk deploymentcompose-plesk.yaml- Docker Stack definition
🔧 Plesk Deployment Steps
Step 1: Authenticate Docker (One-time)
# SSH to Plesk server
echo "YOUR_GITHUB_TOKEN" | docker login ghcr.io -u ntumurbars --password-stdin
Step 2: Upload Files to Plesk
Upload these files to your domain directory:
compose-plesk.yaml- Docker Stack definition.env.production- Environment variables (rename to.env)
Step 3: Deploy Stack
- Plesk → Docker → Stacks → Add Stack
- Project name:
customer-portal - Method: Upload file or paste
compose-plesk.yamlcontent - Deploy
Step 4: Configure Nginx Proxy
- Plesk → Websites & Domains → yourdomain.com → Docker Proxy Rules
- Add rule:
/→portal-frontend→ port3000 - Add rule:
/api→portal-backend→ port4000
🔄 Update Workflow
When You Push Code:
- GitHub Actions builds new images automatically
- SSH to Plesk and update:
cd /var/www/vhosts/yourdomain.com/httpdocs/ docker compose -f compose-plesk.yaml pull docker compose -f compose-plesk.yaml up -d
🔐 Environment Variables
Your compose file uses these key variables from .env.production:
Database:
POSTGRES_DB,POSTGRES_USER,POSTGRES_PASSWORDDATABASE_URL- Full connection string
Application:
JWT_SECRET,CORS_ORIGINNEXT_PUBLIC_API_BASE,NEXT_PUBLIC_APP_NAME
External APIs:
WHMCS_BASE_URL,WHMCS_API_IDENTIFIER,WHMCS_API_SECRETSF_LOGIN_URL,SF_CLIENT_ID,SF_USERNAME
Email & Logging:
SENDGRID_API_KEY,EMAIL_FROMLOG_LEVEL,LOG_FORMAT
✅ Ready to Deploy!
Your setup is clean and production-ready:
- ✅ Environment variables properly configured
- ✅ Docker secrets via environment variables
- ✅ Database and Redis secured (localhost only)
- ✅ Automated image building
- ✅ Clean file structure