-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
239 lines (223 loc) · 7.21 KB
/
Copy pathdocker-compose.yml
File metadata and controls
239 lines (223 loc) · 7.21 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# docker-compose.yml -- Local full-stack development infrastructure
# DO NOT put real secrets here. Use .env file (see .env.example).
x-backend-health: &backend-health
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
services:
postgres:
image: timescale/timescaledb:latest-pg15
environment:
POSTGRES_DB: ${POSTGRES_DB:-agtech}
POSTGRES_USER: ${POSTGRES_USER:-agtech}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
volumes:
- pg_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-agtech} -d ${POSTGRES_DB:-agtech}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
ports:
- "${REDIS_PORT:-6379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
minio:
image: minio/minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:?Set MINIO_ACCESS_KEY in .env}
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:?Set MINIO_SECRET_KEY in .env}
volumes:
- minio_data:/data
ports:
- "${MINIO_PORT:-9000}:9000"
- "${MINIO_CONSOLE_PORT:-9001}:9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
minio-init:
image: minio/mc
profiles: ["init"]
depends_on:
minio:
condition: service_healthy
environment:
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:?Set MINIO_ACCESS_KEY in .env}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:?Set MINIO_SECRET_KEY in .env}
entrypoint: >
/bin/sh -c "
mc alias set local http://minio:9000 $$MINIO_ACCESS_KEY $$MINIO_SECRET_KEY &&
mc mb --ignore-existing local/models &&
mc mb --ignore-existing local/raw-images &&
mc mb --ignore-existing local/aligned-features &&
mc mb --ignore-existing local/exports
"
mosquitto:
image: eclipse-mosquitto:2
command: mosquitto -c /mosquitto-no-auth.conf
ports:
- "${MQTT_PORT:-1883}:1883"
healthcheck:
test: ["CMD-SHELL", "mosquitto_sub -h localhost -t '$$SYS/#' -C 1 -W 3 >/dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
db-migrate:
build:
context: .
dockerfile: backend/api_gateway/Dockerfile
profiles: ["init"]
env_file: .env
environment:
DATABASE_URL: ${DATABASE_URL_DOCKER:-postgresql://${POSTGRES_USER:-agtech}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-agtech}}
depends_on:
postgres:
condition: service_healthy
command: alembic -c /app/alembic.ini upgrade head
working_dir: /app
db-seed:
build:
context: .
dockerfile: backend/api_gateway/Dockerfile
profiles: ["init"]
env_file: .env
environment:
DATABASE_URL: ${DATABASE_URL_DOCKER:-postgresql://${POSTGRES_USER:-agtech}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-agtech}}
depends_on:
postgres:
condition: service_healthy
command: python scripts/seed_zones.py
working_dir: /app
ai-serving:
build:
context: .
dockerfile: backend/ai_serving/Dockerfile
env_file: .env
ports:
- "${AI_SERVING_PORT:-8001}:8001"
depends_on:
minio:
condition: service_healthy
command: uvicorn backend.ai_serving.main:app --host 0.0.0.0 --port 8001
healthcheck:
<<: *backend-health
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8001/healthz', timeout=2)"]
decision-engine:
build:
context: .
dockerfile: backend/decision_engine/Dockerfile
env_file: .env
ports:
- "${DECISION_ENGINE_PORT:-8002}:8002"
depends_on:
redis:
condition: service_healthy
command: uvicorn backend.decision_engine.main:app --host 0.0.0.0 --port 8002
healthcheck:
<<: *backend-health
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8002/healthz', timeout=2)"]
ingestion-service:
build:
context: .
dockerfile: backend/ingestion_service/Dockerfile
env_file: .env
environment:
DATABASE_URL: ${DATABASE_URL_DOCKER:-postgresql://${POSTGRES_USER:-agtech}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-agtech}}
REDIS_URL: redis://redis:6379/0
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command: uvicorn backend.ingestion_service.main:app --host 0.0.0.0 --port 8003
ports:
- "${INGESTION_SERVICE_PORT:-8003}:8003"
healthcheck:
<<: *backend-health
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8003/healthz', timeout=2)"]
api-gateway:
build:
context: .
dockerfile: backend/api_gateway/Dockerfile
env_file: .env
environment:
DATABASE_URL: ${DATABASE_URL_DOCKER:-postgresql://${POSTGRES_USER:-agtech}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-agtech}}
REDIS_URL: redis://redis:6379/0
AI_SERVING_URL: http://ai-serving:8001
INGESTION_SERVICE_URL: http://ingestion-service:8003
ALERT_TELEGRAM_ENABLED: ${ALERT_TELEGRAM_ENABLED:-false}
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:-}
TELEGRAM_CHAT_ID: ${TELEGRAM_CHAT_ID:-}
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:3000,http://localhost:8080}
IMAGERY_POLL_INTERVAL_SECONDS: ${IMAGERY_POLL_INTERVAL_SECONDS:-0}
ports:
- "${API_GATEWAY_PORT:-8000}:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ai-serving:
condition: service_healthy
ingestion-service:
condition: service_healthy
decision-engine:
condition: service_healthy
command: uvicorn backend.api_gateway.main:app --host 0.0.0.0 --port 8000
healthcheck:
<<: *backend-health
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/v1/healthz', timeout=2)"]
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
args:
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:8000}
VITE_WS_URL: ${VITE_WS_URL:-ws://localhost:8000/ws/updates}
ports:
- "${FRONTEND_PORT:-8080}:80"
depends_on:
api-gateway:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1/healthz"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
data-collector:
build:
context: .
dockerfile: backend/api_gateway/Dockerfile
profiles: ["data"]
env_file: .env
command: python scripts/run_data_collection.py --dry-run
working_dir: /app
volumes:
- ./data:/app/data
- ./reports:/app/reports
model-exporter:
build:
context: .
dockerfile: backend/ai_serving/Dockerfile
profiles: ["ml"]
env_file: .env
command: python ml_pipeline/export/export_onnx.py --dry-run
working_dir: /app
volumes:
- ./artifacts:/app/artifacts
volumes:
pg_data:
minio_data: