How to structure my python rest api (FastAPI) project?
Different api endpoints submit tasks to different celery workers. I want each celery worker to be build as a separate image and all builds are managed by docker-compose.
I tried separating api directory from celery worker directories and put a Dockerfile in each, but I ran into the problem when the task was submitted to the worker from the unauthorized task. Maybe there is a way to fix it, but it would seem to me like a workaround.
Update
my_app/
docker-compose.yml
fastapi_app/
api/
...
app.py
Dockerfile
worker_app1/
core_app_code/
...
Dockerfile
worker_app2/
core_app_code/
...
Dockerfile
Main question is, where the tasks should be defined for each worker, so that that fastapi_app
could submit them.