Restart Celtic automatically and cap container memory
The VPS is shared with other workloads and has no swap. On 2026-10-28 a Docker daemon restart stopped every container; those with restart: unless-stopped (all of Celtic) stayed down ~65 minutes until started by hand. - restart: always on all services so the stack returns after a daemon restart - mem_limit per service (db 512m, api 768m, backup 256m, web/caddy 128m) - oom_score_adj -500 on db and api so the kernel kills other workloads first Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+17
-5
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user