Skip to content

Commit

Permalink
Fix celery container
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Aug 12, 2024
1 parent a668e10 commit da54be3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ services:
context: ./rapidpro/
args:
- RAPIDPRO_TAG=v9.2.5
command: ["webapp"]
depends_on:
postgres:
condition: service_healthy
Expand All @@ -82,17 +83,18 @@ services:
- 8000:8000
healthcheck:
test: curl -s http://localhost:8000 >/dev/null || exit 1
interval: 20s
interval: 15s
timeout: 5s
retries: 5
start_period: 20s

celery:
image: nyaruka/rapidpro:stable
command: ["/venv/bin/celery", "--beat", "--app=temba", "worker", "--loglevel=INFO", "--queues=celery"]
build:
context: ./rapidpro/
args:
- RAPIDPRO_TAG=v9.2.5
command: ["celery"]
depends_on:
rapidpro:
condition: service_healthy
Expand Down
3 changes: 2 additions & 1 deletion rapidpro/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ENV RAPIDPRO_TAG=${RAPIDPRO_TAG:-main}
RUN apt-get update && apt-get install -y libgdal-dev ffmpeg nodejs npm
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="/root/.local/bin:$PATH"
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
RUN npm install -g n && n 20
RUN npm install -g yarn less

Expand All @@ -18,4 +19,4 @@ RUN ln -s /rapidpro/temba/settings.py.dev /rapidpro/temba/settings.py
EXPOSE 8000
COPY entrypoint.sh /rapidpro/
RUN chmod +x /rapidpro/entrypoint.sh
ENTRYPOINT ["/rapidpro/entrypoint.sh"]
ENTRYPOINT ["/rapidpro/entrypoint.sh"]
12 changes: 10 additions & 2 deletions rapidpro/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@

export REMOTE_CONTAINERS=true

poetry run python3 manage.py migrate
poetry run python3 manage.py runserver 0.0.0.0:8000
ACTION=${1:-webapp}

if [ "$ACTION" = "webapp" ]; then
echo "Running RapidPro webapp..."
poetry run python3 manage.py migrate
poetry run python3 manage.py runserver 0.0.0.0:8000
elif [ "$ACTION" = "celery" ]; then
echo "Running RapidPro celery worker..."
.venv/bin/celery -A temba worker -E -B --loglevel=INFO
fi

0 comments on commit da54be3

Please sign in to comment.