[Fab-user] Log integratiing extra commands
Hi, Back to fabric, I rewrote yesterday my perl deployment tool in fabric. So far, I handle the basic use case simple deployment. I have other UC to implement : - backup (quite easy) - complex deployment For complex deployment, i may need to run extra commandes like run some scripts on one or serveral frontal servers or on a given db. I would like to avoid providing a new fabfile and was looking for taking into account some extra commands which would not be used for simple deployment. Any clue ? My other concern is that I would like that all actions are written to a log file so that I can audit if a deployment went well or not. Deployment on preprod/prod are not made by me but by the firm which manages our servers. So far I have the feeling that logging facilities are limited to stderr/stdout in the current console. Any way to generate a log file that contains all info that are displayed to the users in the console ? I would like both logging and displaying at the same time. Thanks, Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://nicolas.steinmetz.fr/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Log integratiing extra commands
Hi, 2010/2/10 Jeff Forcier j...@bitprophet.org Hi Nicolas, On Wed, Feb 10, 2010 at 11:32 AM, Nicolas Steinmetz nsteinm...@gmail.com wrote: For complex deployment, i may need to run extra commandes like run some scripts on one or serveral frontal servers or on a given db. I would like to avoid providing a new fabfile and was looking for taking into account some extra commands which would not be used for simple deployment. Any clue ? Could you provide an example here? I'm afraid I don't quite follow what you're asking :) Yep, of course :-) For now, I have a commands.upd file which can contains commands to execute against some servers : Ex : remote front cd /var/www/myapp php path/to/script.php -s arg : will execute the given command on all frontals remote once front cd /var/www/myapp php /path/to/script2.php -s arg -u arg : will execute the command on the first frontal only remote db mysql -uusser -ppass -e SQL Query : will execute the query on all db servers So my perl script actually : * first push files on given servers (db or frontal according to a tree structure of the package) * execute content from the commands.upd file Most of the time, I do always the same thing in my commands.upd file : clear cache and update version in DB. But sometimes, I can have extra commands to pass (for ex, when I deploy a new town in my app, I have some jobs to run for initialising the meteo block or stations list or ... This scripts are part of my app but I need to call them. So I used to have so far most of the time the same commands.upd file that I extend for a given release with some required commands. I would like to do the same without modifying the fabfile.py (to avoid that at next release there are some old scripts that would be run because they were forgotten). Is it clear enough ? My other concern is that I would like that all actions are written to a log file so that I can audit if a deployment went well or not. Your assumption that output currently only goes to stdout/stderr, is correct -- however, there are plans to change this. See http://code.fabfile.org/issues/show/57 :) There's also nothing preventing you from logging your own messages using the Python logging module, but that obviously doesn't cover the actual stdout/stderr. However, all calls to run() and sudo() return strings containing stdout, and those strings also have a '.stderr' attribute containing stderr -- so you could still rig something up to log both types of output to a file. Again, however, we have plans to make that a lot easier or automatic, in the future. Ok, thanks for the information - Will try to see what can I do with the current .stderr, before 1.0 lands. Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://nicolas.steinmetz.fr/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
[Fab-user] Deploying to different path db on same server
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 Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Deploying to different path db on same server
Hi, 2010/1/12 Jeff Forcier j...@bitprophet.org 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 ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Error with arguments for local
2009/5/24 Jeff Forcier j...@bitprophet.org Glad to hear it! By the way, in my travels I tend to see the local workstation environment referred to as dev or development (the shared/QA internal server being staging, and the live system being, of course, production or prod). Not sure what you renamed your local to but there's a suggestion :) Yep but as I used 127.0.0.1 for the ssh connection to test it, I made the association with localhost and tends to be local at the end. As it worked with roles, I did not have the issue so far ;-) -- Nicolas Steinmetz http://www.steinmetz.fr - http://nicolas.steinmetz.fr/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Error with arguments for local
2009/5/24 Jeff Forcier j...@bitprophet.org Hey Nicolas, I'm guessing you may be defining your own function called 'local' somewhere in your fabfile (or otherwise importing something with the same name into your fabfile.) Can you check on that for me? Can't think of any other possible reason why fabric.operations.local would claim it takes no arguments. You're absolutely right, I did not see this at a first glance. With rewriting local and prod roles, I fall into this caveat :-ยง Now fixed with renaming the local function, it works like a charm :-) I set the list as cc as I forgot them last time ;-) Thanks for your feedback, Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://nicolas.steinmetz.fr/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] specifying login and password?
2009/2/18 Timothee Besset tt...@idsoftware.com Hello, New user .. finding documentation very, very scarce .. Is there a way to specify login and password along with the hosts list? I want to use fab to configure a fairly large number of machines with different access settings. One solution would be to use ssh connections with key (and then without managing login password). It depends whether your architecture allows it or not. Not really a direct answer, sorry. Otherwise, did you look at sudo command, you should be able to use a login and maybe a password too. Hope it helps a little bit, Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://www.unelectronlibre.info/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Connecting to a remote host through an ssh gateway
2009/2/16 Matt Colyer m...@adroll.com I have been sitting on some patches to get this to work. It is necessary to both patch paramiko and fabric to get it to work but I use it on a daily basis (and would love to see it integrated). I attempted to get my patch accepted into paramiko but I didn't get a single response when I posted it to their list. The project doesn't seem to be too alive these days. I just found this (sorry it's in french) but it could help you in some way with ssh connection through several machines (like the use case you described) and it's in python. http://www.ohmytux.com/belier/ Maybe Google Translate can help you :) Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://www.unelectronlibre.info/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Fabric 0.1.0 ran away from home.
2009/2/17 Christian Vest Hansen karmazi...@gmail.com But that's not it! Fabric 0.1.0 requires Python 2.5, so if you're on 2.4 and absolutely cannot upgrade, then this release is not for you :( Congrats :-) For the py 2.4 compatibility, I think the python 2.4 users (at least me) cannot blame you but more their distros as python 2.5 and 2.6 are released since a long time (especially for py 2.5). I'll still use fabric for my personnal purpose. For the professional one, it looks we are moving to a specific java based solution (as Perl Java has been set as firm standards :-/ ) Related to Jeff's purpose to (try to) move to twisted, I read some articles on Twisted those last days, it looks quite interesting (even if it may be more complex in some ways to become familar with twisted). Interesting to see where it can lead us. Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://www.unelectronlibre.info/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] python version requirement
2009/1/20 Christian Vest Hansen karmazi...@gmail.com Yes, that's the state of the current master. However, the latest release 0.0.9 works on py 2.4, and I'd like we did something about that line before the next release. I reported this issue some time ago for master version, I hacked a little bit with what I found here : http://lists.gnu.org/archive/html/fab-user/2008-11/msg00042.html Jeff mentionned that he was to include the code from django which do the same - but I guess he did not have time for this so far. Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://www.unelectronlibre.info/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Re: module - package
Hi Christian, 2008/12/8 Christian Vest Hansen [EMAIL PROTECTED] I pushed a fix to another latent reference to a wrong `env` and bumped up the version number. I wonder what people think. Is it good enough to merge? Are we close to a release with this? Does it include some fix regarding roles, depends the py 2.4 compatibility to know if it's woth testing in my environnement. Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://www.unelectronlibre.info/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Question on roles and depend vs invoke.
Hello, 2008/11/23 Jeff Forcier [EMAIL PROTECTED] It looks related to last Jeff's commits, unless it requires a new syntax for commands. Could be, although those changes were pretty simple so I'd say it's equally possible to be something related to roles/depends -- plus from your examples, you're not using args at all? Will definitely keep my arg-parsing stuff in mind when I debug, though. With last commits (I got master from this morning), I have the following error on a py 2.4 machine (with the functools patch I mentionned earlier, not the one from django) : [EMAIL PROTECTED] fabric]# fab deploy_test Fabric v. 0.0.9. Running deploy_test... Chaining prepare_db... Traceback (most recent call last): File build/bdist.linux-i686/egg/fabric.py, line 1373, in main File build/bdist.linux-i686/egg/fabric.py, line 1271, in _execute_commands File build/bdist.linux-i686/egg/fabric.py, line 1295, in _execute_command File build/bdist.linux-i686/egg/fabric.py, line 265, in lambda File build/bdist.linux-i686/egg/fabric.py, line 697, in invoke File build/bdist.linux-i686/egg/fabric.py, line 1300, in _execute_command File build/bdist.linux-i686/egg/fabric.py, line 1326, in _execute_at_target TypeError: argument 2 to map() must support iteration [EMAIL PROTECTED] fabric]# But this time, fab prepare_db or fab prepare_web does not work anymore. It looks it's at the role definition level but do not see the point so far. Nicolas -- Nicolas Steinmetz http://www.steinmetz.fr - http://www.unelectronlibre.info/ ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Question on roles and depend vs invoke.
2008/11/17 Jeff Forcier [EMAIL PROTECTED] I'm relatively committed to making sure Fabric works on 2.4, so I'll see if I can scrounge up some time to take a peek at this in the near future. Can't promise anything soon -- really busy! -- but I've starred this email in my GMail so I won't forget. With luck it'll be a small thing to tweak, backwards compat usually is. It looks there are at least one implementation of functools for python 2.4 : http://houseofhaus.org/docs/0.1.0/components/abstract.html I added it instead of the import statement and for now (fab, fab list) works like a charm. I will go on this way and keep you informed about this. Nicolas ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Question on roles and depend vs invoke.
2008/11/18 Nicolas Steinmetz [EMAIL PROTECTED] [EMAIL PROTECTED] fabric]# fab preprod deploy_test Fabric v. 0.0.9b. Running preprod... Running deploy_test... Traceback (most recent call last): File build/bdist.linux-i686/egg/fabric.py, line 1356, in main File build/bdist.linux-i686/egg/fabric.py, line 1254, in _execute_commands File build/bdist.linux-i686/egg/fabric.py, line 1278, in _execute_command File build/bdist.linux-i686/egg/fabric.py, line 266, in lambda File build/bdist.linux-i686/egg/fabric.py, line 685, in invoke TypeError: _execute_command() takes at least 3 non-keyword arguments (2 given) It looks related to last Jeff's commits, unless it requires a new syntax for commands. I forgot to say that fab preprod prepare_db and fab preprod prepare_web works nicely. I have the issue only on deploy_test. Nicolas ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user