-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathcompose.ghcr.yml
More file actions
170 lines (166 loc) · 5.08 KB
/
Copy pathcompose.ghcr.yml
File metadata and controls
170 lines (166 loc) · 5.08 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Standalone deployment file: download it on its own and `docker compose up -d`.
# It pulls prebuilt images from GHCR and every setting below has a default.
#
# Optional, best set in an .env file beside this one so later commands keep them:
# CHAP_IMAGE_TAG tag for both images (default: latest)
# latest = newest release, master = master branch, vX.Y.Z = pinned
# POSTGRES_USER database user (default: chap)
# POSTGRES_PASSWORD database password, must be URL-safe (default: chap)
# POSTGRES_DB database name (default: chap_core)
# CHAP_DATABASE_URL full percent-encoded URL, overrides the POSTGRES_* values
# CHAP_ROOT_PATH path prefix when served behind a reverse proxy
# CHAP_API_TOKEN API token; unset means no authentication
#
# An alternative to compose.yml, not an overlay: layering the two duplicates
# security_opt / cap_drop entries and fails validation.
services:
chap:
restart: unless-stopped
image: ghcr.io/dhis2-chap/chap-core:${CHAP_IMAGE_TAG:-latest}
platform: linux/amd64
init: true
environment:
REDIS_HOST: redis
REDIS_PORT: 6379
CHAP_DATABASE_URL: ${CHAP_DATABASE_URL:-postgresql://${POSTGRES_USER:-chap}:${POSTGRES_PASSWORD:-chap}@postgres:5432/${POSTGRES_DB:-chap_core}}
CELERY_BROKER: redis://redis:6379/0
CHAP_LOGS_DIR: /data/logs
CHAP_RUNS_DIR: /data/runs
CHAP_ROOT_PATH: ${CHAP_ROOT_PATH:-}
CHAP_API_TOKEN: ${CHAP_API_TOKEN:-}
read_only: true
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
user: chap:chap
volumes:
- type: tmpfs
target: /tmp
tmpfs:
size: 2000000000 # 2GB for runtime temp files (API service)
- type: volume
source: logs
target: /data/logs
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- default
- backend
ports:
- "8000:8000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 5s
timeout: 5s
retries: 10
start_period: 30s
depends_on:
redis:
condition: service_healthy
worker:
condition: service_started
postgres:
condition: service_healthy
worker:
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
image: ghcr.io/dhis2-chap/chap-worker:${CHAP_IMAGE_TAG:-latest}
platform: linux/amd64
init: true
environment:
IS_IN_DOCKER: 1
REDIS_HOST: redis
REDIS_PORT: 6379
CHAP_DATABASE_URL: ${CHAP_DATABASE_URL:-postgresql://${POSTGRES_USER:-chap}:${POSTGRES_PASSWORD:-chap}@postgres:5432/${POSTGRES_DB:-chap_core}}
CELERY_BROKER: redis://redis:6379
RENV_PATHS_ROOT: /data/renv
UV_CACHE_DIR: /data/uv
CHAP_LOGS_DIR: /data/logs
CHAP_RUNS_DIR: /data/runs
PYTENSOR_FLAGS: "base_compiledir=/data/pytensor"
networks:
- default
- backend
command: "/app/.venv/bin/celery -A chap_core.rest_api.celery_tasks worker --loglevel=info"
working_dir: /app
# Declared here, not inherited: a pinned tag may predate the image's HEALTHCHECK.
healthcheck:
test: ["CMD-SHELL", "/app/.venv/bin/celery -A chap_core.rest_api.celery_tasks inspect ping || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
extra_hosts:
- "host.docker.internal:host-gateway"
read_only: true
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
user: chap:chap
volumes:
- type: tmpfs
target: /tmp
tmpfs:
size: 2000000000 # 2GB for runtime temp files (model execution)
- type: volume
source: runs
target: /data/runs
- type: volume
source: renv
target: /data/renv
- type: volume
source: uv
target: /data/uv
- type: volume
source: logs
target: /data/logs
- type: volume
source: pytensor
target: /data/pytensor
redis:
restart: unless-stopped
image: valkey/valkey:8
networks:
- backend
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
postgres:
restart: unless-stopped
image: postgres:17
environment:
POSTGRES_USER: ${POSTGRES_USER:-chap}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-chap}
POSTGRES_DB: ${POSTGRES_DB:-chap_core}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-chap} -d ${POSTGRES_DB:-chap_core}"]
interval: 10s
timeout: 10s
retries: 10
start_period: 40s
volumes:
- chap-db:/var/lib/postgresql/data
networks:
- backend
expose:
- "5432"
volumes:
chap-db: {}
logs: {}
renv: {}
uv: {}
pytensor: {}
runs: {}
networks:
# redis and postgres live here, off the default network, so model services
# (which attach only to default) cannot reach the Celery broker or the database.
backend: {}