8 ms·
As a python dev who deploys a lot of software, I found this article to be wonderfully helpful and informative, and a good reflection of current best practices.
by djtriptych 15y ago
As a python dev who deploys a lot of software, I found this article to be wonderfully helpful and informative, and a good reflection of current best practices.
Summary of the deployment tools mentioned:
- Manage remote daemons with supervisord
http://supervisord.org/
- Manage python packages with pip (and use `pip freeze`)
http://pypi.python.org/pypi/pip
http://www.pip-installer.org/en/latest/requirements.html
- Manage production environments with virtualenv
http://www.virtualenv.org/
- Manage Configuration with puppet and/or chef
http://puppetlabs.com/
http://www.opscode.com/chef/
- Automate local and remote sys admin tasks with Fabric
http://fabfile.org
Other tips:
- Don't restrict yourself to old Python versions to appease your tools / libs.
- Strongly consider rolling your own DEB/RPMs for your Python application.
Author also touted:
- Celery for task management
http://celeryproject.org/
- Twisted for event-based python.
http://twistedmatrix.com/trac/
- nginx / gunicorn for your python web server stack
http://www.nginx.com/
http://gunicorn.org/
- Ixiaus 15y agoYes to all of this and I'll throw in my two cents on our web server setup which is nginx + uwsgi (which has served remarkably well).
- lifeisstillgood 15y ago+1 to uWSGI and nginx. Now wsgi is built into nginx distribution, and uwsgi is gaining areputation for rock solid performance it's a nobrainer.
- alexatkeplar 15y agoLikewise +1 to Nginx + uwsgi. In the various performance benchmarks* uwsgi beats gunicorn, and uwsgi comes bundled with Nginx now, so there's really no reason to bother with setting up gunicorn any more. * http://www.peterbe.com/plog/fcgi-vs-gunicorn-vs-uwsgi http://www.peterbe.com/plog/fcgi-vs-gunicorn-vs-uwsgi http://nichol.as/benchmark-of-python-web-servers http://nichol.as/benchmark-of-python-web-servers
- edanm 15y agouwsgi comes bundles with Nginx? First I've heard of that. Very interesting. Do you have any easy tutorials on getting Nginx + uwsgi set up?
- spahl 15y agoThe uwsgi upstream module has been bundled for a long time now. Here is the doc from the uwsgi site: http://projects.unbit.it/uwsgi/wiki/RunOnNginx http://projects.unbit.it/uwsgi/wiki/RunOnNginx
- dignan 15y agoCan you restart the uwsgi instance(s) without restarting nginx? That's a pretty significant benefit of gunicorn...
- joeshaw 15y agoYes, uwsgi instances run separately from nginx. The uwsgi nginx module simply speaks a binary protocol for reverse proxying rather than HTTP.
- mixmastamyk 15y agoI chose nginx and gevent after reading a blog post about py server performance. Anyone have any experience with these two?
- mdehaan 15y agoChef requires Ruby programming. Puppet doesn't, but the core is obviously Ruby, and you extend it using Ruby. You may possibly like my new project: http://ansible.github.com http://ansible.github.com The core is Python but you can write modules in any language.
- mixmastamyk 15y agoCool, I'm also investigating the python-based salt stack: http://saltstack.org/ http://saltstack.org/ for this purpose but it seems a bit heavy just starting out. Gonna try ansible next.
- emidln 15y agoCurrently deploying salt. Community is great, grains are easy to write, and the codebase is very clear. Can't recommend enough.
- davecap1 15y agoThere is also cuisine, which brings chef-like functionality to fabric. https://github.com/sebastien/cuisine https://github.com/sebastien/cuisine
- pconf 15y agoThanks for that! We gave up on chef when one of their version updates failed to work with a prior version, both of which were the OS package defaults. Chef silently failed, no error message, nothing in the docs, nothing even in the source code. Had to do a fair bit of searching to find out why. When open source projects like chef have nobody interested in even documenting much less testing backwards incompatibilities we move them to the bottom of our to-eval list. This also illustrates a problem in article's blind enthusiasm for the latest revisions and libraries i.e., it dismisses the headaches this causes end-users, who often don't have staff or budget to fix whatever breaks during an upgrade. That said we are at least talking about python, which has had better release QA and backwards compatibility than perl, ruby or, gasp, php.
- 15y ago
- dekkers 15y agoI use gevent instead of twisted for event-based python. Gevent is a lot nicer to work with and doesn't make your code less readable in the way twisted does with its callbacks and errbacks. It's also a lot easier to do unit testing with gevent.