Hi Christian, I think I can figure out now a solution to my problem.
Thanks a lot. Miguel Lamy [email protected] on segunda-feira, 19 de Janeiro de 2009 at 19:06 wrote: :On Mon, Jan 19, 2009 at 7:03 PM, Miguel A. Lamy <[email protected]> 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. : :A tool such as Fabric works best in homogeneous environments, ie. when :all database servers are alike and all application servers are alike. :In this mindset, any inconsistencies in the environment are bugs. : :When each server is different, then each server must be handled :differently. This encourages fiddling, and fiddling leads to mistakes, :and mistakes leads to... suffering.... in the form of down time, ahem. ::) : :That said, Fabric is a pretty generic remote automation tool. :) : :> :> 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. : :Fabric cannot undo arbitrary shell commands. : :Fabric runs with a fail-fast mentality by default, but this can be :overwriten on most remote operations by setting a `fail` kwarg to :either "ignore" or "warn". When you invoke an operation, the call can :be wrapped with a `try ... except SystemExit` of sorts, and that will :give you a chance to do something when bad stuff happens. : :But what I usually do is to just implement a "rollback" command in my :fabfile, and when I see that my deployment have failed, I can then :decide whether to run it or not. : :> :> 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 ? : :An "error", in the sense of invoking some remote shell command, is :when that command returns with a code other than 0. : :Fabric detects this and acts upon it in accord to the "fail" kwarg for :that particular operation, which is "abort" by default. : :Aborting works by throwing SystemExit, and this is something that you :can catch. However, Fabric was not designed with this use case in :mind, to there is no additional information about what failed encoded :in that exception. : :> :> 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. : :This is possible to do by calling your own "rollback" command in the :except clause mentioned above. : :> :> I'd appreciate any help given :-) :> :> (Sorry for my poor english) :> :> Miguel Lamy :> :> :> :> _______________________________________________ :> Fab-user mailing list :> [email protected] :> http://lists.nongnu.org/mailman/listinfo/fab-user :> : : : :-- :Venlig hilsen / Kind regards, :Christian Vest Hansen. _______________________________________________ Fab-user mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/fab-user
