-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
58 lines (57 loc) · 1.81 KB
/
docker-compose.yml
File metadata and controls
58 lines (57 loc) · 1.81 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
services:
chronicle-worker:
build:
context: .
dockerfile: Dockerfile
image: ${DOCKER_IMAGE:-chronicle-local:latest}
container_name: chronicle-worker
command: ["python", "-m", "chronicle.worker"]
network_mode: bridge
env_file:
- .env
volumes:
- ./data:/app/state
healthcheck:
test:
[
"CMD-SHELL",
"python -c \"import os,sys; from pathlib import Path; from chronicle.storage import is_worker_healthy; state=Path(os.getenv('STATE_DIR','state')); log=state / os.getenv('PROCESSED_LOG_FILE','processed_activities.log'); age=int(os.getenv('WORKER_HEALTH_MAX_AGE_SECONDS','900')); sys.exit(0 if is_worker_healthy(log, age) else 1)\"",
]
interval: 60s
timeout: 10s
retries: 3
start_period: 45s
restart: unless-stopped
chronicle-api:
build:
context: .
dockerfile: Dockerfile
image: ${DOCKER_IMAGE:-chronicle-local:latest}
container_name: chronicle-api
command:
[
"/bin/sh",
"-c",
"gunicorn --bind 0.0.0.0:${API_PORT:-1609} --workers ${API_WORKERS:-2} --threads ${API_THREADS:-4} --timeout ${API_TIMEOUT_SECONDS:-120} chronicle.api_server:app",
]
network_mode: bridge
env_file:
- .env
environment:
- SETUP_ENV_FILE=/app/.env
volumes:
- ./data:/app/state
- ./.env:/app/.env
ports:
- "${API_PORT:-1609}:${API_PORT:-1609}"
healthcheck:
test:
[
"CMD-SHELL",
"python -c \"import os,sys,urllib.request; p=os.getenv('API_PORT','1609'); u='http://127.0.0.1:%s/ready' % p; r=urllib.request.urlopen(u, timeout=5); sys.exit(0 if getattr(r, 'status', 200) == 200 else 1)\"",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
restart: unless-stopped