Skip to content
Snippets Groups Projects
Commit 9e510b38 authored by Hartung, Michael's avatar Hartung, Michael
Browse files

integration of celery to fetch nedrex db

parent 26d061cc
No related branches found
No related tags found
No related merge requests found
......@@ -18,10 +18,10 @@ check:test:
- python manage.py test
deploy:dev:
image: registry.blitzhub.io/docker
stage: deploy
only:
- development
image: registry.blitzhub.io/docker
stage: deploy
services:
- name: registry.blitzhub.io/docker:dind
alias: docker
......@@ -37,11 +37,11 @@ deploy:dev:
- check:lint
- check:test
deploy:prod:
image: registry.blitzhub.io/docker
stage: deploy
deploy:prod:
only:
- production
image: registry.blitzhub.io/docker
stage: deploy
when: manual
services:
- name: registry.blitzhub.io/docker:dind
......
......@@ -46,6 +46,23 @@ services:
networks:
- redis_net
celery:
restart: always
build: ./backend
command: celery -A core worker -l info
volumes:
- ./backend/:/usr/src/app/
depends_on:
- redis
celery-beat:
build: ./backend
command: celery -A core beat -l info
volumes:
- ./backend/:/usr/src/app/
depends_on:
- redis
networks:
db_net:
redis_net:
......
......@@ -12,6 +12,9 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
import os
# celery beat
from celery.schedules import crontab
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -169,3 +172,13 @@ CACHES = {
}
}
}
CELERY_BROKER_URL = "redis://redis:6379"
CELERY_RESULT_BACKEND = "redis://redis:6379"
CELERY_BEAT_SCHEDULE = {
"update_db": {
"task": "control.celery_tasks.task_update_db_from_nedrex",
"schedule": crontab(hour=12, minute=15, day_of_week='sun'),
}
}
......@@ -28,4 +28,5 @@ rq==1.3.0
six==1.15.0
sqlparse==0.3.1
urllib3==1.25.10
sqlalchemy==1.3.23
\ No newline at end of file
sqlalchemy==1.3.23
celery==5.2.6
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment