I have a Django project which I'm using Docker and plan to deploy to AWS Elastic Beanstalk. Based on these requirements, I need to run a manage.py command (namely 'process_tasks' from django-background-tasks) without human intervention.
If my understanding is correct, 'process_tasks' must be run otherwise the tasks will not be executed at the scheduled time.
I came up with the following solution to add in my docker-compose.yml. The problem is I call my background task in 'urls' on server start and somehow this solution results in adding the task to the db twice. My objective is to run a background task everyday at a certain time. Is there a simpler solution I'm missing?
web:
build: .
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
tasks:
build: .
command: python3 manage.py process_tasks
volumes:
- .:/code
depends_on:
- web
- db