From 5f096098eec51851211701a0f300d5562ff93a61 Mon Sep 17 00:00:00 2001 From: RyanAquino Date: Mon, 14 Feb 2022 14:40:57 +0800 Subject: [PATCH] ZDL-98: Create docker-compose record for rq workers --- docker-compose.yml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 320b7f9..240b5e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,22 @@ version: '3.8' # docker-compose up && docker-compose rm -fsv # run and remove on exit +x-common-variables: &common-variables + DB_ENGINE: django.db.backends.postgresql + DB_NAME: zadala + DB_USER: postgres + DB_PASS: 1 + DB_HOST: db + DB_PORT: 5432 + EMAIL_HOST_USER: + EMAIL_HOST_PASSWORD: + EMAIL_HOST_PORT: 587 + EMAIL_HOST_PROVIDER: smtp.gmail.com + SECRET_KEY: my-secret + GOOGLE_CLIENT_ID: + GOOGLE_CLIENT_SECRET: + REDISTOGO_URL: redis://redis:6379/0 + services: db: image: postgres @@ -45,15 +61,17 @@ services: - "8000:8000" expose: - 8000 - environment: - - DB_NAME=zadala - - DB_USER=postgres - - DB_PASS=1 - - DB_HOST=db - - DB_PORT=5432 - - ENV=prod - - SECRET_KEY=my-secret + environment: *common-variables command: sh -c "python manage.py migrate && python manage.py collectstatic --noinput && python manage.py runserver 0.0.0.0:8000" depends_on: db: condition: service_healthy + + zadala-rq-worker: + container_name: zadala-rq-worker + restart: always + build: . + environment: *common-variables + command: sh -c "python manage.py rqworker high default low" + depends_on: + - redis