Skip to content

Commit

Permalink
(BSR)[API] chore: local setup for celery
Browse files Browse the repository at this point in the history
  • Loading branch information
lgerard-pass committed Jan 30, 2025
1 parent 47c3c0a commit 704d970
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/start-celery-worker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

until psql $DATABASE_URL -c '\q'; do
echo >&2 -e "\033[0;33mPostgres is unavailable - sleeping"
sleep 1
done

celery -A pcapi.celery_tasks.celery_worker worker -Q mails

20 changes: 20 additions & 0 deletions docker-compose-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@ services:
stdin_open: true
tty: true

celery:
build:
context: ./api
target: api-flask
working_dir: /usr/src/app
container_name: pc-celery-worker
command: [ "./start-celery-worker.sh" ]
volumes:
- ./api:/usr/src/app
env_file:
- env_file
networks:
- db_nw
- web_nw
depends_on:
- postgres
- redis
ports:
- 10003:10003 # debugger port

redis:
image: scalingo/redis
container_name: pc-redis
Expand Down

0 comments on commit 704d970

Please sign in to comment.