I am running two services nginx and fastapi with gunicorn as server and uvicorn worker class as workers managed by gunicorn
ISSUE:
fastapi service is unable to reload changes on Hot Reload --reload
I have made sure that.
- Volume is set as
- .:/root/nlpengine - I have also checked using bash the changes within docker are visible
- using uvicorn as server reload works.
cmd: uvicorn --reload ...
docker-compose.yaml
nlpengine:
build:
context: ./
dockerfile: Dockerfile
args:
options: --reload
container_name: nlpengine
working_dir: /root/nlpengine
command: gunicorn 'app.api:app' --bind 0.0.0.0:8000 --timeout 120 -k uvicorn.workers.UvicornWorker --workers 2 --threads=2 --worker-connections=100 --reload --reload-engine 'poll' --chdir /root/nlpengine
volumes:
- .:/root/nlpengine
networks:
my-network:
aliases:
- nlpengine-app
also getting this log which affirms the changes are visible inside the docker
nlpengine | [2022-09-18 15:24:17 +0000] [9] [INFO] Worker reloading: /root/nlpengine/app/api.py modified
I am going to create an issue at gunicorn github repo as well. Meanwhile Please advise if anyone has experienced this issue before.
My first thoughts are that this might be due to gunicorn incompatibility with fastapi due to A/WSGI standards