feat: optimize prod deployment to avoid unnecessary container restarts
Some checks failed
Release / Test backend (push) Successful in 1m7s
Release / Test UI (push) Successful in 1m29s
Release / Build and push images (push) Successful in 4m30s
Release / Deploy to prod (push) Failing after 19s
Release / Deploy to homelab (push) Successful in 13s
Release / Gitea Release (push) Successful in 27s

Previously: 'docker compose up -d' recreated all services with changed images,
causing dependent services (pocketbase, minio, redis, etc.) to restart and
wait for healthchecks, leading to longer downtime.

Now: Use '--no-deps' flag to restart ONLY the services with updated images
(backend, runner, ui, caddy, pocketbase) without touching their dependencies.

Benefits:
- Faster deployments (~15-20s vs ~60s)
- No unnecessary restarts of infrastructure services
- Reduced downtime for the application

The final 'docker compose up -d --remove-orphans' ensures any orphaned
containers are cleaned up and all services are in the desired state.
This commit is contained in:
Admin
2026-04-16 21:51:42 +05:00
parent 7a4008bd9c
commit 1f987be75a

View File

@@ -130,6 +130,8 @@ jobs:
'set -euo pipefail
cd /opt/libnovel
doppler run -- docker compose pull backend runner ui caddy pocketbase
# Restart only the services with new images, without waiting for dependencies
doppler run -- docker compose up -d --no-deps backend runner ui caddy pocketbase
doppler run -- docker compose up -d --remove-orphans'
# ── deploy homelab runner ─────────────────────────────────────────────────────