Dokploy & Cloud VPS Deployment
Continuous deployment using Dokploy, Git push triggers, Traefik SSL automation, and env variable injection.
Dokploy & Cloud VPS Deployment
IMPLEMENTED
The production infrastructure is orchestrated using Dokploy, a self-hosted PaaS alternative to Coolify/Heroku running on a Debian Linux VPS.
1. Dokploy Application Configuration
- Git Repository: Connects to
https://github.com/Taraldinn/sheba-erp(branch:main). - Build Type:
Dockerfile(pointing to rootDockerfile). - Domain Mapping:
api.shebafi.xyz-> Port8000(Backend API)app.shebafi.xyz-> Port3000(Frontend Dashboard)docs.shebafi.xyz-> Port3001(Fumadocs Portal)*.shebafi.xyz-> Port8000(Wildcard tenant domain routing)
- Automated SSL: Dokploy’s built-in Traefik reverse proxy issues and auto-renews Let's Encrypt TLS certificates.
2. Production Health Checks & Zero-Downtime Rollouts
- Dokploy polls the
/healthz/readiness probe. - When a new Git commit is pushed to
main:- Dokploy builds the new Docker image.
- Runs database migrations automatically via
RUN_MIGRATIONS=trueinentrypoint.sh. - Waits for the container healthcheck to pass.
- Flips the Traefik proxy routes to the new container.
- Terminates the old container without dropping active HTTP connections.
3. Redis Setup & Dokploy Networking
In Dokploy, Redis can be deployed via Dokploy Managed Database or Dokploy Compose.
Why localhost Fails in Dokploy
Inside a Docker container, localhost (or 127.0.0.1) refers strictly to the container itself. Because Redis runs in a separate container, connecting to redis://localhost:6379/0 will fail with Connection refused (Errno 111).
Option A: Dokploy Managed Database (Recommended in UI)
- In Dokploy, go to your Project -> Create Database -> Redis.
- Note the Service Name (e.g.,
sheba-redis) and generated Password. - In your Backend Application -> Configuration -> Network, ensure both services are connected to the same network (
dokploy-network). - In Backend Application -> Environment Variables, set:
Or set discrete variables (auto-assembled by Django):REDIS_URL=redis://:your_password@sheba-redis:6379/0REDIS_HOST=sheba-redis REDIS_PORT=6379 REDIS_PASSWORD=your_password REDIS_DB=0
Option B: Dokploy Compose (Stack)
If deploying via docker-compose.yml, the Redis service is named redis:
REDIS_URL=redis://redis:6379/0
# Or if password is set:
REDIS_URL=redis://:your_password@redis:6379/0Diagnostic Command
To verify Redis connectivity inside the Dokploy container, execute:
python manage.py check_redisThis inspects DNS resolution, TCP handshakes, authentication, latency, and distributed lock safety.