by oyving · 17y ago · 0 comments
Why not utilize the host packaging system for deploying your code and applications?
You may end up dealing with multiple operating systems or package tools, for example, at which point Python's ubiquitous setup.py (and tools which work with it on every OS) look very attractive.
You may end up needing to install App A with Version 2.0 of Dependency B, and App C with Version 3.5, on the same server, at which point virtualenv starts looking really attractive.
These sorts of situations are extremely common in the real world, and "use the OS package tool" isn't a one-size-fits-all solution for them.
It's not even hard to leverage the power of apt (the most advanced of the bunch) for your own deployments.
In essence you setup a local mirror and add that to the sources.list of all your hosts. Then you learn how to roll your own debs and push them to the mirror. The actual deployment happens via apt-get - which can be triggered by cron, a shell-script, puppet, a sweaty admin at 4am, or whatever fits your bill.
Working with the system this way instead of along with it (or even against it) has various advantages. Most importantly you get proper dependency management. Need to roll back to app version 2 from version 3, whereas version 2 depends on an older version of foo? No-brainer, apt takes care of that for you, both ways, also in much more complicated cases. Need a package or package version that's not in the official repos? No problem, roll your own and make your application package depend on that.
With a bit of elbow grease you can also have it mangle your database and other auxiliary infrastructure appropiately, within the respective pre-/post-install scripts.
Fabric and capistrano are just expressions of the old "if you don't understand you're doomed to reinvent, poorly" meme.
If I have 5 debian machines that need to be updated, I should be able to do that with a single command and it should happen in parallel. The same applies if I have 5 debian machines and 5 red hat machines (etc...). I'm advocating a tool that is aware of the existing system specific package managers rather than a replacement of them.
Ofcourse it does. What makes you think it doesn't?
If I have 5 debian machines that need to be updated, I should be able to do that with a single command and it should happen in parallel.
reprepro -Vb . stage1 myapp_2.0-1.dsc
That drops a new pkg onto the mirror where the staging hosts pick it up within one minute, from cron. I could use the "live" distro instead of "stage1" to roll it out to production. We use sections if we want to limit the push to individual groups of hosts.
The same applies if I have 5 debian machines and 5 red hat machines (etc...)
If you mix linux distributions in a production environment then you have bigger problems to resolve first.
I'm advocating a tool that is aware of the existing system specific package managers rather than a replacement of them.
Those who don't understand are doomed to reinvent, poorly...
Sorry, but WTF? This made my toe-nails curl up.
You can't get a much easier setup than "already installed". You can't get much more portable than bash. And you can't get much less dependencies than zero.
Seriously, sit down and write the equivalent shell-script to whatever fabric/capistrano recipe you're currently using. I'm quite sure you'll be a bit baffled about why you bothered with them in first place.
To me it seems like Fabric/Capistrano were invented by people, for people, who are afraid to learn the bash syntax. This is unjustified, bash syntax is ugly but trivial.
While it might be a safe bet these days to assume that bash exists (Though there are no guarantees), you can't really do anything with the shell alone - You have to call external commands, and they vary from platform to platform. FreeBSD has all sorts of annoying small variations of standard gnu utilities (or was it the other way around). And Windows doesn't even have a standard shell.
> To me it seems like Fabric/Capistrano were invented by people, for people, who are afraid to learn the bash syntax.
To me it seems like you never actually used shell script for anything serious.
I was with you up to this point, bash is not portable, and it is a hideous shell.
Any sane hacker writes all their scripts that are meant to be portable in standard bourne shell. Bourne is to bash as C is to C++. And people that put #!/bin/bash at the top of scripts that can be run by any bourne shell will burn in gnu/hell for the rest of eternity.
Together with distribution systems like apt I can also significantly ease deployment.
I can see that executing some commands over a set of hosts at the same time could be useful, but doesn't sound like a killer feature for me.
As for deploying from staging to production servers, it sounds more tidy to build proper packages to deploy in staging and test before deploying the same packages to production.
for h in $hosts; do ssh $h "my command"; done
As for deploying from staging to production servers, it sounds more tidy to build proper packages to deploy in staging and test before deploying the same packages to production.
Amen.