Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions deploy/data/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ services:
restart: unless-stopped
cpus: ${WORKER_CPUS}
mem_limit: ${WORKER_MEM_LIMIT}
# On stop, celery's warm shutdown finishes the active task before exiting.
# Docker's default grace is 10s and then SIGKILLs — which would kill a
# minutes-long tile build or fabric import mid-flight. Give it real time;
# when the queue is drained first (deploy scripts), shutdown is instant.
stop_grace_period: 15m
# tippecanoe opens temp files scaled to the host's core count plus
# per-tile geometry files; on a many-core host a large tile build blows
# through Docker's default soft limit of 1024 and dies with EMFILE
Expand Down
14 changes: 14 additions & 0 deletions deploy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ server {
gzip on;
gzip_types text/css application/javascript application/json application/vnd.mapbox-vector-tile;

# Maintenance mode: `touch /srv/bdk/maintenance/on` on the host 503s every
# new request instantly (the -f is checked per request — no reload);
# `rm -f` restores. In-flight requests are unaffected. Used to quiesce the
# site before a deploy so no new work reaches the backend or the worker.
location / {
if (-f /maintenance/on) {
return 503;
}
proxy_pass http://backend:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
Expand All @@ -32,4 +39,11 @@ server {
proxy_send_timeout 300s;
proxy_connect_timeout 60s;
}

error_page 503 @maintenance;
location @maintenance {
default_type text/plain;
add_header Retry-After 300 always;
return 503 "BDK is down for maintenance and will be back shortly.";
}
}
4 changes: 4 additions & 0 deletions deploy/web/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@ services:
- ../nginx.conf:/etc/nginx/templates/default.conf.template:ro
- ${SSL_CERT_PATH}:/etc/nginx/ssl/server.crt:ro
- ${SSL_KEY_PATH}:/etc/nginx/ssl/server.key:ro
# Maintenance flag dir — OUTSIDE the checkout on purpose: deploy.sh
# refuses a dirty tree, and an untracked flag file would count as dirty.
# `touch /srv/bdk/maintenance/on` = down for maintenance; `rm -f` = up.
- /srv/bdk/maintenance:/maintenance:ro
environment:
- SERVER_NAME=${SERVER_NAME}
Loading