fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Deploying to different path & db on same server


From: Nicolas Steinmetz
Subject: Re: [Fab-user] Deploying to different path & db on same server
Date: Wed, 13 Jan 2010 00:14:21 +0100

Hi,

2010/1/12 Jeff Forcier <address@hidden>

 
In the lates stable Fab release, you can easily paramaterize your
tasks with task arguments; see:

   http://docs.fabfile.org/0.9.0/usage/fab.html#per-task-arguments

So you could pretty easily write a single deploy task that goes
something like this (paraphrasing for the most part, the emphasis is
on the paramaterization):

   def deploy(region, databases):
       databases = databases.split(';')
       put('my files', '/app/%s' % region)
       for db in databases:
           run('psql -U user %s < /path/to/script.sql' % db)

Fully explicit invocation would look like this:

   $ fab deploy:region=europe,databases="db1;db2;db3"

Or you can just use positional args and do this:

   $ fab deploy:europe,"db1;db2;db3"

Either one would result in calls such as:

   put('my files', '/app/europe')
   run('psql -U user db1 < /path/to/script/sql')
   run('psql -U user db2 < /path/to/script/sql')
   run('psql -U user db3 < /path/to/script/sql')

Hope that helps; let us know if there are additional concerns or if
I've missed your point :)

It *really* helps - I can now dive more into fabric to satisfy my needs :-)

You got the point (at this stage at least, evil is always in details) ;-)

So you may hear from me soon :-)))

Thanks again,
Nicolas

reply via email to

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