-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
227 lines (213 loc) · 6.97 KB
/
Copy pathdocker-compose.yml
File metadata and controls
227 lines (213 loc) · 6.97 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
services:
# ─────────────────────────────────────────
# Infrastructure
# ─────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: edukai_redis
restart: unless-stopped
ports:
- "6379:6379" # expose for local debugging; remove in prod
volumes:
- redis_data:/data
postgres:
image: postgres:16-alpine
container_name: edukai_postgres
restart: unless-stopped
environment:
POSTGRES_DB: edukai_db
POSTGRES_USER: edukai_user
POSTGRES_PASSWORD: strongpassword
ports:
- "5431:5432" # expose for local debugging with pgAdmin etc.
volumes:
- postgres_data:/var/lib/postgresql/data
minio:
image: minio/minio
container_name: edukai_minio
restart: unless-stopped
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin123
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio_data:/data
command: server data --console-address ":9001"
# ─────────────────────────────────────────
# AI Service
# ─────────────────────────────────────────
ai:
build:
context: ./AI
dockerfile: Dockerfile
container_name: edukai_ai
restart: unless-stopped
depends_on:
- redis
environment:
REDIS_URL: redis://redis:6379/3
APP_BASE_URL: http://ai:8080/
# OPENAI_API_KEY: set in your .env file or pass here
env_file:
- ./AI/.env
ports:
- "8080:8080"
volumes:
- ai_static:/app/app/static
command: uvicorn app.main:app --host 0.0.0.0 --port 8080
ai_worker:
build:
context: ./AI
dockerfile: Dockerfile
container_name: edukai_ai_worker
restart: unless-stopped
depends_on:
- redis
- ai
environment:
REDIS_URL: redis://redis:6379/3
APP_BASE_URL: http://ai:8080/
env_file:
- ./AI/.env
volumes:
- ai_static:/app/app/static
command: celery -A app.core.celery_app worker --loglevel=info
# ─────────────────────────────────────────
# Backend
# ─────────────────────────────────────────
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: edukai_backend
restart: unless-stopped
depends_on:
- redis
- postgres
- minio
- ai
environment:
DATABASE_URL: postgres://edukai_user:strongpassword@postgres:5432/edukai_db
REDIS_URL: redis://redis:6379/1
CELERY_BROKER_URL: redis://redis:6379/2
CELERY_RESULT_BACKEND: redis://redis:6379/2
MINIO_ENDPOINT_URL: http://minio:9000 # internal: backend → minio
MINIO_PUBLIC_URL: http://localhost:9000 # external: browser → minio (change to VPS IP in prod)
MINIO_INTERNAL_URL: http://minio:9000
AI_BASE_URL: http://ai:8080
env_file:
- ./backend/.env
ports:
- "8000:8000"
volumes:
- backend_media:/app/media
- backend_static:/app/staticfiles
- import_tmp:/tmp/imports
command: >
sh -c "python manage.py migrate --noinput &&
python manage.py collectstatic --noinput &&
python manage.py runserver 0.0.0.0:8000"
celery_default:
build:
context: ./backend
dockerfile: Dockerfile
container_name: edukai_celery_default
restart: unless-stopped
depends_on:
- backend
- redis
- postgres
env_file:
- ./backend/.env
environment:
DATABASE_URL: postgres://edukai_user:strongpassword@postgres:5432/edukai_db
REDIS_URL: redis://redis:6379/1
CELERY_BROKER_URL: redis://redis:6379/2
CELERY_RESULT_BACKEND: redis://redis:6379/2
MINIO_ENDPOINT_URL: http://minio:9000
MINIO_PUBLIC_URL: http://localhost:9000 # ← keep for browser URLs
MINIO_INTERNAL_URL: http://minio:9000 # ← new: for AI worker URLs
AI_BASE_URL: http://ai:8080
volumes:
- backend_media:/app/media
- import_tmp:/tmp/imports
command: celery -A edukai worker --queues=default --concurrency=4 --loglevel=info --hostname=default@%h
celery_pdf:
build:
context: ./backend
dockerfile: Dockerfile
container_name: edukai_celery_pdf
restart: unless-stopped
depends_on:
- backend
- redis
- postgres
env_file:
- ./backend/.env
environment:
DATABASE_URL: postgres://edukai_user:strongpassword@postgres:5432/edukai_db
REDIS_URL: redis://redis:6379/1
CELERY_BROKER_URL: redis://redis:6379/2
CELERY_RESULT_BACKEND: redis://redis:6379/2
MINIO_ENDPOINT_URL: http://minio:9000
MINIO_PUBLIC_URL: http://localhost:9000
MINIO_INTERNAL_URL: http://minio:9000
AI_BASE_URL: http://ai:8080
volumes:
- backend_media:/app/media
command: celery -A edukai worker --queues=pdf --concurrency=2 --loglevel=info --hostname=pdf@%h
celery_polling:
build:
context: ./backend
dockerfile: Dockerfile
container_name: edukai_celery_polling
restart: unless-stopped
depends_on:
- backend
- redis
- postgres
env_file:
- ./backend/.env
environment:
DATABASE_URL: postgres://edukai_user:strongpassword@postgres:5432/edukai_db
REDIS_URL: redis://redis:6379/1
CELERY_BROKER_URL: redis://redis:6379/2
CELERY_RESULT_BACKEND: redis://redis:6379/2
MINIO_ENDPOINT_URL: http://minio:9000
MINIO_PUBLIC_URL: http://localhost:9000
MINIO_INTERNAL_URL: http://minio:9000
AI_BASE_URL: http://ai:8080
volumes:
- backend_media:/app/media
command: celery -A edukai worker --queues=polling --concurrency=4 --loglevel=info --hostname=polling@%h
celery_beat:
build:
context: ./backend
dockerfile: Dockerfile
container_name: edukai_celery_beat
restart: unless-stopped
depends_on:
- backend
- redis
- postgres
env_file:
- ./backend/.env
environment:
DATABASE_URL: postgres://edukai_user:strongpassword@postgres:5432/edukai_db
REDIS_URL: redis://redis:6379/1
CELERY_BROKER_URL: redis://redis:6379/2
CELERY_RESULT_BACKEND: redis://redis:6379/2
command: celery -A edukai beat --loglevel=info
# ─────────────────────────────────────────
# Volumes
# ─────────────────────────────────────────
volumes:
redis_data:
postgres_data:
minio_data:
ai_static:
backend_media:
backend_static:
import_tmp: