Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Option to enable live reload #1

Closed
Ancient123 opened this issue Jan 30, 2019 · 6 comments
Closed

Feature Request: Option to enable live reload #1

Ancient123 opened this issue Jan 30, 2019 · 6 comments

Comments

@Ancient123
Copy link

gunicorn has the --reload option ( http://docs.gunicorn.org/en/19.0/settings.html#reload ) which helps with developing in the docker environment without constant rebuilds.

I tested it by adding --reload to the startup script manually but it would probably make sense to use a environment variable flag to enable/disable this.

@tiangolo
Copy link
Owner

tiangolo commented Mar 7, 2019

Yep, there's a new integrated script in the image /start-reload.sh, it starts Uvicorn alone with live reload, which is optimal for development.

Check the new docs here: https://github.com/tiangolo/uvicorn-gunicorn-docker#development-live-reload

Let me know if it works for you.

@chbndrhnns
Copy link

Should we maybe also use the reload_dirs option here to reduce CPU load?

@tiangolo
Copy link
Owner

I don't think that's needed @chbndrhnns . This is only for quick development iterations, but for production that shouldn't be used at all.

@chbndrhnns
Copy link

chbndrhnns commented Apr 13, 2020

I am aware that reload on change is not for production. However, when I develop on my laptop on battery, I noticed a huge difference when using ---reload-dir compared to --reload.

I usually want a reload only on changes in my app directory but with --reload, uvicorn also looks in .venv/, for example. This leads to a high CPU load which matters to me when developing on battery.

This is why I prefer --reload-dir

@tiangolo
Copy link
Owner

Get it, I think you could add it as a custom script for your use case @chbndrhnns , for example, you could add your own /app/start-reload.sh based on the one here, and run that one with all your customizations.

But I wouldn't add it as a default as other people will probably have different workflows.


@Ancient123 if your question was solved, then you can close this issue 🚀

@github-actions
Copy link

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.

br3ndonland added a commit to whythawk/full-stack-fastapi-postgresql that referenced this issue Jul 20, 2021
whythawk-full-stack-fastapi-postgresql#1
tiangolo/uvicorn-gunicorn-docker#1
tiangolo/uvicorn-gunicorn-docker#6

PR #1 updated the backend Docker image from
https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker
to https://github.com/br3ndonland/inboard (see https://inboard.bws.bio).
The previous Docker image had a start-reload.sh script, which started
Uvicorn with reloading. With inboard, there's no need for a separate
script. The same effect can be achieved with environment variables
(`PROCESS_MANAGER=uvicorn`, `WITH_RELOAD=true`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants