diff --git a/compose_app.yml b/compose_app.yml index aa17a83..e274a4b 100644 --- a/compose_app.yml +++ b/compose_app.yml @@ -62,8 +62,8 @@ services: command: /bin/bash -c 'poetry run python /usr/src/fastfood/manage.py --run-docker-server' - celery: - container_name: celery + celery_worker: + container_name: celeryworker build: context: . @@ -80,7 +80,28 @@ services: volumes: - .:/usr/src/fastfood - command: /bin/bash -c 'poetry run python /usr/src/fastfood/manage.py --run-selery' + command: ["celery", "-A", "bg_tasks.bg_task:celery_app", "worker", "--loglevel=info", "--concurrency", "1", "-P", "solo"] + + celery_beat: + container_name: celerybeat + + build: + context: . + + env_file: + - .env + + depends_on: + - rabbitmq + - db + - app + - redis + + volumes: + - .:/usr/src/fastfood + + command: ["celery", "-A", "bg_tasks.bg_task:celery_app", "beat", "--loglevel=info"] + rabbitmq: container_name: rabbit diff --git a/manage.py b/manage.py index 1c275c7..b502fd2 100644 --- a/manage.py +++ b/manage.py @@ -42,10 +42,6 @@ async def recreate() -> None: if __name__ == '__main__': - if '--run-celery' in sys.argv: - celery_worker_process.start() - celery_beat_process.start() - if '--run-docker-server' in sys.argv: loop.run_until_complete(recreate()) loop.run_until_complete(run_app())