forked from hotosm/fAIr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
219 lines (207 loc) · 5.42 KB
/
docker-compose.dev.yml
File metadata and controls
219 lines (207 loc) · 5.42 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
# fAIr Application Development Stack
x-common-env: &common-env
env_file:
- ${ENV_FILE:-.env.dev}
x-common-volumes: &common-volumes
volumes:
- ${LOG_PATH:-./fair-app-data/log}:${LOG_PATH:-/app/log}
- ${RAMP_HOME:-./fair-app-data/ramp}:${RAMP_HOME:-/ramp}
- ${TRAINING_WORKSPACE:-./fair-app-data/trainings}:${TRAINING_WORKSPACE:-/trainings}
- ${APP_HOME:-./}backend/core:/app/core
- ${APP_HOME:-./}backend/login:/app/login
- ${APP_HOME:-./}backend/aiproject:/app/aiproject
services:
postgres:
<<: *common-env
image: postgis/postgis:17-3.5-alpine
platform: linux/amd64
container_name: pgsql
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-ai}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-admin}
volumes:
- ${POSTGRES_DATA:-./fair-app-data/postgres}:/var/lib/postgresql/data
ports:
- "5434:5432"
networks:
- backend-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
redis:
<<: *common-env
image: redis:8-alpine
platform: linux/amd64
container_name: redis
restart: unless-stopped
command: redis-server
volumes:
- ${REDIS_DATA:-./fair-app-data/redis}:/data
ports:
- "6378:6379"
networks:
- backend-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
backend-api:
<<: [*common-env, *common-volumes]
image: ghcr.io/hotosm/fair-api:develop
build:
context: ./backend
dockerfile: Dockerfile.API
platform: linux/amd64
container_name: api
restart: unless-stopped
command: python manage.py runserver_with_q 0.0.0.0:8000
ports:
- "127.0.0.1:8000:8000"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- backend-network
healthcheck:
test:
[
"CMD-SHELL",
'python -c "import sys, requests; r = requests.get(''http://127.0.0.1:8000/api/''); print(r); sys.exit(0 if r.status_code==200 else 1)"',
]
interval: 30s
timeout: 10s
retries: 2
deploy:
resources:
limits:
cpus: "1"
memory: 1G
backend-worker-cpu:
<<: [*common-env, *common-volumes]
profiles: ["cpu"]
image: ghcr.io/hotosm/fair-worker:develop-cpu
build:
context: ./backend
dockerfile: Dockerfile.workers
args:
- BUILD_TYPE=cpu
platform: linux/amd64
container_name: worker-cpu
restart: unless-stopped
command: celery -A aiproject worker --loglevel=INFO --concurrency=1 -Q ramp_training,yolo_training
depends_on:
backend-api:
condition: service_healthy
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- backend-network
deploy:
resources:
limits:
cpus: "1"
memory: 2G
backend-worker-gpu:
<<: [*common-env, *common-volumes]
profiles: ["gpu"]
image: ghcr.io/hotosm/fair-worker:develop-gpu
build:
context: ./backend
dockerfile: Dockerfile.workers
args:
- BUILD_TYPE=gpu
platform: linux/amd64
container_name: worker-gpu
restart: unless-stopped
command: celery -A aiproject worker --loglevel=INFO --concurrency=1 -Q ramp_training,yolo_training --pool=solo
depends_on:
backend-api:
condition: service_healthy
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- backend-network
deploy:
resources:
reservations:
devices:
- driver: nvidia
capabilities: [gpu]
limits:
memory: 4G
prediction-worker:
<<: [*common-env, *common-volumes]
image: ghcr.io/hotosm/fair-offline-predictor:develop
build:
context: ./backend
dockerfile: Dockerfile.API
args:
- BUILD_TARGET=predictor
platform: linux/amd64
container_name: prediction-worker
restart: unless-stopped
command: celery -A aiproject worker --loglevel=INFO --concurrency=1 -Q predictions --pool=solo
depends_on:
backend-api:
condition: service_healthy
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- backend-network
deploy:
resources:
limits:
cpus: "1"
memory: 2G
flower:
<<: *common-env
image: mher/flower:2.0.1
platform: linux/amd64
container_name: flower
restart: unless-stopped
command: celery --broker=redis://${REDIS_USER:-redis}:${REDIS_PASSWORD:-}@redis:6379/0 flower --address=0.0.0.0 --port=5000
ports:
- "5500:5000"
depends_on:
redis:
condition: service_healthy
networks:
- backend-network
profiles:
- cpu
- gpu
frontend:
<<: *common-env
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: frontend
restart: unless-stopped
command: pnpm run dev --port 3000 --host 0.0.0.0
environment:
- NODE_ENV=development
ports:
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
networks:
- backend-network
depends_on:
- backend-api
networks:
backend-network:
driver: bridge