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: Jeff Forcier
Subject: Re: [Fab-user] Deploying to different path & db on same server
Date: Tue, 12 Jan 2010 11:14:22 -0500

Hi Nicolas,

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 :)

Best,
Jeff

On Tue, Jan 12, 2010 at 10:54 AM, Nicolas Steinmetz
<address@hidden> wrote:
> Hello,
>
> It's quite a long time I used Fabric and as new needs raised in my firm, I'm
> considering playing back with fabric.
>
> My concern is that I have a website which use 6 web servers and 1 database.
> Now that our service concerns not only Europe but also Asia. Therefore, as
> an impact, I have a new database and a new file system structure :
> /app/europe/ & /app/asia
>
> As I will have to deploy the same package on both side but at a different
> time due to time zone, I would like to do stg like :
>
> fab deploy europe db1 db2 db3
> fab deploy asie db4
>
> This way :
> - files will be deployed to /app/{geo_area}/
> - db script will be run against specified db
>
> Is it feasible or do I have to build 2 packages; one for each FS & related
> DB ?
>
> Cheers,
> Nicolas
> --
> Nicolas Steinmetz
> http://www.steinmetz.fr - http://nicolas.steinmetz.fr/
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>
>



-- 
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org




reply via email to

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