fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Revert deployments


From: Jeff Forcier
Subject: Re: [Fab-user] Revert deployments
Date: Mon, 19 Jan 2009 13:47:11 -0500

Hi Miguel,

Fabric is only a tool for you to use -- it doesn't know anything about
your application or how it works. All it really does is allow you to
"script" shell commands and file uploads using Python.

A good rule of thumb for writing Fabric scripts/recipes is to figure
out how you would accomplish a given task by hand (i.e. by SSHing into
the server and doing things there). Once you can do something by hand
and know how it's done, you can then turn that knowledge into a series
of Fabric run() or sudo() calls.

So, in order to detect a failed deployment, you will have to figure
out how to define what failure means in your situation, and how to
detect that.


For example -- and this is only one of many possible examples -- let's
say your Java app writes logs to the file system. You could write a
deploy script that does something like this pseudocode:

- do normal deploy
- read in last 100 lines of error log file
- identify lines which are within a few minutes of the current time
- search those lines for specific error strings or prefixes (such as
"ERROR:" or "CRITICAL:)
- If the errors are found, take steps to revert your deploy

Obviously, you can package up those into their own subroutines, such
as deploy(), errors(), and rollback(), and then your deploy script can
be as simple as:

def perform_deploy():
    deploy()
    if errors():
        rollback()


But, again, this is all up to you: Fabric can't do your problem
solving for you -- it just makes it possible to implement the
solution.

Hope that helps somewhat!

Best,
Jeff

On Mon, Jan 19, 2009 at 1:03 PM, Miguel A. Lamy <address@hidden> wrote:
> Hi all,
>
> I am evaluating Fabric and a I'm bit lost sorry... I think I'm putting dumb 
> question.
>
> I want to deploy Java Web application into several servers. In the past I 
> used some shell scripts that stoped
> myservers, rsynced my app to the servers, backuped the databases (Mysql, 
> SqlServer and Oracle) and started
> the application server (tipical Jboss and Oracle). I use ssh in all servers 
> with public keys.
>
> I was doing the deployment  server by server and sometimes the process didn't 
> run as expected and I have
> crashs during the startup of the application because of some program errors 
> or inconsistency in the databases.
>
> So I thought may be I can use some tool out there that simplify that work and 
> revert my process with no
> pain...
>
> I read some documentation from Fabric site and from the github.com but still 
> don't know how can I run
> myscripts in a way that can "detect" errors in deployment and run some 
> rollback code that reverts errors
> during the deployment.
>
> I understand that I can use variables to store command result status and 
> define rollback commands that can be
> executed but my question is... can Fabric "detect" errors and automatically 
> execute rollback functions in
> case of some trouble ?
>
> I want to deploy several servers and not be worried if one server didn't 
> deployed correctly at 2.00AM and the
> application server didn't start because of that failure. That server should 
> automatically recover from that
> bad deploy, revert to the previous status so in the morning I can analyse the 
> errors and correct that errors
> not worried that users can't run my application because of that failure.
>
> I'd appreciate any help given :-)
>
> (Sorry for my poor english)
>
> Miguel Lamy
>
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>




reply via email to

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