views:

367

answers:

3

I'm starting a new webapp project in Python to get into the Agile mind-set and I'd like to do things "properly" with regards to deployment. However, I'm finding the whole virtualenv/fabric/zc.buildout/etc stuff a little confusing - I'm used to just FTP'ing PHP files to a server and pointing a webserver at it.

After deployment the server set-up would look something like:
Nginx --proxy-to--> WSGI Webserver (Spawning) --> WSGI Middleware --> WSGI App (probably MNML or similar)
with the python webserver being managed by supervisord.

What sort of deployment set-up/packages/apps should I be looking into? And is there a specific directory structure I need to stick to with my app to ease deployment?

+3  A: 

Your deployment story depends on your app. Are you using Django? Then the Apache + mod_wsgi deployment docs make for a good starting point. Then you can google around for more detail, such as this 2-part series using pip, virtualenv, git, and fabric.

Really, fabric, virtualenv, and all those other tools are designed to make it easier to maintain and automate your deployment. Initially, the steps from the documentation are probably enough. After you get a feel for how things work, you can revisit to improve your process.

Hank Gay
+2  A: 

I've heard good things about Fabric:

Fabric is a Python library and command-line tool designed to streamline deploying applications or performing system administration tasks via the SSH protocol. It provides tools for running arbitrary shell commands (either as a normal login user, or via sudo), uploading and downloading files, and so forth.

Dominic Rodger
+3  A: 

You already mentioned buildout, and it's all you need. Google for example buildouts for the different parts. Takes a while to set it up the first time, but then you can reuse the setup between different projects too.

Let supervisord start everything, not just the python server. Then start supervisord at reboot either fron cron or init.d.

Lennart Regebro
I'm planning on having supervisord manage all the python-related stuff and then have monit monitor supervisord, nginx, DB, etc.
digitala
Well, that's obviously up to you, but aren't these doing pretty much the same thing? Isn't one of the enough? (I don't know monit very well, I must say).
Lennart Regebro
Sort of, yes. The main problem is if supervisord goes down for any reason it takes everything it is running with it, and I'm pretty sure it can't monitor and restart itself. So, having a monit keeping an eye on it makes sense.
digitala