Repository navigation
Description
Problem
Persisted Caddy routes remain unavailable until PostgreSQL and Valkey have become ready during an appliance restart/redeploy, even though the controller can recover the active snapshot without those services. This adds avoidable proxy downtime during database recovery or a slow cache startup.
The production entrypoint currently waits for PostgreSQL, then Valkey, then the CrowdSec supervisor, before starting the controller/Caddy. It already starts Caddy before database migrations and the web application.
Relevant code: entrypoint startup order, snapshot recovery.
Reproduction and measured evidence
Tested current production source tree b01ccfa5a5cdc98f80b148b8cd7906285d6a7bcb (local d950f0d9416c7b0361517cea913d76be90a22efc, identical tree to merged main b572535253f96c7b1027b563c780c80b91282a31) using isolated Docker containers, volumes and a real database-backed HTTP/HTTPS route. Environment: Linux/amd64 engine on Docker Desktop 4.93.0, Engine 29.8.1, Compose 5.5.1.
- Start the production appliance with a new test volume, configure a routed host, and bind an imported fixture certificate.
- Continuously probe the external HTTP and HTTPS ports (150 ms pauses, bounded requests).
- Restart or force-recreate the same image.
- Repeat with an explicit test entrypoint that inserts
sleep 15immediately beforestart_postgres, then repeat beforestart_valkey. Keep all other startup/security behavior unchanged.
| Scenario | HTTP success-to-success outage bracket | HTTPS bracket |
|---|---|---|
| Same-image restart | 5.279 s | 5.271 s |
| Same-image force-recreate | 5.556 s | 5.542 s |
| PostgreSQL startup delayed 15 s | 20.385 s | 20.373 s |
| Valkey startup delayed 15 s | 20.514 s | 20.504 s |
These are individual local measurements, with shared-host load and sampling uncertainty; they are not a universal downtime guarantee. The delays are deliberate test perturbations. The standard image itself was not changed.
Expected behavior / acceptance checks
- Recover supported persisted snapshots and serve existing HTTP/HTTPS proxy routes before waiting for independent PostgreSQL/Valkey readiness.
- Preserve managed CrowdSec readiness, credentials and fail-open/fail-closed policy; do not bypass its security prerequisites to start faster.
- Keep migration and web readiness gates intact. Fresh installations and unsupported old snapshot versions need their existing safe behavior.
- Add continuous external HTTP/HTTPS probes through restart/recreate and delayed-dependency startup, separate from final application health checks.
- Document the unavoidable interruption when replacing a single appliance container. This issue does not promise zero downtime or require a new deployment architecture.
Found during final local validation for #75; related to the recovery work in #12 and upgrade hardening in #67.
Activity