I recently started using Fabric to simplify my deployment process.
Fabric is a Python (2.5 or higher) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.
I quite like Fabric – I’m not 100% sold, but it’s easy to get started with and it won’t be long until you can write complex scripts.
Being able to deploy a complex app with a single command is great. I do not miss long checklists and having to run through step after step in a hurry.
Pretty easy isn’t it?
Why Fabric? To be honest – why not. I know a little bit of Python, so why not learn a bit more? I like the glueyness, the fact that it (mostly) lets you get on with things and doesn’t force you to work in a particular way.
I had a devil of a time getting it up and running though on my Mac running 10.6.8 (Snow Leopard).
is a package manager for OSX and alternative to MacPorts. Install Fabric and Python via Homebrew to (hopefully) make your life a bit easier…
Open a terminal. Run the commands as your user, not
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Install Homebrew and then check the install.
brew doctor will identify any problems with your install. Any problems are displayed. Work through any issues it flags up one by one. In my case I ended up having to remove MacPorts and had to reinstall Xcode.
MacPorts is another package manager, but apparently it often doesn’t play with Homebrew.
Follow the instructions http://guide.macports.org/chunked/installing.macports.uninstalling.html
sudo port -fp uninstall installed sudo rm -rf \ /opt/local \ /Applications/DarwinPorts \ /Applications/MacPorts \ /Library/LaunchDaemons/org.macports.* \ /Library/Receipts/DarwinPorts*.pkg \ /Library/Receipts/MacPorts*.pkg \ /Library/StartupItems/DarwinPortsStartup \ /Library/Tcl/darwinports1.0 \ /Library/Tcl/macports1.0 \ ~/.macports
Xcode is Apple’s Integrated Development Environment (IDE) containing tools for developing software for OS X and iOS.
Based on issues listed by
brew doctor I removed Xcode and the re-installed it.
sudo /Developer/Library/uninstall-devtools --mode=all
Make sure you have your Apple ID to hand if you don’t have the .dmg and need to download it from Apple.
Next I installed Git using Homebrew if you do not already have it (I use Mercurial day to day, so I didn’t)
brew install git brew upgrade git
brew install python
Update your paths to use the version of Python that you’ve just installed.
sudo nano /etc/paths nano ~/.bashrc
brew install fabric
Phew! Everything should be working now… time to write a fabfile.py