Deployment & Operations
Transitioning the Apptork Root System from a local machine to a production environment is seamless thanks to its strict containerized architecture.
Production Checklist
Before deploying, ensure you have correctly configured your production environment.
- Copy Secrets & Config: Duplicate the example production environment and configuration files:
- Secure Passwords: Update
POSTGRES_PASSWORD,REDIS_PASSWORD, andSECRET_KEYwith cryptographically secure strings. - Configure Object Storage: Replace the local MinIO credentials with real AWS S3 credentials. (Alternatively, you can keep using MinIO in production! MinIO is enterprise-grade, fully S3-compatible, and an excellent choice for self-hosting to eliminate massive cloud egress fees.)
- Configure Domains: Update
CORS_ALLOWED_ORIGINSandCSRF_TRUSTED_ORIGINSwith your actual frontend domain (e.g.,https://app.yourdomain.com). - Observability: Input your
SENTRY_DSNto enable automatic error tracking.
CORS for S3
Ensure your S3 bucket has the proper CORS policies if you are utilizing direct-to-S3 uploads from the frontend client.
Deployment Architectures
For early-stage startups or MVPs, a powerful VPS (e.g., DigitalOcean Droplet, Hetzner) is incredibly cost-effective.
We use Docker Swarm or raw Docker Compose on the host. The included docker-compose.yml mounts Nginx as the primary reverse proxy, sitting in front of Daphne (ASGI).
Make sure to map Nginx to ports 80 and 443, and configure SSL certificates via Let's Encrypt / Certbot.
As you scale, you can rip the docker-compose.yml apart:
- Host PostgreSQL on Amazon RDS.
- Host Redis on Amazon ElastiCache.
- Deploy the
apiimage to AWS ECS / Fargate. - Deploy the
celeryworkerandcelerybeatimages as continuous background tasks.
CI/CD via GitHub Actions
The boilerplate includes a pre-configured CI/CD pipeline (.github/workflows/deploy.yml) specifically engineered for automated VPS deployments over SSH.
How it works
- Trigger: You push a git tag matching
v*(e.g.,git tag v1.0.0; git push origin v1.0.0). - Action: GitHub Runner spins up and utilizes
appleboy/ssh-action. - Execution: It securely SSHes into your server using repository secrets (
SERVER_HOST,SERVER_SSH_KEY). - Pull & Restart: The script pulls the latest codebase from
main, rebuilds the docker images cleanly, runs database migrations, and restarts the containers with zero-downtime rolling updates.
Instant Deployment Parity
This provides instant, automated deployment parity without requiring expensive managed orchestration services right out of the gate.