added resource limits and healthchecks

This commit is contained in:
2026-05-16 00:59:53 -07:00
parent 58c2c96c54
commit 12f661980e
+22 -1
View File
@@ -17,7 +17,18 @@ services:
ports: ports:
- ${N8N_PORT:-5678}:5678 - ${N8N_PORT:-5678}:5678
depends_on: depends_on:
- db db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:5678/healthz || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
memory: 512m
restart: unless-stopped restart: unless-stopped
db: db:
@@ -29,6 +40,16 @@ services:
- POSTGRES_PASSWORD=${N8N_DB_PASSWORD:-changeme} - POSTGRES_PASSWORD=${N8N_DB_PASSWORD:-changeme}
volumes: volumes:
- n8n-db:/var/lib/postgresql/data - n8n-db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U n8n -d n8n"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
deploy:
resources:
limits:
memory: 512m
restart: unless-stopped restart: unless-stopped
volumes: volumes: