fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] Deploying different things to different computers


From: Heikki Toivonen
Subject: [Fab-user] Deploying different things to different computers
Date: Wed, 13 Aug 2008 13:10:56 -0700
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

I started looking at Fabric to help me deploy an application that runs
on a group of different computers, with different operating systems all
needing different software installed. There are several environments
where this application needs to be installed, and there are of course
updates that need to be rolled out into all those environments, so an
automated solution would be needed. (An example environment: build
system on ubuntu, test system on winxp running cygwin, svn server on
redhat.)

It looks like Fabric is really geared towards deploying the same thing
on multiple computers. I could of course work around this by creating
separate fabfiles in separate directories for each of the subsystems
that I need to deploy. But are there better ways?

I guess what I'd really like to have is to be able to write a fabfile
for each of the subsystems, then one driver fabfile that loads all of
the subsystem fabfiles and deploy everything with a single command.

A related problem I have is that when I need to deploy this application
in a different environment, the account names, login names, machine
names, directory structures etc. may change and I would not like to
create different fabfiles for different environments since the logic
does not change. I was first hoping I could pass a config file option on
command line, but that does not seem to be possible. A workaround is to
use an environment variable to pass the config file, although to make
that work I need to add quite a bit of boilerplate code to each fabfile.
I could callfab like this:

DEPLOYMENT_CONFIG=staging.ini fab deploy

And then in the fabfile I would have code like this:

FAB_OPTS ='DEPLOYMENT_CONFIG'

try:
    fab_opts = os.environ[FAB_OPTS]
except KeyError:
    sys.exit('%s needs to be set to point to deployment config file' %
FAB_OPTS)

try:
    config = ConfigObj(fab_opts, file_error=True)
except IOError:
    sys.exit('%s does not point to valid config file' % FAB_OPTS)

user = config['main']['user']
hosts = config['main']['hosts']
installdir = config['main']['installdir']
...

Are there better ways to pass configuration options?

-- 
  Heikki Toivonen - http://heikkitoivonen.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]