Re:Starting a Django Project the Right Way
by arocks on Wednesday July 25, 2012 @07:18AM
(#4290342)
Interestingly most posts which recommend using Puppet/Chef depend on Fabric for deployment. Is a mutually exclusive or pure Puppet/Chef approach better in any way?
[ Parent
| on HN ]
Re:Starting a Django Project the Right Way
by yummyfajitas on Wednesday July 25, 2012 @07:40AM
(#4290388)
If you want to use fabric (or a shell script) to run puppet, go ahead. I'm just suggesting that you really want to use a deploy system with proper dependency management.
The issue I ran into with fabric is that I often got stuck in dependency hell. The following is fabric's simplest method of dependency management:
def install_foo():
install_foo_dependency()
...
Unfortunately, you don't want to do this every time you deploy because install_foo_dependency() might take a while to run. You can work around it by checking inside install_foo_dependency whether it's already there. In practice, you probably won't always do this. Puppet usually has recipes which already do this for you.So you typically have functions like:
def full_deploy():
install_foo_dependency()
install_foo_without_dependency()
In theory, you can do things right with fabric. In practice, you have to do a lot of work to replicate what puppet (together with assorted easy to find recipes) gives you out of the box.> I'm just suggesting that you really want to use a deploy system with proper dependency management.
Why not use pip(pip install -r reqs.txt)?
def install_deps():
local('pip install -r reqs.txt')
Or if you are talking system dependencies, use apt-get or yum or whatever comes with your system from within fabric.
Re:Starting a Django Project the Right Way
by yummyfajitas on Wednesday July 25, 2012 @08:43AM
(#4290606)
Often installing a dependency involves more code:
with in_tmp_dir():
run('wget http://someserver/project_bleeding_edge.tar.gz')
run('tar -xvzf project_bleeding_edge.tar.gz')
run('./configure; make;')
sudo('make install')
put('conf/server.conf', 'server.conf')
sudo('mv server.conf /etc/server.conf')
(I forget if in_tmp_dir is builtin, but if not it does exactly what it sounds like.)
Re:Starting a Django Project the Right Way
by mattdeboard on Wednesday July 25, 2012 @08:46AM
(#4290623)
As someone who has worked with a fairly involved fabric deployment & provisioning process, I'm forced to agree. Fabric is great for what it is, but you lose so much by not using chef.
Re:Starting a Django Project the Right Way
by herrwolfe on Wednesday July 25, 2012 @02:29PM
(#4292288)
Eric Holscher also has an excellent blog post, http://ericholscher.com/blog/2010/nov/8/building-django-app-... ,
describing how to deploy using both fabric and chef. There are certain instances where one tool works better than the other, and in that situation that tool is used.