Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker swarm for zero downtime deployments #4

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ jobs:
WATCHTOWER_NOTIFICATION_URL: ${{ secrets.watchtower_notification_url }}
EMAIL: ${{ secrets.caddy_email }}
with:
docker_swarm: true
remote_docker_host: ${{ secrets.server_address }}
tailscale_ssh: true # no need for manual private and public keys
upload_directory: true # upload docker directory
docker_compose_directory: caddy # directory to upload
args: -p status up -d
args: -p status --prune
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@ services:
- config:/config
networks:
web:
healthcheck:
# https://ryanblunden.com/for-those-looking-for-a-http-health-check-in-alpine-images-wget-is-available-from-the-base-image-a07997be8699
test: ["CMD", "wget", "--spider", "-q", "http://localhost"]
interval: 5s
timeout: 10s
retries: 3
start_period: 10s
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 30s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

uptime-kuma:
image: louislam/uptime-kuma:1.21.1@sha256:b302edd66b7d130f7d4b2777a212674f046909721b5a66d7c1858505a4780981
Expand All @@ -29,6 +51,21 @@ services:
- /home/ubuntu/uptime-kuma:/app/data
networks:
web:
deploy:
# swarm zero-down time deployment
update_config:
delay: 5s
order: start-first
monitor: 4s
failure_action: rollback
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

configs:
Caddyfile:
Expand Down