Automating Zero-Downtime Deployments with Dokploy
Introduction
Zero-downtime deployments ensure uninterrupted service during updates. This guide shows how to configure Dokploy for rolling updates and blue-green strategies.
Prerequisites
- Dokploy installed
- Application Dockerized
Step 1: Versioned Docker Images
Tag images with semver:
docker build -t myapp:1.0.0 .
Push to registry.
Step 2: Dokploy Config for Rolling Updates
dokploy.yaml
:
apps:
myapp:
image: myregistry/myapp:${VERSION}
container_name: myapp
update:
type: rolling
max_unavailable: 1
delay: 10s
Set VERSION
via env.
Step 3: Deploy Updated Version
export VERSION=1.0.1
git push dokploy main
Dokploy pulls new image, starts new container, stops old one after healthcheck.
Step 4: Healthchecks
Define healthcheck in Dockerfile:
HEALTHCHECK --interval=10s --timeout=5s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
Ensures new container is healthy before replacing.
Step 5: Blue-Green Strategy
apps:
myapp-blue:
image: myregistry/myapp:${VERSION}
port: 3001
myapp-green:
image: myregistry/myapp:${VERSION}
port: 3002
myapp:
proxy:
to: myapp-${COLOR}
Switch COLOR
env between blue
and green
.
Summary
Dokploy supports rolling updates and blue-green deployments via config. Use healthchecks and versioned images to automate zero-downtime updates.