-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
167 lines (158 loc) · 4.14 KB
/
docker-compose.yml
File metadata and controls
167 lines (158 loc) · 4.14 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
services:
proxy:
image: ${CADDY_IMAGE:-caddy:2.8.4}
env_file: .env
depends_on:
api:
condition: service_healthy
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
restart: unless-stopped
db:
image: ${POSTGRES_IMAGE:-postgres:16.4}
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
restart: unless-stopped
redis:
image: ${REDIS_IMAGE:-redis:7.4.1}
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
restart: unless-stopped
minio:
image: ${MINIO_SERVER_IMAGE:-minio/minio:RELEASE.2025-04-22T22-12-26Z}
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
ports:
- "127.0.0.1:9000:9000"
- "127.0.0.1:9001:9001"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:9000/minio/health/live >/dev/null"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
restart: unless-stopped
minio_init:
image: ${MINIO_MC_IMAGE:-minio/mc:RELEASE.2025-04-16T18-13-26Z}
depends_on:
minio:
condition: service_healthy
entrypoint: >
/bin/sh -c "
until (/usr/bin/mc alias set local ${MINIO_ENDPOINT} ${MINIO_ACCESS_KEY} ${MINIO_SECRET_KEY}) do sleep 1; done;
/usr/bin/mc mb -p local/${MINIO_BUCKET} || true;
echo 'MinIO bucket ensured.';
"
restart: "no"
api:
build:
context: ./api
env_file: .env
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
minio_init:
condition: service_completed_successfully
expose:
- "8000"
volumes:
- api_logs:/var/log/memory_engine
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/healthz"]
interval: 15s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
worker:
build:
context: ./api
env_file: .env
depends_on:
api:
condition: service_healthy
redis:
condition: service_healthy
db:
condition: service_healthy
minio:
condition: service_healthy
command: celery -A memory_engine worker -l info
healthcheck:
test: ["CMD-SHELL", "celery -A memory_engine inspect ping -d \"celery@$$HOSTNAME\" --timeout=5 | grep -q 'pong'"]
interval: 30s
timeout: 10s
retries: 5
start_period: 45s
restart: unless-stopped
beat:
build:
context: ./api
env_file: .env
depends_on:
api:
condition: service_healthy
redis:
condition: service_healthy
db:
condition: service_healthy
minio:
condition: service_healthy
command: celery -A memory_engine beat -l info
healthcheck:
test: ["CMD", "python", "manage.py", "check_beat_heartbeat"]
interval: 30s
timeout: 10s
retries: 5
start_period: 90s
restart: unless-stopped
presence_sensor:
profiles: ["presence"]
build:
context: ./presence_sensor
env_file: .env
depends_on:
redis:
condition: service_healthy
devices:
- "${PRESENCE_CAMERA_DEVICE:-/dev/video0}:${PRESENCE_CAMERA_DEVICE:-/dev/video0}"
healthcheck:
test: ["CMD-SHELL", "python -c \"import os,sys,time; p='/tmp/presence_sensor.last'; sys.exit(0 if os.path.exists(p) and (time.time()-os.path.getmtime(p)) < 45 else 1)\""]
interval: 20s
timeout: 5s
retries: 3
start_period: 30s
restart: unless-stopped
volumes:
caddy_data:
caddy_config:
db_data:
minio_data:
api_logs: