- Gunicorn-Manager is a simple web interface for managing gunicorn processes.
- This is a simple PSUTIL and SIGNAL based Streamlit app which can be used to manage gunicorn processes and it's workers.
- While I was going through the gunicorn documentation, I found that there is no way to manage gunicorn processes and it's workers.
- Deploying gunicorn with systemd is not a good idea for me everytime I need to use terminal to restart for any changes. So I decided to write a simple web interface for managing gunicorn processes.
- Also CI/CD in gunicorn based processes is hard enough since I couldn't find much documentation or ways to do it. So I decided to write a simple web interface for managing gunicorn processes which you can also use to deploy your application in production with 0 downtime.
$ python3 gunicorn-manager.py
$ pip3 install streamlit requests pygit2
- List all gunicorn processes and it's workers.
- Restart gunicorn processes and it's workers.
- Stop gunicorn processes and it's workers.
- Start gunicorn processes and it's workers.
- Shows memory usage of gunicorn processes and it's workers.
- Increase/Decrease number of workers for gunicorn processes.
- 0 Downtime and CI/CD friendly for test as well as production environment.
- Also connect your github/gitlab repository to the application and use it to checkout any branch and deploy it in production with 0 downtime.
Gunicorn can restart it's workers (process), when number of workers > 1 and running worker is killed with signal TERM By using signal TERM, the worker will be gracefully shutdown and it will not accept any new requests but only shutdown when it's current request is completed, making sure that there is no downtime for the application.
- So basically just pull your updated code from git branch
- Turn on gunicorn manager code on browser
- Just click on restart button for any gunicorn worker
- It will take some time according to your code/application bootup time
- The new worker will be up and running with new code
- Keep doing this for all gunicorn workers until all workers are up and running with new code