-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
225 lines (215 loc) · 5.11 KB
/
docker-compose.yml
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
services:
# Web service with build configuration
web:
build:
context: .
dockerfile: Dockerfile
image: chesapeake-app:latest # Built image
command: >
sh -c "
./wait-for-it.sh postgres:5432 --
./wait-for-it.sh redis:6379 --
./wait-for-it.sh rabbitmq:5672 --
./docker-entrypoint.sh gunicorn cast.wsgi:application --bind 0.0.0.0:8000
"
ports:
- "8000:8000"
depends_on:
- postgres
- redis
- rabbitmq
restart: on-failure
env_file:
- variables.env
environment:
- SERVICE_TYPE=web
- SECURE_SSL_REDIRECT=${SECURE_SSL_REDIRECT:-False} # Override if needed
volumes:
- .:/app:delegated # Consider limiting if not necessary for all services
- shared_nsga3_output:/opt/opt4cast/output/nsga3/ # Shared Volume
networks:
- app-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health/"]
interval: 30s
timeout: 10s
retries: 5
# Alfred Retrieve Service
alfred_retrieve:
image: chesapeake-app:latest
command: ["/usr/local/bin/alfred", "retrieve"]
restart: always
env_file:
- variables.env
environment:
- SERVICE_TYPE=alfred_retrieve
depends_on:
- web
- redis
- rabbitmq
volumes:
- .:/app:delegated
- shared_nsga3_output:/opt/opt4cast/output/nsga3/ # Shared Volume
networks:
- app-network
# Alfred Send Service
alfred_send:
image: chesapeake-app:latest
command: ["/usr/local/bin/alfred", "send"]
restart: always
env_file:
- variables.env
environment:
- SERVICE_TYPE=alfred_send
depends_on:
- web
- redis
- rabbitmq
volumes:
- .:/app:delegated
- shared_nsga3_output:/opt/opt4cast/output/nsga3/ # Shared Volume
networks:
- app-network
# Celery Worker Service
celery:
image: chesapeake-app:latest
command: >
sh -c "
./wait-for-it.sh web:8000 --
celery -A cast worker --loglevel=info
"
depends_on:
- redis
- rabbitmq
- web
restart: on-failure
env_file:
- variables.env
environment:
- SERVICE_TYPE=celery
volumes:
- .:/app:delegated
- shared_nsga3_output:/opt/opt4cast/output/nsga3/ # Shared Volume
networks:
- app-network
healthcheck:
test: ["CMD", "celery", "-A", "cast", "status"]
interval: 30s
timeout: 10s
retries: 5
# Celery Beat Service
celery-beat:
image: chesapeake-app:latest
command: >
sh -c "
./wait-for-it.sh web:8000 --
celery -A cast beat --loglevel=info
"
depends_on:
- redis
- rabbitmq
- web
restart: on-failure
env_file:
- variables.env
environment:
- SERVICE_TYPE=celery-beat
volumes:
- .:/app:delegated
- shared_nsga3_output:/opt/opt4cast/output/nsga3/ # Shared Volume
networks:
- app-network
healthcheck:
test: ["CMD", "celery", "-A", "cast", "status"]
interval: 30s
timeout: 10s
retries: 5
# Flower Service for monitoring Celery
flower:
image: chesapeake-app:latest
command: >
sh -c "
./wait-for-it.sh web:8000 --
celery -A cast flower --loglevel=info
"
depends_on:
- rabbitmq
- web
- redis
- celery
restart: on-failure
env_file:
- variables.env
environment:
- SERVICE_TYPE=flower
- DEBUG=1
- CELERY_BROKER=redis://redis:6379/1
- CELERY_BACKEND=redis://redis:6379/1
#ports:
# - "5555:5555"
volumes:
- .:/app:delegated
- shared_nsga3_output:/opt/opt4cast/output/nsga3/ # Shared Volume
networks:
- app-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5555"]
interval: 30s
timeout: 10s
retries: 5
# Postgres Database
postgres:
image: postgres:14.5
restart: always
volumes:
- mypostgresdata:/var/lib/postgresql/data
env_file:
- variables.env
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 10s
retries: 5
# RabbitMQ Message Broker
rabbitmq:
image: rabbitmq:3-management
#ports:
# - "15675:15672" # Management UI port
restart: always
env_file:
- variables.env
volumes:
- myrabbitmqdata:/var/lib/rabbitmq
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "rabbitmqctl status"]
interval: 30s
timeout: 10s
retries: 5
# Redis In-Memory Data Store
redis:
image: redis:7.0-alpine
restart: always
env_file:
- variables.env
volumes:
- myredisdata:/data
networks:
- app-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 5
volumes:
mypostgresdata:
myredisdata:
myrabbitmqdata:
shared_nsga3_output: # Define the shared named volume
driver: local # Optional: Specify the driver if needed
networks:
app-network:
driver: bridge