diff --git a/docker-compose.yml b/docker-compose.yml index ba7f635..759d90a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,13 @@ services: interval: 5s timeout: 5s retries: 10 - restart: unless-stopped + # `always`, not `unless-stopped`: after a Docker daemon restart, unless-stopped + # containers on this host stayed down until started by hand (2026-10-28, 65 min). + restart: always + # The VPS is shared and has no swap; the limit keeps one service from starving + # the box, and the negative score makes the kernel kill other workloads first. + mem_limit: 512m + oom_score_adj: -500 logging: *default-logging # Daily pg_dump of the whole database into ./backups on the host, the last 14 days kept. @@ -46,7 +52,8 @@ services: - ./backups:/backups - ./scripts/backup.sh:/backup.sh:ro entrypoint: ["/bin/sh", "/backup.sh"] - restart: unless-stopped + restart: always + mem_limit: 256m logging: *default-logging api: @@ -75,14 +82,18 @@ services: - no-new-privileges:true cap_drop: - ALL - restart: unless-stopped + restart: always + # Headroom for WeasyPrint PDF rendering on top of two uvicorn workers. + mem_limit: 768m + oom_score_adj: -500 logging: *default-logging # Responsive React web application. It is static after its production build; # Caddy below provides the public TLS endpoint. web: build: ./web - restart: unless-stopped + restart: always + mem_limit: 128m logging: *default-logging # Automatic HTTPS via Let's Encrypt — two lines of config, auto-renewal, @@ -103,7 +114,8 @@ services: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddydata:/data - caddyconfig:/config - restart: unless-stopped + restart: always + mem_limit: 128m logging: *default-logging volumes: