-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
194 lines (184 loc) · 4.53 KB
/
docker-compose.yml
File metadata and controls
194 lines (184 loc) · 4.53 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
services:
nginx:
build:
context: ./nginx
dockerfile: Dockerfile
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf:/etc/nginx/conf.d
depends_on:
- frontend
- backend
restart: unless-stopped
networks:
- frontend_network
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
volumes:
- ./frontend:/app
- /app/node_modules
environment:
- NODE_ENV=development
- VITE_API_BASE_URL=/api
networks:
- frontend_network
depends_on:
- backend
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
backend:
build:
context: ./backend
dockerfile: Dockerfile
volumes:
- ./backend:/app
environment:
- ENVIRONMENT=development
- DATABASE_URL=postgresql://postgres:postgres@db_master:5432/thesis_db
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- MINIO_URL=minio:9000
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin
- N8N_API_BASE_URL=https://n8n.hsueh.tw
- PDF_SPLITTER_URL=http://split_sentences:8000
- MAX_WORKERS=8
- CONCURRENCY_LIMIT=60
- UPLOAD_TIMEOUT_MINUTES=10
depends_on:
- db_master
- redis
- minio
- split_sentences
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- frontend_network
- backend_network
db_master:
image: postgres:14
ports:
- "5432:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=thesis_db
volumes:
- postgres_master_data:/var/lib/postgresql/data
- ./database/init:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- backend_network
command: postgres -c max_connections=200
db_slave:
image: postgres:14
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=thesis_db
volumes:
- postgres_slave_data:/var/lib/postgresql/data
- ./database/replica:/docker-entrypoint-initdb.d
depends_on:
- db_master
networks:
- backend_network
redis:
image: redis:7-alpine
command: redis-server --requirepass redis --maxclients 100
volumes:
- redis_data:/data
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "-a", "redis", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- backend_network
minio:
image: minio/minio
command: server /data --console-address ":9001"
volumes:
- minio_data:/data
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
ports:
- "9000:9000"
- "9001:9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
networks:
- backend_network
celery:
build:
context: ./backend
dockerfile: Dockerfile.worker
command: celery -A app.worker worker --loglevel=info
volumes:
- ./backend:/app
environment:
- ENVIRONMENT=development
- DATABASE_URL=postgresql://postgres:postgres@db_master:5432/thesis_db
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- MINIO_URL=minio:9000
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin
- N8N_API_BASE_URL=https://n8n.hsueh.tw
- PDF_SPLITTER_URL=http://split_sentences:8000
depends_on:
- redis
- db_master
- minio
- split_sentences
- backend
networks:
- backend_network
split_sentences:
build:
context: ./split_sentences
dockerfile: Dockerfile
volumes:
- ./split_sentences:/app
- split_sentences_data:/app/upload_data
environment:
- MAX_WORKERS=8
- PYTHONUNBUFFERED=1
networks:
- backend_network
networks:
frontend_network:
driver: bridge
backend_network:
driver: bridge
volumes:
postgres_master_data:
postgres_slave_data:
redis_data:
minio_data:
split_sentences_data: