2021 update
Today I’m using Ansible for this and other devops tasks. Along the way I’ve experimented with Chef, Puppet, Saltstack and Docker images, but I’ve found that for me, as a solo developer working in smaller projects, a lightweight tool like Ansible is a great fit.
Original question (from 2011)
I’m starting out as an independent web developer and I recently scared away a client by giving a quote for a rather simple
site that was quite a bit higher than they expected. It was basically
brochureware that they could have done themselves in a hosted solution
like WordPress.com or Google sites. Except for one critical feature, that
made me think that Django would be a nice fit, and that some proper web
development could be motivated.
When looking at the tasks I’ve listed in my rough estimate it’s pretty
obvious to me that most of the hours in there are stuff that is not
specific to this clients website. This got me thinking that I should
have a script to automate the process of setting up and deploying new
Django projects.
A couple of things would still have to be done manually like:
-
Set up a new VPS (or in most cases just go with virtualhosts on an existing VPS).
-
Edit DNS settings to point clientsdomain.com and test.clientsdomain.com
to the new VPS. -
Set up SSH-keys
-
Edit a config file.
The script would then do stuff like:
-
Install some required packages on the new VPS
-
Install default a iptables firewall on the new VPS
-
Add nginx/apache config for clientsdomain.com and test.clientsdomain.com
-
Set up new up databases for production and test on the VPS and for development on my local machine.
-
Create a new Django project and put it on Bitbucket.
-
Set up settings.py and local_settings.py for production, test and development
-
Set up offsite backuproutines for production database and uploaded files directory.
-
Enable some default apps: flatpages, admin
-
Add some boilerplate templates, a couple of boilerplate flatpages and a navbar.
-
Add the 960.gs CSS-framework
-
Add jQuery
-
Set up djapian or Haystack (including cron job for automatic updating) for search.
-
Set up a new Google analytics profile.
-
Include possibility to replicate databases between production, test and development
-
Set up Pingdom monitoring
I’ve used Rake and Fabric for somewhat similar (but less ambitious) stuff in the past and I’m thinking that Fabric might be a pretty good fit for this task as well, but I’d still like your input. Are there other tools I should look into? I’ve heard good
things about Puppet but just looking at their site (it contains the word Enterprise ) gives me the feeling that it might be overkill for a one man operation.
We currently do it with fabric+buildout. Others say Chef or Puppet is better suited (and it probably is, if you want to do server level stuff, not only app-level).
Also for Django there’s a few dedicated hosters which take a lot of load off you, I especially like http://ep.io which we use to power our fully automated deployements for the demos of the django-cms, so maybe you should look into those hosting providers too rather than limiting yourself to VPSs which are more overhead for you.