-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
77 lines (68 loc) · 3.36 KB
/
Copy pathdocker-compose.yml
File metadata and controls
77 lines (68 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
services:
spatial-data-studio:
build:
context: .
dockerfile: docker/Dockerfile
image: spatial-data-studio:latest
ports:
- "8080:8888"
# Single read-write data mount (DESIGN §19.9): inputs + saved checkpoints +
# snapshots share it. Defaults to ./test-data (ships with the repo) so demo
# saves land alongside the sample datasets; override with SDS_DATA_HOST_DIR to
# point at a dedicated folder in a real deployment.
volumes:
- type: bind
source: ${SDS_DATA_HOST_DIR:-./test-data}
target: /data
# RAM-backed working set: the unpacked .zarr.zip extract dir and the per-session
# normalized raster caches live on this tmpfs instead of disk, so tile/chunk reads
# are served from memory. Its usage counts against the memory budget (see
# SDS_WORK_DIR_IN_RAM), so admission trips a soft 503 before the tmpfs can grow past
# the container limit and trigger the OOM killer. Durable checkpoints/snapshots stay
# on the /data bind mount, never here.
# The size=10g here is only a pre-resize fallback: on startup the work-tmpfs.sh
# entrypoint remounts /work to SDS_WORK_TMPFS_PCT (85%) of the DETECTED memory limit,
# so the tmpfs autoscales with whatever memory the container is given. That remount
# needs CAP_SYS_ADMIN (cap_add below); without it the fallback size stands.
tmpfs:
- /work:size=10g,mode=1777
# Required so the entrypoint can remount /work at the detected size. Scoped to this
# single capability (not --privileged); it enables the mount syscall and nothing else.
cap_add:
- SYS_ADMIN
environment:
SDS_DATA_DIR: /data
SDS_WORK_DIR: /work
SDS_WORK_DIR_IN_RAM: "1"
# Memory: container gets 12 GB (mem_limit below). SDS_CONTAINER_MEM_MB is left unset
# so admission auto-detects the limit from the cgroup — the same value the entrypoint
# sizes the tmpfs from — so raising mem_limit scales admission and the tmpfs together.
# The /work tmpfs is folded into that admission accounting (SDS_WORK_DIR_IN_RAM).
SDS_MAX_SESSIONS: "4"
SDS_ADMISSION_PCT: "0.80"
# Where a person watches the app (the 8080 mapping above) — quoted by the MCP
# assistant (POST /api/mcp) when it directs the user to a session. Override
# when the container is published at a different host/port.
SDS_APP_URL: "${SDS_APP_URL:-http://localhost:8080}"
MPLBACKEND: "Agg"
PYTHONUNBUFFERED: "1"
# Cirro upload. Users sign in from the browser with their own Cirro account
# (device code), so no server-side credential — this only prefills the domain.
CIRRO_BASE_URL: "${CIRRO_BASE_URL:-}"
# Hard OS memory limit: the container is OOM-killed if it exceeds this. Keep
# in sync with SDS_CONTAINER_MEM_MB above (12288 MiB == 12g) so the app's soft
# admission control (refuses new work at SDS_ADMISSION_PCT of it) trips first.
mem_limit: 12g # docker compose / non-swarm
deploy:
resources:
limits:
memory: 12g # docker stack deploy / swarm
# Generous stop timeout so in-flight saves can flush (DESIGN §19.7)
stop_grace_period: 120s
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-sf", "http://127.0.0.1:8888/api/healthz"]
interval: 30s
timeout: 10s
start_period: 60s
retries: 3