Deployment
A checklist and guide for deploying DevPortal to a production server safely.
Pre-Deploy Checklist
- Set
APP_ENV=productionandAPP_DEBUG=falsein.env - Generate a fresh app key:
php devportal key:generate - Run migrations:
php devportal migrate --force - Optimise autoloader:
composer install --no-dev --optimize-autoloader - Clear and warm caches:
php devportal optimize - Point document root at
public/ - Set up HTTPS (Let's Encrypt via Certbot)
⚠ Never deploy with APP_DEBUG=true
Debug mode exposes stack traces and environment variables in error responses.
Zero-Downtime Deployment
Use a symlink-swap strategy with a tool like Deployer or Envoyer:
releases/
20260501_120000/ ← previous release
20260518_093000/ ← new release
current -> releases/20260518_093000 ← symlink
Docker
A Dockerfile is included in the project root for containerised deployments:
docker build -t my-app .
docker run -p 80:80 --env-file .env my-app
Or with Docker Compose for a full stack (PHP-FPM + Nginx + MySQL):
docker compose up -d --build
✅ Tip
Mount
.env as a Docker secret or use a secrets manager (AWS Secrets Manager, Vault) rather than baking it into the image.