Zero-Downtime Blue/Green Deployments
Learn how epd ensures that zero live user requests are ever dropped during a deployment or rollback.
The Blue/Green Lifecycle
Unlike standard container restarts which drop connections while waiting for a new process to boot, epd uses alternating slots (blue and green):
[1. Build & Ship] Builds image locally or uploads process archive
│
▼
[2. Start Idle Slot] Replicas boot up in the alternate slot (e.g., Green)
│
▼
[3. Health Probe Loop] Probes /health inside the server on each replica
│ └─► If fails: Green killed, Blue remains untouched!
▼
[4. Atomic Traefik Switch] Rewrites /var/lib/epd/proxy/dynamic/<app>.yml
│ └─► Traefik routes new traffic to Green instantly
▼
[5. Connection Draining] Waits drain seconds for in-flight requests to complete
│
▼
[6. Retire Previous Slot] Stops previous Blue slot replicas safely1. Health Probe Verification
Before Traefik receives instructions to route traffic to the new version, epd probes every replica locally on the host server.
healthcheck:
path: /health # HTTP endpoint to probe (default: "/")
status: 200-399 # Acceptable HTTP status codes (default: 200-399)
timeout: 45 # Maximum seconds to wait before failing (default: 60)
interval: 2 # Seconds between consecutive probe attempts
delay: 2 # Delay in seconds before starting probesSafety Guarantee:
If your new version crashes on boot, fails database migrations, or throws an unhandled exception:
- The health probe times out or encounters fatal errors.
epdimmediately cleans up the new slot.- The existing slot remains live and serving traffic without interruption.
- No visitors experience an error or outage.
2. Connection Draining
When traffic is switched to the new slot, existing long-lived HTTP requests or WebSockets hitting the old slot need time to finish processing.
You can configure the drain period in epd.yml:
servers:
web:
hosts: [203.0.113.10]
drain: 15 # Seconds to wait before stopping the old slot (default: 10)
stop_timeout: 20 # SIGTERM to SIGKILL grace period for containers3. Instant Rollback
Because epd preserves previous image releases and dynamic configurations on the host server:
# Roll back immediately to the previous slot
epd rollback
# Or list all historical versions on servers:
epd rollback --list
# Roll back to a specific past version:
epd rollback v1.4.2Rolling back does not require rebuilding or re-uploading your application code. epd spins up the previous version and performs an atomic route switch in under 3 seconds.
Next Steps
- Explore Multi-Site Hosting on a Single VPS
- Learn about High Availability & Clustering
- Configure Advanced Routing & Traefik