Production Checklist
Before deploying, review the following checklist to ensure your application is secure and performant:- Set
APP_ENV=productionandAPP_DEBUG=falsein your.envfile. - Ensure
APP_KEYis set to a secure, randomly generated string. - Configure a secure SSL/TLS certificate (Traefik can handle this via Let’s Encrypt).
- Ensure your
docker-compose.ymlor production equivalent overrides development settings (e.g., exposing only necessary ports).
Deployment Steps
Environment Configuration
Configure your
.env for the production environment on your host machine. Ensure that you update your database credentials, Redis settings, and WebSocket host configurations correctly.Build and Start Containers
In a production environment, you should start your Docker Compose stack. It’s recommended to build the images on the production server (or use pre-built images from a registry).(Assuming you have a production override file; otherwise, just use
docker compose up -d --build)Optimize Laravel
Run Laravel’s built-in optimization commands inside the application container to cache configuration, routes, and views for faster execution.
Managing Background Processes
DocuCast relies heavily on background queues and WebSockets. Since you are using Docker, these processes are managed as individual containers rather than using a process monitor like Supervisor.Queue Workers
If you haven’t already, add a dedicated queue worker service to yourdocker-compose.yml:
Laravel Reverb
The Reverb WebSocket server is already defined as thereverb service in your docker-compose.yml. Docker will automatically manage this container and restart it if it crashes (restart: unless-stopped).
Traefik and SSL
In production, Traefik handles reverse proxying and SSL termination. You can configure Traefik to automatically issue Let’s Encrypt certificates by adding the appropriate labels to thenginx and reverb services in your docker-compose.yml to enable HTTPS traffic.
Docker Swarm / Kubernetes (Optional)
If you are deploying using Docker Swarm or Kubernetes, you can utilize the provided Dockerfiles and thedocker-compose.yml (adapted for production) to orchestrate your containers. Ensure that you persist data volumes for PostgreSQL and Redis to prevent data loss upon container restarts.