forked from SoroLabs/SoroTask
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
54 lines (52 loc) · 2.09 KB
/
Copy pathdocker-compose.yml
File metadata and controls
54 lines (52 loc) · 2.09 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
services:
keeper:
build:
context: ./keeper
dockerfile: Dockerfile
# Load all environment variables from keeper/.env
# Copy keeper/.env.example → keeper/.env and fill in your values before running.
env_file:
- ./keeper/.env
volumes:
# Persist the task registry (data/tasks.json) across container restarts.
- ./keeper/data:/app/data
ports:
# Expose the health / metrics HTTP server.
- "3001:3000"
restart: unless-stopped
healthcheck:
# Uses wget (available in Alpine) to probe the /health endpoint.
# wget exits non-zero on HTTP errors, which satisfies Docker's check.
test: ["CMD-SHELL", "wget -qO- http://localhost:3000/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
# ── Health-check sidecar ────────────────────────────────────────────────────
# Polls the keeper's /health endpoint and sends SIGTERM to PID 1 of the
# keeper container after FAILURE_THRESHOLD consecutive failures, causing
# Docker to restart it (per the keeper's restart: unless-stopped policy).
keeper-sidecar:
image: curlimages/curl:8.7.1 # tiny image (~12 MB) with curl pre-installed
depends_on:
- keeper
volumes:
- ./keeper/health-check-sidecar.sh:/sidecar/health-check-sidecar.sh:ro
environment:
HEALTH_URL: "http://keeper:3000/health"
POLL_INTERVAL_S: "${SIDECAR_POLL_INTERVAL_S:-15}"
FAILURE_THRESHOLD: "${SIDECAR_FAILURE_THRESHOLD:-3}"
# Signal the keeper container's entrypoint process via the shared network.
# In a real deployment replace with: supervisorctl restart keeper
RESTART_CMD: "wget -qO- --post-data='' http://keeper:3000/health || true"
entrypoint: ["sh", "/sidecar/health-check-sidecar.sh"]
restart: unless-stopped
indexer:
build:
context: ./indexer
dockerfile: Dockerfile
ports:
- "4000:4000"
volumes:
- ./indexer/indexer.db:/app/indexer.db
restart: unless-stopped