@@ -20,11 +20,16 @@ services:
20
20
extra_hosts :
21
21
- " host.docker.internal:host-gateway"
22
22
depends_on :
23
- - postgres
24
- - redis
25
- - minio-init
26
- - rabbitmq
27
- - celeryworker # required to subscribe the worker to the pipelines in the db
23
+ postgres :
24
+ condition : service_started
25
+ redis :
26
+ condition : service_started
27
+ minio-init :
28
+ condition : service_started
29
+ rabbitmq :
30
+ condition : service_started
31
+ celeryworker : # required to subscribe the worker to the pipelines in the db
32
+ condition : service_healthy
28
33
volumes :
29
34
- .:/app:z
30
35
env_file :
@@ -99,11 +104,22 @@ services:
99
104
# Also make sure to install debugpy in your requirements/local.txt
100
105
ports :
101
106
- " 5678:5678"
102
- command : python -m debugpy --listen 0.0.0.0:5678 -m celery -A config.celery_app worker --queues=antenna -n antenna_celeryworker@%h -l INFO
103
- volumes :
104
- - ./compose/local/django/celery/worker/start:/start-celeryworker
107
+ # start the worker with antenna_celeryworker to ensure it's discoverable by ami.ml.signals.get_worker_name
108
+ command :
109
+ - sh
110
+ - -c
111
+ - |
112
+ python manage.py migrate &&
113
+ python -m debugpy --listen 0.0.0.0:5678 -m celery -A config.celery_app worker --queues=antenna -n antenna_celeryworker@%h -l INFO
105
114
depends_on :
106
115
- rabbitmq
116
+ healthcheck :
117
+ # make sure DATABASE_URL is inside the ./.envs/.local/.postgres
118
+ test : ["CMD-SHELL", "celery -A config.celery_app inspect ping -d antenna_celeryworker@$(hostname) | grep -q pong"]
119
+ interval : 10s
120
+ timeout : 50s
121
+ retries : 5
122
+ start_period : 10s
107
123
108
124
celerybeat :
109
125
<< : *django
@@ -126,8 +142,8 @@ services:
126
142
- " 5672:5672"
127
143
- " 15672:15672"
128
144
environment :
129
- RABBITMQ_DEFAULT_USER : user
130
- RABBITMQ_DEFAULT_PASS : password
145
+ RABBITMQ_DEFAULT_USER : rabbituser
146
+ RABBITMQ_DEFAULT_PASS : rabbitpass
131
147
networks :
132
148
- antenna_network
133
149
@@ -162,8 +178,10 @@ services:
162
178
env_file :
163
179
- ./.envs/.local/.django
164
180
depends_on :
165
- - minio
166
- - minio-proxy
181
+ minio :
182
+ condition : service_healthy
183
+ minio-proxy :
184
+ condition : service_started
167
185
volumes :
168
186
- ./compose/local/minio/init.sh:/etc/minio/init.sh
169
187
entrypoint : /etc/minio/init.sh
@@ -187,7 +205,7 @@ services:
187
205
context : ./processing_services/minimal
188
206
command : ./celery_worker/start_celery.sh
189
207
environment :
190
- - CELERY_BROKER_URL=amqp://user:password @rabbitmq:5672//
208
+ - CELERY_BROKER_URL=amqp://rabbituser:rabbitpass @rabbitmq:5672//
191
209
extra_hosts :
192
210
- minio:host-gateway
193
211
networks :
0 commit comments