Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
81 lines (81 loc) · 2.37 KB
/
Copy pathcompose.yaml
File metadata and controls
81 lines (81 loc) · 2.37 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
name: forest
x-forest-environment: &forest-environment
FOREST_DATA_DIR: /data
FOREST_DATABASE_PASSWORD_FILE: /run/secrets/database_password
FOREST_DATABASE_HOST: postgres
FOREST_OWNER_TOKEN_FILE: /run/secrets/owner_token
x-forest-service: &forest-service
image: forest:local
build:
context: .
target: runtime
restart: unless-stopped
init: true
environment: *forest-environment
secrets: [database_password, owner_token]
volumes: [research:/data]
read_only: true
tmpfs: [/tmp:size=1g, /home/forest/.cache:size=512m]
security_opt: [no-new-privileges:true]
cap_drop: [ALL]
stop_grace_period: 30s
services:
postgres:
image: postgres:17-bookworm
restart: unless-stopped
environment:
POSTGRES_USER: forest
POSTGRES_PASSWORD_FILE: /run/secrets/database_password
POSTGRES_DB: forest
secrets: [database_password]
volumes: [postgres:/var/lib/postgresql/data]
healthcheck:
test: [CMD-SHELL, 'pg_isready -U forest -d forest']
interval: 5s
timeout: 3s
retries: 20
stop_grace_period: 30s
data-init:
image: forest:local
build:
context: .
target: runtime
user: '0:0'
entrypoint: [python, -c]
command: ['import os; os.chown("/data",10001,10001)']
volumes: [research:/data]
restart: 'no'
api:
<<: *forest-service
ports: ['127.0.0.1:${FOREST_PORT:-8000}:8000']
depends_on:
postgres: {condition: service_healthy}
data-init: {condition: service_completed_successfully}
healthcheck:
test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health',timeout=3)"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
worker:
<<: *forest-service
command: [python, -m, services.worker.main]
environment:
<<: *forest-environment
FOREST_WORKER_CONCURRENCY: ${FOREST_WORKER_CONCURRENCY:-2}
depends_on:
api: {condition: service_healthy}
healthcheck:
test: [CMD, python, /forest/scripts/container_entrypoint.py, python, /forest/scripts/worker_health.py]
interval: 15s
timeout: 10s
retries: 3
start_period: 30s
volumes:
postgres:
research:
secrets:
database_password:
file: ${FOREST_SECRETS_DIR:-./var/deployment/secrets}/database_password
owner_token:
file: ${FOREST_SECRETS_DIR:-./var/deployment/secrets}/owner_token