This is an exmaple project to show how zero downtime deployments can be done using Django, uWSGI, and nginx using the uWSGI Zerg pool functionality.
This is based off https://github.com/wunki/django-salted. For more information, please check that project's readme.
To use:
- Setup the vm
- Install all the requirements for django-salted as listed here: https://github.com/wunki/django-salted
- clone this repo to your local box
- Issue a
vagrant up, wait a while - run
curl localhost:8080to see if everything is working as it should. It should return "This is version 1!" - Start the load test
- ssh into the box with
vagrant ssh - cd to
/vagrant - run 'curl localhost' to see if everything is working. It should return 'This is version 1!'
- run
/vagrant/load-test.sh - Deploy Version 2
- open a second ssh session in another terminal tab via
vagrant ssh - run
cd /vagrant && sudo ./deploy.sh v2 - Watch it deploy, you can watch the load test tab to see that all the requests are happily processed.
- When deployment is done, do a
curl localhostto confirm that you are now running Version 2.