[Capistrano] Re: building custom config files...

2009-03-04 Thread Gerhardus Geldenhuis

Hi Peter,

On Mar 3, 5:39 pm, Peter Booth pbo...@nocoincidences.com wrote:
 Gerhardus,

 On Mar 2, 2009, at 11:46 AM, Gerhardus Geldenhuis wrote:



  Hi Peter,
  I already use the multistage gem which works very well for us.

 multistage is excellent at providing a structure for stage-specific  
 configuration.



  I am reluctant to add any bits of config file in my capistrano tasks.
  I prefer to keep implementation and content seperate (read: The
  art of unix programming). That allows me to version my config files
  using an external versioning tool and keep all configs together.

 I'm not clear how separating or lumping implementation and content  
 influence whether or not you can use an external versioning tool and  
 keep all configs together.

... what I meant was that I see capistrano as a program. I was taught
rightly or wrongly to have as little as possible constants in my
code/program and keep things were possible elegant but not at the sake
of elegance. The config files for me is dynamic even if it never
changes and I would like to keep config files and capistrano seperate.
In the example you gave you build a config file in your capistrano
code. In hindsight that probably does not matter that much really and
when I looked at it again I aggreed with how you had done it.

 In the past I have used ERB to generate Apache and Tomcat config  
 files. In that case the template began as a vanilla nginx config, was  
 modified iteratively as I tuned the config, and the plugged in values  
 only represent what runs where. If I understand you correctly, this  
 would meet your  criteria about separating implementation and  
 content.

 There are some situations when configuration generation requires logic  
 that doesn't neatly fit the template approach (e.g. Use SSL for  
 application X, unless we're sharing a host, and ensure that the  
 environments that use a hardware load-balancer use the website name  
 and not the hostname for the name based virtual server ...)

 The strength of Capistrano over Ant is that it's an internal DSL  
 implemented in a scripting language. By using XML, Ant is much less  
 powerful and much more painful to use. In this case, thinking of  
 configuration as live logic rather than simply data simplifies things.

Thanks for that, a friend was asking why not use ANT, which I don't
know, and thus provides a good answer.


 The monit example is not one of these situations. Rather there is no  
 intellectual capital in the static content. The method you saw was  
 part of a module that creates simple config files. Now in that example  
 all the generated config files were stored in subversion, in a tree  
 that is rooted by host.


A question...
Why do you keep generated config files in svn too? I was thinking of
only keeping the stubs in svn and use capistrano to directly deploy
generated files(generated by cap using the stubs). I can think of
reason to store generated configs in svn but would be interested to
hear your opinion on this.


  If I could download a file to the deploy platform, build the config
  file and then send this out to nodes that would be preferable to doing

 that's what I do - what's stopping you from doing this?

Nothing really, except time. I like the idea though and keep it in
mind for version 2 of my deployment script.


  a local svn checkout on each node and building the config file
  seperately on each server. I prefer build once deploy many to deploy
  many, build many.

 Agreed.

 The fact that we're disagreeing here suggests that either I dont  
 understand your question, that its more complex than I imagine, or  
 that there is some  existing Capistrano functionality that you're not  
 aware of.

Probably a bit of all of the above :-)  I am still very much learning
capistrano and adapting to the methodology it uses and am bound to
make a few(hopefully only a few) stupid mistakes. I have also never
worked in a place that have done versioning of configs and am learning
as I go along. Hopefully my documentation (internal docs) will be read
and people will actually use it.

I have already realized that some things that I have written in
capistrano can be done differently and potentially better but at the
moment it just needs to work.


 Stepping back, one open question is, do you centralize the What runs  
 where? knowledge in a single place? One could use a YAML file, and  
 generate the stage specific files needed for multi-stage, at the same  
 time as generating web server configs and the like. I think its  
 inelegant and a pain in the ass to have to open multiple files to  
 configure this stuff.

I am not sure I understand the question completely. The company for
which I am contracting have many different application environments
with a diverse set of components and configurations making up the
various environments/platforms. (oracle, mysql, tomcat, jboss,
websphere) There is not yet a centralized what runs where place with
regards

[Capistrano] a suggestion idea

2009-03-03 Thread Gerhardus Geldenhuis

Hi
It would be nice to have something like the following:

namespace config
  task :copyconfig, :roles = appservers
   do_something
  end

  task :copyconfig, :roles = dbservers
do_something
  end
end

the idea being that if you call config.copyconfig it will get called
twice but for each role type it is definined.

If there is another way to achieve this I would gladly hear about it.

at them moment I have to differentiate my tasks by giving them
different names for each task that deploys config to server types.

Regards


--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] building custom config files...

2009-03-02 Thread Gerhardus Geldenhuis

Hi
I want to create custom config files and would appreciate any tips if
anyone has attempted the same thing.

I am planning to do it in the following way:
Download the config files using run command with svn
insert and append the config files using the run command with sed and
awk based on the servers in my roles.

Typically what I am going to do is setup our modjk loadbalancer
according the the list of tomcat application servers.

We also loadbalance accross our apaches that run modjk and I intend
using capistrano to build/customize there config files too.

What I am trying to achieve is that after having build the servers the
only other step I need to do is write a capistrano config and then run
1 or 2 cap commands to deploy new configs and applications to my
environment.

Eventually I can reverse the steps; write the config file first which
then takes care of building the virtual servers and configuring them.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: building custom config files...

2009-03-02 Thread Gerhardus Geldenhuis

Hi Peter,
I already use the multistage gem which works very well for us.

I am reluctant to add any bits of config file in my capistrano tasks.
I prefer to keep implementation and content seperate (read: The
art of unix programming). That allows me to version my config files
using an external versioning tool and keep all configs together.

If I could download a file to the deploy platform, build the config
file and then send this out to nodes that would be preferable to doing
a local svn checkout on each node and building the config file
seperately on each server. I prefer build once deploy many to deploy
many, build many.

Regards

On Mar 2, 4:06 pm, Peter Booth pbo...@nocoincidences.com wrote:
 What you describe sounds kind of painful. I'm assuming that you are  
 already using Capistrano for something.

 I had to solve a similar problem so as to allow multiple  
 stages (dev, qa, uat, prod, ...) to run
 on a single host without port or directory clashes. It was amazingly  
 easy with capistrano and
 the capistrano-ext gem, which allows you to create stage-specific  
 config files.

 I would create the file dynamically as part of the deploy with code  
 that looks like that below.

 Peter

 def build_monit_config( application, application_id, stage, stage_id,  
 instance)

      monit_config = ## Monit Configuration File\n\n
      monit_config  \n#   stage: #{stage}\n#   stage ID: #{stage_id}
 \n#   instance: #{instance}\n\n#   Produced automatically at:  
 #{Time.now}\n
      first_port = fetch(:start_port)
      top_port = first_port + fetch(:num_proc) - 1
      first_port.upto(top_port) { |i|
       �...@path = /var/www/domains/signalpatterns.com/#{application}/
 #...@stage}/#...@instance}
       �...@log_dir = #...@path}/htdocs/current/log
       �...@config_dir = #...@path}/htdocs/shared/config
       �...@pid_dir =      #...@path}/htdocs/shared/pids
        cfg = -CMD
           check process #{application}-#{i} with pidfile #...@pid_dir}/
 #{application}-mongrel.#{i}.pid
           start program = /usr/bin/mongrel_rails cluster::start -C  
 #...@config_dir}/mongrel_cluster.yml -v --clean --only #{i}
           stop program = /usr/bin/mongrel_rails cluster::stop -C  
 #...@config_dir}/mongrel_cluster.yml -v --force --only #{i}
           if failed urlhttp://localhost:#{i}/monit
              with timeout 10 seconds
           then restart
           if failed urlhttp://localhost:#{i}/monit
              with timeout 10 seconds for 2 cycles
           then
              exec /bin/bash -c 'kill -9 `cat #...@pid_dir}/
 #{application}-mongrel.#{i}.pid`'
           group #...@id}
           ##
        CMD
        monit_config  cfg
      }
    monit_config
 end

 On Mar 2, 2009, at 9:50 AM, Gerhardus Geldenhuis wrote:



  Hi
  I want to create custom config files and would appreciate any tips if
  anyone has attempted the same thing.

  I am planning to do it in the following way:
  Download the config files using run command with svn
  insert and append the config files using the run command with sed and
  awk based on the servers in my roles.

  Typically what I am going to do is setup our modjk loadbalancer
  according the the list of tomcat application servers.

  We also loadbalance accross our apaches that run modjk and I intend
  using capistrano to build/customize there config files too.

  What I am trying to achieve is that after having build the servers the
  only other step I need to do is write a capistrano config and then run
  1 or 2 cap commands to deploy new configs and applications to my
  environment.

  Eventually I can reverse the steps; write the config file first which
  then takes care of building the virtual servers and configuring them.

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Capistrano maintainership

2009-02-26 Thread Gerhardus Geldenhuis

Hi
I am just glad someone is willing to step in so quickly.

I think capistrano and webistrano is both great products but with an
original focus on ruby/rails applications. I believe that with a bit
of effort ( a bit more in webistrano) it could easily be made to be
more generic. Currently I have to bend webistrano a bit to get it
working nicely with our internal deployment methodologies.

I have been working hard to get our specific tomcat/jboss deployments
working well in a loadbalanced 24/7 environment doing simultaneous and
sequential deployments and I am excited about how capistrano has
enabled me to do this and about the future of the tool. I am hopefull
that when I get a chance I can make the tasks I have written a bit
more generic so anyone can use it for tomcat deployments.

There is'nt really that much deployment tools for tomcat so I reckon
that if you could design a good generic deployment strategy for tomcat
together with some generic load balancer interfaces to lb's like
modjk and mod_proxy (even F5) you could have a whole new slew of
users. Especially with closer integration with webistrano to simplify
the usage. The single sign on in webistrano is sure to score lots of
points in corporate environments.

Regards

On Feb 26, 11:55 am, Lee Hambley lee.hamb...@gmail.com wrote:
 Hi All,

 I'm a little suspect of the Webistrano/Macistrano guys taking over
 development, as I feel particularly that Webistrano limits the capabilities
 of capistrano and limits it usefulness for non-rails projects.
 Whilst there's still a market for simple-one-push rails deploys, with
 accountability; But I would be hoping for some kind of reassurance that
 Web/Macistrano would remain separate projects, and would not affect
 capistrano in any way.

 I do feel that someone that knows the Capistrano internals should take over,
 I'd have volunteered, except my skills lay in using Capistrano, for complex
 deploys; not particularly in changing internals, and fixing bugs, and those
 sorts of things.

 Whoever takes it over should be prepared to start living in IRC, and start
 up a drive to get documentation written... and try and drive it as *the* way
 to handle deployment.

 Even since Net::SSH-Multi - my interest in capistrano has slipped a little,
 as for the most part, my deploys aren't very compatible with the capistrano
 notion of a single app over a few roles of servers.

 I'm looking forward to whatever happens with Capistrano, Jamis has left us
 with an exceptional bit of code, we owe it to him to make the right decision
 about where to take it next.

 I will be forking copies of the libraries on Github, to make some changes to
 the way cap logs out to the screen, some things that have come up from time
 to time on the mailing list, about problems with how, and where capistrano
 logs, as well as some stuff I want to do with the output to the screen (does
 that count as logging?)

 Before we all fork-off and make our own changes, I fear that there will be
 no go-to-guy for a 'right' version of capistrano that scares me a lot, as it
 raises the barrier to entry far higher than it needs to be...
 (will_paginate... Vs. mislavs_will_paginate anyone?)

 - Lee

 2009/2/26 Simone Carletti wep...@gmail.com

  Thanks for your feedback Karel!

  I agree that Capistrano needs more documentation and I'm happy to hear
  someone else is available to contribute.
  I must confess I didn't notice your message before, I'm going to post a
  reply athttp://groups.google.com/group/capistrano/msg/654e5e84d45f9098

  Talking about the future of maintainership, I'm going to contact Jonathan
  directly to accelerate the process.

  It would be wonderful to get a feedback from Jamis about this topic.
  I'm a bit concerned about how we can carry on development without the need
  to force people to change gem name or repository.

  -- Simone

  On Thu, Feb 26, 2009 at 11:36 AM, Karel Minarik 
  karel.mina...@gmail.comwrote:

  Karel
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] writing a preflightcheck task

2009-02-20 Thread Gerhardus Geldenhuis

Hi
Version 1
  task :check_lb_worker_exists, :roles = :apacluster, :on_error
= :abort do
if exists?(:modjk_loadbalancerworker) then
  begin
run if wget #{wgetparams} 'http://$CAPISTRANO:HOST$/jkserver-
status?cmd=editfrom=listw=#{modjk_loadbalancerworker}' | grep
'ERROR'; then false;else true;fi  22/dev/null;
  rescue
puts The specified modjk load balancer worker does not
exists
  end
end
  end#task


calling the task:
task :preflightcheck, :on_error = :abort do
  unless exists?(:app_path)
abort The download path variable app_path has not been specified
  end

  modjk.check_lb_worker_exists

  puts 'Everything is fine'
end

This version works fine except that everything is always fine
regardless whether the check_lb_worker_exists failed or not

version 2
~~~

  task :check_lb_worker_exists, :roles = :apacluster, :on_error
= :abort do
if exists?(:modjk_loadbalancerworker) then
run if wget #{wgetparams} 'http://$CAPISTRANO:HOST$/jkserver-
status?cmd=editfrom=listw=#{modjk_loadbalancerworker}' | grep
'ERROR'; then false;else true;fi  ;
end
  end#task

task :preflightcheck, :on_error = :abort do
  unless exists?(:app_path)
abort The download path variable app_path has not been specified
  end

  unless not modjk.check_lb_worker_exists

abort 'horribly broken'
  end

  puts 'all looks fine!'
end

In version two if the check_lb_worker task fails that failure does not
get handled by the unless abort block in the main preflight check.

Basically I am trying to do the following:

task preflight
  unless run(some command) fail
  unless run_task_check1, fail with nice message
  unless run_task_check2, fail with nice message

  if nothing failed then put everything looks ok
end

I am struggling to get the final everything looks ok message to
display only if everything really is ok because at the moment it
displays regardless. I hope this is all making some kind of sense...
otherwise I will have to try again.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: writing a preflightcheck task

2009-02-20 Thread Gerhardus Geldenhuis

Thanks
Rather logical in retrospec :-) ... it works well now.

Slowly but surely I am getting there.

Regards

On Feb 20, 4:37 pm, Jamis Buck ja...@37signals.com wrote:
 If an exception is raised, it does not cause a task to return a value;
 it causes a task to raise an exception. You need to use a begin/rescue
 clause, instead of an unless condition.

   begin
     some.task
   rescue Exception = e
     puts got exception: #{e}
   end

 Does that make sense? Exceptions bypass your program logic and require
 explicit handling.

 - Jamis

 On 2/20/09 9:28 AM, Gerhardus Geldenhuis wrote:

  Hi
  Version 1
    task :check_lb_worker_exists, :roles = :apacluster, :on_error
  = :abort do
      if exists?(:modjk_loadbalancerworker) then
        begin
          run if wget #{wgetparams} 'http://$CAPISTRANO:HOST$/jkserver-
  status?cmd=editfrom=listw=#{modjk_loadbalancerworker}' | grep
  'ERROR'; then false;else true;fi  22/dev/null;
        rescue
          puts The specified modjk load balancer worker does not
  exists
        end
      end
    end#task

  calling the task:
  task :preflightcheck, :on_error = :abort do
    unless exists?(:app_path)
      abort The download path variable app_path has not been specified
    end

    modjk.check_lb_worker_exists

    puts 'Everything is fine'
  end

  This version works fine except that everything is always fine
  regardless whether the check_lb_worker_exists failed or not

  version 2
  ~~~

    task :check_lb_worker_exists, :roles = :apacluster, :on_error
  = :abort do
      if exists?(:modjk_loadbalancerworker) then
          run if wget #{wgetparams} 'http://$CAPISTRANO:HOST$/jkserver-
  status?cmd=editfrom=listw=#{modjk_loadbalancerworker}' | grep
  'ERROR'; then false;else true;fi  ;
      end
    end#task

  task :preflightcheck, :on_error = :abort do
    unless exists?(:app_path)
      abort The download path variable app_path has not been specified
    end

    unless not modjk.check_lb_worker_exists

      abort 'horribly broken'
    end

    puts 'all looks fine!'
  end

  In version two if the check_lb_worker task fails that failure does not
  get handled by the unless abort block in the main preflight check.

  Basically I am trying to do the following:

  task preflight
    unless run(some command) fail
    unless run_task_check1, fail with nice message
    unless run_task_check2, fail with nice message

    if nothing failed then put everything looks ok
  end

  I am struggling to get the final everything looks ok message to
  display only if everything really is ok because at the moment it
  displays regardless. I hope this is all making some kind of sense...
  otherwise I will have to try again.

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] logger vs puts

2009-02-20 Thread Gerhardus Geldenhuis

Hi
Is it recommended to use logger.info or should I rather be using puts?
Also is there options other than logger.info and I would appreciate it
if you could point me to the source code for logger which would
probably answer my second question.

Best Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: logger vs puts

2009-02-20 Thread Gerhardus Geldenhuis

Thanks

from the help text:
-v, --verboseBe more verbose. May be given more
than once

and the source:
IMPORTANT = 0
INFO  = 1
DEBUG = 2
TRACE = 3


can I assume that
  cap -v = 0
  cap -vv = 1
  cap -vvv= 2
  cap - =3

If so I would like to submit a change to the help text to make it more
clear.

Regars

On Feb 20, 6:05 pm, Jamis Buck ja...@37signals.com wrote:
 Using logger appropriately will let your own log statements display or
 hide based on the -v switch for Capistrano. See capistrano/logger.rb for
 the source.

 - Jamis

 On 2/20/09 11:00 AM, Gerhardus Geldenhuis wrote:

  Hi
  Is it recommended to use logger.info or should I rather be using puts?
  Also is there options other than logger.info and I would appreciate it
  if you could point me to the source code for logger which would
  probably answer my second question.

  Best Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: raising exeptions

2009-02-17 Thread Gerhardus Geldenhuis

Found a good solution:

unless exists?(:app_path)
  abort I failed
end


On Feb 17, 10:58 am, Gerhardus Geldenhuis
gerhardus.geldenh...@gmail.com wrote:
 Hi
 I assumed that if I purposely raised an exception it would show my
 error message and stop. Capistrano/ruby does that but it also included
 a whole bunch of other items that would confuse my users.

 deploy-config.rb:92:in `load': I failed (RuntimeError)
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/configuration/execution.rb:128:in `instance_eval'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/configuration/execution.rb:128:in
 `invoke_task_directly_without_callbacks'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/configuration/callbacks.rb:27:in `invoke_task_directly'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/configuration/execution.rb:81:in `execute_task'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/configuration/execution.rb:93:in `find_and_execute_task'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/cli/execute.rb:45:in
 `execute_requested_actions_without_help'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/cli/execute.rb:44:in `each'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/cli/execute.rb:44:in
 `execute_requested_actions_without_help'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/cli/help.rb:19:in `execute_requested_actions'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/cli/execute.rb:33:in `execute!'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
 capistrano/cli/execute.rb:14:in `execute'
         from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/bin/cap:4
         from /usr/bin/cap:16:in `load'
         from /usr/bin/cap:16

 can I raise exceptions more silently or am I missing the point?

 my code:
   task :gg, :roles = :appservers do
 #    set(:revision) { query_revision } unless exists?(:revision)
     run echo #{revision}
     unless not exists?(:revision)
       raise I failed
     end
   end

 Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] raising exeptions

2009-02-17 Thread Gerhardus Geldenhuis

Hi
I assumed that if I purposely raised an exception it would show my
error message and stop. Capistrano/ruby does that but it also included
a whole bunch of other items that would confuse my users.

deploy-config.rb:92:in `load': I failed (RuntimeError)
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/execution.rb:128:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/execution.rb:128:in
`invoke_task_directly_without_callbacks'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/callbacks.rb:27:in `invoke_task_directly'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/execution.rb:81:in `execute_task'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/execution.rb:93:in `find_and_execute_task'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:45:in
`execute_requested_actions_without_help'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:44:in `each'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:44:in
`execute_requested_actions_without_help'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/help.rb:19:in `execute_requested_actions'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:33:in `execute!'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:14:in `execute'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/bin/cap:4
from /usr/bin/cap:16:in `load'
from /usr/bin/cap:16

can I raise exceptions more silently or am I missing the point?

my code:
  task :gg, :roles = :appservers do
#set(:revision) { query_revision } unless exists?(:revision)
run echo #{revision}
unless not exists?(:revision)
  raise I failed
end
  end


Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] staggered deploy revisited

2009-02-16 Thread Gerhardus Geldenhuis

Hi
I have managed to confuse myself again...

I am trying to do the following:
my staggered deploy scripts cycles through a list of application
servers doing the following:
disable app server on multiple load balancers
install new app
enable app server on multiple load balancers
continue on to next one.

I thought that I could re-use the basic deployment script for my
appservers that I wrote but when I call it in in my sequential task it
executes the task for all the defined appservers even if I call it in
the following way:
tomcat.deploy :hosts = server

The staggered deploy task:

desc Deploys application to sequentially to one server at a time
task :staggered_deploy do
  find_servers(:roles = :appservers).each do |server|
set :current_tomcat, #{server.host}
modjk.disablenode
puts  application deployment
###
puts deploying new appliation
tomcat.deploy :hosts = server
puts new application succesfully deployed
puts  application deployment
###
modjk.enablenode
puts  
  end
end

I simplified my deploy script for the sake of testing:

  desc Deploy a new tomcat application
  task :deploy, :roles = :appservers do
#   tomcat.prepare_deploy_env
#   tomcat.download_app
#   tomcat.remove_from_webapps
#   tomcat.stop
# ##check for running instances
#   tomcat.cleanup_deploy_dirs
#   tomcat.start
#   tomcat.move_to_webapps
#   monitor.app_startup
test123
  end

  task :test123, :roles = :appservers do
run uname -a
  end


The only solution I can think of at the moment is to write a separate
duplicate set of tasks for staggered deploy where the roles variable
is called something like staggered_role which gets set with a new
value for every appserver that I want to deploy to while looping
through the app server list.

I thought that if I called tomcat.deploy task in the following way:
tomcat.deploy :hosts = server
that the hosts value would override the predefined roles value and
that the task and all tasks that it is calling would only execute on
the list of servers in the server variable.

I would really appreciate it if you could assist me in clearing up
this confusion.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: staggered deploy revisited

2009-02-16 Thread Gerhardus Geldenhuis

Thanks, I am going to try that right now.

How do you feel about a sequential extention to capistrano? Any
thoughts on how it could fit in with the current structure?

Regards

On Feb 16, 3:16 pm, Jamis Buck ja...@37signals.com wrote:
 If you want subtasks to use a particular host, you need to set the HOSTS
 or HOSTFILTER environment variables. E.g.

   find_servers(...).each do |server|
     ENV['HOSTFILTER'] = server.host
     sub.task.here
     ENV['HOSTFILTER'] = nil
   end

 It's extremely ugly and hacky and I don't like it, but there's not
 currently another way to do it.

 - Jamis

 On 2/16/09 5:09 AM, Gerhardus Geldenhuis wrote:

  I have also put the relevant code onhttp://pastie.org/390600

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: staggered deploy revisited

2009-02-16 Thread Gerhardus Geldenhuis

Hi
No code atm I'm afraid but I will share some ideas/requirements/
thoughts

We do a state check of the application before removing it from the
cluster which we can use to compare with after new deployment.

We have a level1 and level2 check for applications. Level1 check
functional deployment in tomcat, which basically checks the
application server.
Level2 actually submits a request to check complete infrastructure
functionality and parses xml( that is the intend anyway still needs to
be written)

We want to build in a failure percentage that if you have 10 servers
and 1 fails after 5 deployments, deployment should continue until in
reaches a failure percentage, say 20%.

The modjk tasks I have written that act as our loadbalancers actually
works quite well, once I have extended it a bit more I will gladly
share the code.

I think sequential deploy will need some generic loadbalancer/cluster
tasks build-in.

At the moment we use something like the following:
run wget --quiet -O - --connect-timeout=1 --timeout=1 --tries=1
'http://$CAPISTRANO:HOST$/jkserver-status?cmd=updatefrom=listw=#
{modjk_loadbalancergroup}sw=#{current_tomcat}wa=1wf=1wn=#
{current_tomcat}wr=wc=wd=0' 12/dev/null

maybe a wrapper to allow easier/simplified http interaction with put
and get might be usefull. (perhaps even some xml manipulation)

Anyway just some random thoughts.

Regards

On Feb 16, 3:44 pm, Jamis Buck ja...@37signals.com wrote:
 On 2/16/09 8:37 AM, Gerhardus Geldenhuis wrote:

  Thanks, I am going to try that right now.

  How do you feel about a sequential extention to capistrano? Any
  thoughts on how it could fit in with the current structure?

 I think that'd be great. Even as something for Capistrano core. I've
 needed, and others have needed it, so I'm sure it'd be useful.

 In general, I'd really love to get away from the ROLES, HOSTS, and
 HOSTFILTER environment variables. I just don't know where to go instead
 of those, and honestly, I haven't spent much time thinking about it.

 If you have any ideas, please feel free to hack on them and see what you
 come up with.

 - Jamis



  Regards

  On Feb 16, 3:16 pm, Jamis Buck ja...@37signals.com wrote:
  If you want subtasks to use a particular host, you need to set the HOSTS
  or HOSTFILTER environment variables. E.g.

    find_servers(...).each do |server|
      ENV['HOSTFILTER'] = server.host
      sub.task.here
      ENV['HOSTFILTER'] = nil
    end

  It's extremely ugly and hacky and I don't like it, but there's not
  currently another way to do it.

  - Jamis

  On 2/16/09 5:09 AM, Gerhardus Geldenhuis wrote:

  I have also put the relevant code onhttp://pastie.org/390600
  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Checking for variable existence

2009-02-13 Thread Gerhardus Geldenhuis

Hi
I vaguely recall seeing a way to test for empty or non-existent
variables but could not find it going through my archives.

I want to know if there is a way to test whether a variable has been
declared/have a value?

Basically I want to write a pre-flight check program that checks that
users have properly written a config file for a specific environment
and that the deployment does not come down like a house of cards if
one variable is missing.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Checking for variable existence

2009-02-13 Thread Gerhardus Geldenhuis

Exactly what I wanted. Maybe I should add an entry to the FAQ...

I got the first of 3 of 12 inoculations this week for a long trip and
ever since have not been able to think straight. :-) Well at least it
is an original excuse.

Regards

On Feb 13, 3:01 pm, Jamis Buck ja...@37signals.com wrote:
 See the #exists?(:var) method:

  http://wiki.capify.org/article/Exists%3F

 Hope that helps,

 Jamis

 On 2/13/09 7:29 AM, Gerhardus Geldenhuis wrote:

  Hi
  I vaguely recall seeing a way to test for empty or non-existent
  variables but could not find it going through my archives.

  I want to know if there is a way to test whether a variable has been
  declared/have a value?

  Basically I want to write a pre-flight check program that checks that
  users have properly written a config file for a specific environment
  and that the deployment does not come down like a house of cards if
  one variable is missing.

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Caching in Capistrano

2009-02-13 Thread Gerhardus Geldenhuis

Hi
is any caching that capistrano does only for the duration of a
running cap command?

I have seen some weird errors which I thought might potentially
caching related.

Basically I thing this variable was not being set $CAPISTRANO:HOST$
properly which caused some of the tasks to not work correctly...

Is there a way to control/clear caching?

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Staggered Install

2009-01-30 Thread Gerhardus Geldenhuis

Hi
I have finally found time to start implementing this but am a bit
stuck atm. I am not sure how to convert this code snippet into a
working task. I also need to adapt my task to work in a multistage
environment where I set my role definition in each stage's config
file.

Regards

On Jan 28, 3:31 pm, Jamis Buck ja...@37signals.com wrote:
 find_servers(:roles = :foo).each do |server|
   run disable server on load balancer, :host = server
   run install new software, :host = server
   run test server, :host = server
   # etc.
 end

 - Jamis

 On 1/28/09 8:16 AM, Gerhardus Geldenhuis wrote:

  Hi
  I need to do something like the following:
  for server in role do
    Disable server on load balancer
    Install new software
    Test Server
    Enable server in load balancer
    If successful then deploy next server else fail/rollback.
  done

  The individual steps is not a problem but I am unsure how to approach
  the sequential install in a capistrano way.

  I could not find anything on the wiki or list archives.

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Staggered Install

2009-01-30 Thread Gerhardus Geldenhuis

I were probably doing something stupid...
Its working now, but... it loops through the list of servers and the
executes the task for each server 16 times in total.

role :dev_xml_gerrard, longtct03g, longtct03h, longtct03i,
longtct03j

task :foo, roles = :dev_xml_gerrard do
find_servers(:roles = :dev_xml_gerrard).each do |server|
  run uname -a
  run sleep 4
end
end

I have taken multistage out of the equation and am only using this
code above.

Regards

On Jan 30, 3:14 pm, Jamis Buck ja...@37signals.com wrote:
 1. Define your roles in each stage file. E.g.

   # config/deploy/staging.rb
   role :app, stage-app-01, stage-app-02

   # config/deploy/production.rb
   role :app, prod-app-01, prod-app-02

 2. Put the snippet in a task.

   task :foo do
     find_servers(:roles = :app).each do |server|
       # ...
      end
   end

 3. There is no step three!

 - Jamis

 On 1/30/09 7:51 AM, Gerhardus Geldenhuis wrote:

  True,
  But I do need multistage to deploy to different stages eg production,
  test, demo, load-test etc.

  I have also defined stages for different application stacks in
  production for example. eg prod-app1, prod-app2

  We need to deploy our tomcat application to one server at a time in
  production to prevent any outages. We handle about 350 web
  transactions a second on a busy day in one of our environments which
  makes it critical that deployment is one at a time. I have been trying
  to modify this line to be a task
  find_servers(:roles = :foo).each do |server|
  but no success so far. It is probably due to my lack of ruby language
  knowledge.

  In the example given a specific role is given, however all my tasks
  defined in my cap file have no specific role attached and will thus
  execute for all servers defined in the config file of the stage.

  Regards

  On Jan 30, 2:23 pm, Lee Hambley lee.hamb...@gmail.com wrote:
  Ger,

   You don't need multistage to deploy to an array of servers?

  - Lee

  2009/1/30 Gerhardus Geldenhuis gerhardus.geldenh...@gmail.com:

  Hi
  I have finally found time to start implementing this but am a bit
  stuck atm. I am not sure how to convert this code snippet into a
  working task. I also need to adapt my task to work in a multistage
  environment where I set my role definition in each stage's config
  file.
  Regards
  On Jan 28, 3:31 pm, Jamis Buck ja...@37signals.com wrote:
  find_servers(:roles = :foo).each do |server|
    run disable server on load balancer, :host = server
    run install new software, :host = server
    run test server, :host = server
    # etc.
  end
  - Jamis
  On 1/28/09 8:16 AM, Gerhardus Geldenhuis wrote:
  Hi
  I need to do something like the following:
  for server in role do
    Disable server on load balancer
    Install new software
    Test Server
    Enable server in load balancer
    If successful then deploy next server else fail/rollback.
  done
  The individual steps is not a problem but I am unsure how to approach
  the sequential install in a capistrano way.
  I could not find anything on the wiki or list archives.
  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: :on_error = :abort custom message

2009-01-29 Thread Gerhardus Geldenhuis

Thanks, that was my second option to create a script on the local box,
however I like the clean approach of keeping all the logic on the
deployment box which means I don't have to worry about any deployment
requirements.

Would the abbility to hide/show custom message when executing a task
be something that you would consider adding to Capistrano at a later
stage? If so I will gladly create a feature request for it.

Regards

On Jan 28, 5:33 pm, Jamis Buck ja...@37signals.com wrote:
 Gerhardus, there is not currently a way built into Capistrano to hide
 the command that is executed. My recommendation is to put the command in
 a script and execute the script on the server, e.g.:

   put some big long command to execute, /tmp/script.sh
   run sh -c /tmp/script.sh

 - Jamis

 On 1/28/09 10:29 AM, Gerhardus Geldenhuis wrote:

  Thanks Lee,
  That will certainly be usefull and solve some other problems I had.

  But I was trying to solve another problem

  when I execute the task I get the following:

    * executing for ((n=0; n61; n++ )); do\\\n      if wget localhost:
  8080/gta-jcbs-xml/bfuildInfo.jsp --quiet -O - --connect-timeout=1 --
  timeout=1 --tries=1 | grep -q 'Build Information'; then echo
  'Application Succesfully deployed';exit 0;\\\n      elif [ $n -eq
  60 ]; then echo \Server did not deploy in time\;\\\n      exit 0;\\
  \n      fi;\\\n      sleep 1;\\\n    done
      servers: [longtct03g, longtct03h, longtct03i, longtct03j]

  regardless of the success or failure. I am trying to hide the
  implementation from the user because they don't need to know (or care)
  and just having a string that says checking for availability of
  application is better then the sh optimized string seen above.

  Basically I want a run command with the following parameters: run
  execute this task, optionally display this description of the task
  being run

  Regards

  On Jan 28, 2:09 pm, Lee Hambley lee.hamb...@gmail.com wrote:
  Ger,
   One of these two examples in my new pastie might help - though, I've not
  tested them :)

     -http://pastie.org/373172

  - Lee

  2009/1/28 Gerhardus Geldenhuis gerhardus.geldenh...@gmail.com

  Hi
  I believe that when I know ruby better I should be able to answer this
  myself but for now I would appreciate some help.
  Is there a way to customize the message per task when a task aborts.
  I would also like to customize the message if a task like the
  following executes:
   run -CMD
     for ((n=0; n61; n++ )); do
       if wget localhost:8080/gta-jcbs-xml/buildInfo.jsp --quiet -O - --
  connect-timeout=1 --timeout=1 --tries=1 | grep -q 'Build Information';
  then echo 'Application Succesfully deployed';exit 0;
       elif [ $n -eq 60 ]; then echo Server did not deploy in time;
       exit 0;
       fi;
       sleep 1;
     done
   CMD
  because the execute message looks awfull:
   * executing for ((n=0; n61; n++ )); do\\\n      if wget localhost:
  8080/gta-jcbs-xml/buildInfo.jsp --quiet -O - --connect-timeout=1 --
  timeout=1 --tries=1 | grep -q 'Build Information'; then echo
  'Application Succesfully deployed';exit 0;\\\n      elif [ $n -eq
  60 ]; then echo \Server did not deploy in time\;\\\n      exit 0;\\
  \n      fi;\\\n      sleep 1;\\\n    done
  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: :on_error = :abort custom message

2009-01-29 Thread Gerhardus Geldenhuis

It should really only be optional, I prefer the high verbosity during
development.

I don't want to confuse users who is using the deploy script and I
personally like it when my screen looks nice and tidy when doing a
deployment. The other option which I have anyway considered have been
to eventually have all users that does application deployment use
webistrano which is better for us from a security and auditing point
of view too.

Regards

On Jan 29, 3:30 pm, Jamis Buck ja...@37signals.com wrote:
 Gerhardus,

 I don't know that I like the idea of an option that masks the command
 being executed, but I could probably live with a patch that changed the
 output depending on the verbosity of logger. When very verbose (the
 default), show the command in all it's glory, but when verbosity is
 less, show either a truncated version of the command, or just executing
 command.

 - Jamis

 On 1/29/09 5:33 AM, Gerhardus Geldenhuis wrote:

  Thanks, that was my second option to create a script on the local box,
  however I like the clean approach of keeping all the logic on the
  deployment box which means I don't have to worry about any deployment
  requirements.

  Would the abbility to hide/show custom message when executing a task
  be something that you would consider adding to Capistrano at a later
  stage? If so I will gladly create a feature request for it.

  Regards

  On Jan 28, 5:33 pm, Jamis Buck ja...@37signals.com wrote:
  Gerhardus, there is not currently a way built into Capistrano to hide
  the command that is executed. My recommendation is to put the command in
  a script and execute the script on the server, e.g.:

    put some big long command to execute, /tmp/script.sh
    run sh -c /tmp/script.sh

  - Jamis

  On 1/28/09 10:29 AM, Gerhardus Geldenhuis wrote:

  Thanks Lee,
  That will certainly be usefull and solve some other problems I had.
  But I was trying to solve another problem
  when I execute the task I get the following:
    * executing for ((n=0; n61; n++ )); do\\\n      if wget localhost:
  8080/gta-jcbs-xml/bfuildInfo.jsp --quiet -O - --connect-timeout=1 --
  timeout=1 --tries=1 | grep -q 'Build Information'; then echo
  'Application Succesfully deployed';exit 0;\\\n      elif [ $n -eq
  60 ]; then echo \Server did not deploy in time\;\\\n      exit 0;\\
  \n      fi;\\\n      sleep 1;\\\n    done
      servers: [longtct03g, longtct03h, longtct03i, longtct03j]
  regardless of the success or failure. I am trying to hide the
  implementation from the user because they don't need to know (or care)
  and just having a string that says checking for availability of
  application is better then the sh optimized string seen above.
  Basically I want a run command with the following parameters: run
  execute this task, optionally display this description of the task
  being run
  Regards
  On Jan 28, 2:09 pm, Lee Hambley lee.hamb...@gmail.com wrote:
  Ger,
   One of these two examples in my new pastie might help - though, I've not
  tested them :)
     -http://pastie.org/373172
  - Lee
  2009/1/28 Gerhardus Geldenhuis gerhardus.geldenh...@gmail.com
  Hi
  I believe that when I know ruby better I should be able to answer this
  myself but for now I would appreciate some help.
  Is there a way to customize the message per task when a task aborts.
  I would also like to customize the message if a task like the
  following executes:
   run -CMD
     for ((n=0; n61; n++ )); do
       if wget localhost:8080/gta-jcbs-xml/buildInfo.jsp --quiet -O - --
  connect-timeout=1 --timeout=1 --tries=1 | grep -q 'Build Information';
  then echo 'Application Succesfully deployed';exit 0;
       elif [ $n -eq 60 ]; then echo Server did not deploy in time;
       exit 0;
       fi;
       sleep 1;
     done
   CMD
  because the execute message looks awfull:
   * executing for ((n=0; n61; n++ )); do\\\n      if wget localhost:
  8080/gta-jcbs-xml/buildInfo.jsp --quiet -O - --connect-timeout=1 --
  timeout=1 --tries=1 | grep -q 'Build Information'; then echo
  'Application Succesfully deployed';exit 0;\\\n      elif [ $n -eq
  60 ]; then echo \Server did not deploy in time\;\\\n      exit 0;\\
  \n      fi;\\\n      sleep 1;\\\n    done
  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Editor for Capistrano

2009-01-28 Thread Gerhardus Geldenhuis

Hi
Thanks for the replies, I am not yet ready to give up on vi/vim but
thought it worth asking. Maybe a bigger problem for me is not the
editor but the environment or lack of understanding in how to use it.

I got used to pressing F9 or Ctrl+F9 to run/compile code while using
Delphi and I really liked the integration and abbility to step through
my code. At the moment I have a putty session for my various files I
edit using tabs in vi, and a putty session running screen for the
servers I deploy to using capistrano and a third putty session for
executing my capistrano tasks. This works relatively well but I would
welcome other suggestions for env improvements or being more
effective. I find screen very usefull but it breaks some of the bash
keybindings which I use often. I know I can change the keybindings but
I want to stay standard to easily adapt to new environments.

Regards

On Jan 28, 3:36 am, Donovan Bray donno...@gmail.com wrote:
 Netbeans is a capable ruby editor for windows. I primarily use vi and  
 textmate.

 On Jan 27, 2009, at 5:24 AM, Lee Hambley lee.hamb...@gmail.com wrote:

  Gerardus,

  Capistrano files are plain Ruby, though in Textmate on the mac you  
  get limited support for intelligently letting you browse at task/
  namespace level - but this is as much a bug as it is a feature.

  My advice would be to invest some time in configuring Vim for Ruby,  
  a lot can be done with Vim if you do a little reading, and - as I  
  said, Capistrano recipes are just pure ruby.

  - Lee

  2009/1/27 Gerhardus Geldenhuis gerhardus.geldenh...@gmail.com

  Hi
  I am looking at Ruby editors available and was wondering if anyone has
  a favourite editor they want to recommend for capistrano or that can
  be adapted to work well with capistrano. A colleague is using Komodo
  which is commercial but looks quite nice. atm I am using vim which has
  so far been more than adequate for my needs. I do feel kind of guilty
  asking this as if I am letting down vim. I know vim can do a lot but I
  do like some prettiness and eye candy. I used to program in Delphi so
  vi was quite an adjustment.

  I am not fortunate enough to own a Apple yet (am planning to) so
  environments for editors is limited to Linux and windows.

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Editor for Capistrano

2009-01-28 Thread Gerhardus Geldenhuis

I forgot to mention two other things that I found extremely usefull in
Delphi... that I miss in vi
an easy way via keyboard shorcut to jump to the function/procedure
definition
and the ability to dig into the code... if I used a pre-declared
function/variable/constant I could jump to the piece of code where it
was declared even if it weren't part of my application which was
powerfull and an excellent way to learn.

Regards

On Jan 28, 10:04 am, Gerhardus Geldenhuis
gerhardus.geldenh...@gmail.com wrote:
 Hi
 Thanks for the replies, I am not yet ready to give up on vi/vim but
 thought it worth asking. Maybe a bigger problem for me is not the
 editor but the environment or lack of understanding in how to use it.

 I got used to pressing F9 or Ctrl+F9 to run/compile code while using
 Delphi and I really liked the integration and abbility to step through
 my code. At the moment I have a putty session for my various files I
 edit using tabs in vi, and a putty session running screen for the
 servers I deploy to using capistrano and a third putty session for
 executing my capistrano tasks. This works relatively well but I would
 welcome other suggestions for env improvements or being more
 effective. I find screen very usefull but it breaks some of the bash
 keybindings which I use often. I know I can change the keybindings but
 I want to stay standard to easily adapt to new environments.

 Regards

 On Jan 28, 3:36 am, Donovan Bray donno...@gmail.com wrote:

  Netbeans is a capable ruby editor for windows. I primarily use vi and  
  textmate.

  On Jan 27, 2009, at 5:24 AM, Lee Hambley lee.hamb...@gmail.com wrote:

   Gerardus,

   Capistrano files are plain Ruby, though in Textmate on the mac you  
   get limited support for intelligently letting you browse at task/
   namespace level - but this is as much a bug as it is a feature.

   My advice would be to invest some time in configuring Vim for Ruby,  
   a lot can be done with Vim if you do a little reading, and - as I  
   said, Capistrano recipes are just pure ruby.

   - Lee

   2009/1/27 Gerhardus Geldenhuis gerhardus.geldenh...@gmail.com

   Hi
   I am looking at Ruby editors available and was wondering if anyone has
   a favourite editor they want to recommend for capistrano or that can
   be adapted to work well with capistrano. A colleague is using Komodo
   which is commercial but looks quite nice. atm I am using vim which has
   so far been more than adequate for my needs. I do feel kind of guilty
   asking this as if I am letting down vim. I know vim can do a lot but I
   do like some prettiness and eye candy. I used to program in Delphi so
   vi was quite an adjustment.

   I am not fortunate enough to own a Apple yet (am planning to) so
   environments for editors is limited to Linux and windows.

   Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] path problems

2009-01-28 Thread Gerhardus Geldenhuis

Hi
I have created the following alias for a deployer user:
alias capg='cap -f /home/deployer/tomcat-deploy/multistage/
testingmultstage.rb'

however when the user runs capg he/she gets the following error:
/usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/capistrano/
configuration/loading.rb:183:in `find_file_in_load_path': no such file
to load -- config/deploy/test_hol_esb
(Loa   dError)

which is because the config files are not in the current directory. I
can fix this with bash but I was wondering if I can rather fix this
in capistrano. I was expecting capistrano to look for the config
directory relevant to where the script is and not the pwd. Is there a
way to fix this do it differently?

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: path problems

2009-01-28 Thread Gerhardus Geldenhuis

Thanks, I am sure it will get me own my way.

Regards

On Jan 28, 1:57 pm, Lee Hambley lee.hamb...@gmail.com wrote:
 Gerhardus,
 Actually, I didn't test this code, using File.join() you may need to add the
 .rb to the deploy and capistrano/deploy paths... not really sure :)

 - Lee

 2009/1/28 Lee Hambley lee.hamb...@gmail.com

  Gerhardus,
  Open the Capfile and replace things like this:

  load 'deploy' if respond_to?(:namespace) # cap2 differentiator
  Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
  Dir['capistrano/namespaces/*.rb'].each { |file| load(file) }
  load 'capistrano/plan'
  load 'capistrano/deploy'

  With

  load File.join(File.dirname(__FILE__), 'deploy') if respond_to?(:namespace)
  # cap2 differentiator
  Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
  Dir['capistrano/namespaces/*.rb'].each { |file| load(file) }
  load File.join(File.dirname(__FILE__), 'capistrano/plan')
  load File.join(File.dirname(__FILE__), 'capistrano/deploy')

  You won't have a plan file, that's where we define our before and Afters.

  methods used are 
  File.joinhttp://www.ruby-doc.org/core/classes/File.html#M002568
    and File.dirnamehttp://www.ruby-doc.org/core/classes/File.html#M002565
  .

  - Hope this helps.

  2009/1/28 Gerhardus Geldenhuis gerhardus.geldenh...@gmail.com

  Hi
  I have created the following alias for a deployer user:
  alias capg='cap -f /home/deployer/tomcat-deploy/multistage/
  testingmultstage.rb'

  however when the user runs capg he/she gets the following error:
  /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/capistrano/
  configuration/loading.rb:183:in `find_file_in_load_path': no such file
  to load -- config/deploy/test_hol_esb
  (Loa                               dError)

  which is because the config files are not in the current directory. I
  can fix this with bash but I was wondering if I can rather fix this
  in capistrano. I was expecting capistrano to look for the config
  directory relevant to where the script is and not the pwd. Is there a
  way to fix this do it differently?

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Staggered Install

2009-01-28 Thread Gerhardus Geldenhuis

Hi
I need to do something like the following:
for server in role do
  Disable server on load balancer
  Install new software
  Test Server
  Enable server in load balancer
  If successful then deploy next server else fail/rollback.
done

The individual steps is not a problem but I am unsure how to approach
the sequential install in a capistrano way.

I could not find anything on the wiki or list archives.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Staggered Install

2009-01-28 Thread Gerhardus Geldenhuis

Thanks,
Another FAQ entry...

There is a certain beauty to those few lines.

Regards

On Jan 28, 3:31 pm, Jamis Buck ja...@37signals.com wrote:
 find_servers(:roles = :foo).each do |server|
   run disable server on load balancer, :host = server
   run install new software, :host = server
   run test server, :host = server
   # etc.
 end

 - Jamis

 On 1/28/09 8:16 AM, Gerhardus Geldenhuis wrote:

  Hi
  I need to do something like the following:
  for server in role do
    Disable server on load balancer
    Install new software
    Test Server
    Enable server in load balancer
    If successful then deploy next server else fail/rollback.
  done

  The individual steps is not a problem but I am unsure how to approach
  the sequential install in a capistrano way.

  I could not find anything on the wiki or list archives.

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Editor for Capistrano

2009-01-27 Thread Gerhardus Geldenhuis

Hi
I am looking at Ruby editors available and was wondering if anyone has
a favourite editor they want to recommend for capistrano or that can
be adapted to work well with capistrano. A colleague is using Komodo
which is commercial but looks quite nice. atm I am using vim which has
so far been more than adequate for my needs. I do feel kind of guilty
asking this as if I am letting down vim. I know vim can do a lot but I
do like some prettiness and eye candy. I used to program in Delphi so
vi was quite an adjustment.

I am not fortunate enough to own a Apple yet (am planning to) so
environments for editors is limited to Linux and windows.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Multistage in capistrano

2009-01-23 Thread Gerhardus Geldenhuis

Hi
I have been doing some reading about how to implement multistaging but
I am not sure which route I should be following. I would really
appreciate some advice/thoughts.

I have found Multistage:
http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage

and another possible method
http://www.egtheblog.com/?p= that just sets a env variable and then
sets your server list based on this variable. This is the method I
like most at the moment...

We have demo, development, production and load testing environments.
The method of deploying new applications does not differ between
environment, except for the different parameters that download the
applications. I also want to implement sequential implementation in
production at a later stage. We have a number of different
applications but all of them use the same deployment technique.

I am unsure how I should be mapping this out with roles etc on my
tasks, I want all roles to be able to run task A but I don't want task
A to run for all roles when I don't specify the environment.

I guess multistage could be used here and defining stages in the
following way:
Demo-AppA
Demo-AppB
Prod-AppA
Prod-AppB
etc...

I like the fact that multstage will prompt you if you don't specify a
environment which makes a lot safer for me.

Generally applications run on a dedicated server but there will be
some server sharing between applications.

I would appreciate any thoughts, tips, caveats or source examples.
This email is also serving as a way for me to formalize my thoughts a
bit more.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Prettifying task and logging

2009-01-23 Thread Gerhardus Geldenhuis

Hi
Is there a way to display a string rather than the command executed
with run in a task. Some of my run commands are quite involved and
does not look very intuitive or clear on the screen. I would rather
show the operator a simple output with a log file somewhere else that
stores all the output.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Multistage in capistrano

2009-01-23 Thread Gerhardus Geldenhuis

Hi am reading through the archives at the moment and am missing some
good examples of how to actually use multistage.

I realized that I have no idea what to do further other defining my
stages.

Regards

On Jan 23, 3:12 pm, Gerhardus Geldenhuis
gerhardus.geldenh...@gmail.com wrote:
 Hi
 I have been doing some reading about how to implement multistaging but
 I am not sure which route I should be following. I would really
 appreciate some advice/thoughts.

 I have found 
 Multistage:http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage

 and another possible methodhttp://www.egtheblog.com/?p=that just sets a env 
 variable and then
 sets your server list based on this variable. This is the method I
 like most at the moment...

 We have demo, development, production and load testing environments.
 The method of deploying new applications does not differ between
 environment, except for the different parameters that download the
 applications. I also want to implement sequential implementation in
 production at a later stage. We have a number of different
 applications but all of them use the same deployment technique.

 I am unsure how I should be mapping this out with roles etc on my
 tasks, I want all roles to be able to run task A but I don't want task
 A to run for all roles when I don't specify the environment.

 I guess multistage could be used here and defining stages in the
 following way:
 Demo-AppA
 Demo-AppB
 Prod-AppA
 Prod-AppB
 etc...

 I like the fact that multstage will prompt you if you don't specify a
 environment which makes a lot safer for me.

 Generally applications run on a dedicated server but there will be
 some server sharing between applications.

 I would appreciate any thoughts, tips, caveats or source examples.
 This email is also serving as a way for me to formalize my thoughts a
 bit more.

 Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Multistage in capistrano

2009-01-23 Thread Gerhardus Geldenhuis

Hi Lee,
To be perfectly frank not very far.

I don't know how to incorporate multistage in my application. Unless
the stages you define correspond to roles defined and the the task
gets executed automatically against that role.

Regards

On Jan 23, 4:32 pm, Lee Hambley lee.hamb...@gmail.com wrote:
 Hi Gerhardus,
   Where are you upto so far?

 - Lee

 2009/1/23 Gerhardus Geldenhuis gerhardus.geldenh...@gmail.com



  Hi am reading through the archives at the moment and am missing some
  good examples of how to actually use multistage.

  I realized that I have no idea what to do further other defining my
  stages.

  Regards

  On Jan 23, 3:12 pm, Gerhardus Geldenhuis
  gerhardus.geldenh...@gmail.com wrote:
   Hi
   I have been doing some reading about how to implement multistaging but
   I am not sure which route I should be following. I would really
   appreciate some advice/thoughts.

   I have found Multistage:
 http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage

   and another possible methodhttp://www.egtheblog.com/?p=thatjust sets a
  env variable and then
   sets your server list based on this variable. This is the method I
   like most at the moment...

   We have demo, development, production and load testing environments.
   The method of deploying new applications does not differ between
   environment, except for the different parameters that download the
   applications. I also want to implement sequential implementation in
   production at a later stage. We have a number of different
   applications but all of them use the same deployment technique.

   I am unsure how I should be mapping this out with roles etc on my
   tasks, I want all roles to be able to run task A but I don't want task
   A to run for all roles when I don't specify the environment.

   I guess multistage could be used here and defining stages in the
   following way:
   Demo-AppA
   Demo-AppB
   Prod-AppA
   Prod-AppB
   etc...

   I like the fact that multstage will prompt you if you don't specify a
   environment which makes a lot safer for me.

   Generally applications run on a dedicated server but there will be
   some server sharing between applications.

   I would appreciate any thoughts, tips, caveats or source examples.
   This email is also serving as a way for me to formalize my thoughts a
   bit more.

   Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: exit status and task success

2009-01-22 Thread Gerhardus Geldenhuis

Hi
Thanks for all the answers.

What I was unclear about is the relationship between the unix command
line exit status and the success status of the task. It now seems
clear that if the the command succeeds the task succeeds and vice
versa.

This leads me on to another question. Should you generally encapsulate
only one external command in a capistrano task, or can I have an if
statement in my task that acts on the success/failure(true/false) of
the command line.  I will illustrate by a simple example.

 if run dosomething then do task1
 else first do task 2

and to clarify what I meant in my previous email I would also like to
do the following:
task
  result = (run command)
  if result = 'a piece of string' then fail task immediatly to trigger
rollback
end

Regards

On Jan 21, 6:07 pm, Jamis Buck ja...@37signals.com wrote:
 What Rafael said, except if you're rescuing the exception you should be
 able to leave off the :on_error = :continue bit.

 Also, to force a task to succeed or fail...I assume you mean run()? Or
 do you really mean task()?

 To force a run command to succeed, just append ; true to the end of
 the command:

   run something that might fail; true

 Likewise, to make it fail, just append ; false to the end:

   run something that must fail; false

 (That's not Capistrano magic, that's *nix. Most (all?) unices come with
 'true' and 'false' commands. The 'true' command does nothing except exit
 with a status code of 0. The 'false' command does nothing except exit
 with a status code of 1.)

 - Jamis

 On 1/21/09 10:42 AM, Rafael G. wrote:

  Gerhardus Geldenhuis wrote:
  Hi
  Is there a way to run different tasks based on the exit status of a
  run command? Also how can I force a task to fail or succeed, how is
  the failure/success of a task determined/defined.

  Regards

  You can write a task with :on_error set to :continue and then catch the
  exception, I never done it, the idea is:
    task :foo, :on_error = :continue do
      begin
        run important task
      rescue Exception = error
        puts Important task fail!!: #{error}
        foo.task_if_foo_fail
      end
    end
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Capistrano vs Puppet

2009-01-22 Thread Gerhardus Geldenhuis

Hi
vs might be a bit of a controversial term. I am really interested in
peoples opinions about the overlapping or symbiotic relationship
between capistrano and puppet. If you are using both tools, could you
expand on the relationship between the tools in your usage of them?

I have some thoughts on the subject but have on purpose not shared the
immediately as I feel that would be a leading question. :-)

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] RFC on script

2009-01-22 Thread Gerhardus Geldenhuis

Hi
I have written the following script to monitor succesfull startup of
our webapp:
I am trying every second to get a webpage but also have a timeout
which will fail the task after 60 seconds.

task :monitor_app_startup, :roles = :testct do
  run -CMD
for ((n=0; n61; n++ )); do
  if wget localhost:8080/gta/buildInfo.jsp --quiet -O - --connect-
timeout=1 --timeout=1 --tries=1 | grep -q Build Information; then
exit 0
  elif [ $n -eq 60 ]; then exit 1;
  fi;
  sleep 1;
done
  CMD
end

I would appreciate any feedback or suggestions to improve this or do
it differently.

Also if the task fails the error message looks something like this:

failed: sh -c \for ((n=0; n61; n++ )); do\n  if wget
localhost:8080/gta/buildInfo.jsp --quiet -O - --connect-timeout=1 --
timeout=1 --tries=1 | grep -q \\\Build rrInformation\\\; then exit
0;\n  elif [ \\$n -eq 5 ]; then exit 1;\n  fi;
\n  sleep 1;\ndone\ on longtct03g
[

which is very ugly. Is there a way to override the failure message for
a task?

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: RFC on script

2009-01-22 Thread Gerhardus Geldenhuis

Thanks,
I will need to look into wget's retry logic and all the relevant
parameters. It will certainly make things a lot cleaner.

I don't understand why you suggest not to fail with exit 1. The task
has failed. The plan is that I want to later on implement rollback
logic and then I need the task to fail to trigger the rollback logic.

I am also unsure about where you meant me to put the [puts fail]
statement. Surely it must be in a if statement of some sorts otherwise
it would just print fail regardless of whether it worked or not.

Regards

On Jan 22, 3:30 pm, Mike Bailey m...@bailey.net.au wrote:
 Always exit with 0. Errors are ugly. Just puts 'fail' instead.

 You can put the retry logic into the wget command.

 - Mike

 maculike2:~ mbailey$ if wget --tries=1 --wait=1 --connect-timeout=1
 --timeout=1 --quiethttp://localhost:8080/;then echo 'success'; else echo
 'fail'; fi;
 fail
 maculike2:~ mbailey$ if wget --tries=1 --wait=1 --connect-timeout=1
 --timeout=1 --quiethttp://www.google.com/;then echo 'success'; else echo
 'fail'; fi;
 success

 On Fri, Jan 23, 2009 at 2:13 AM, Gerhardus Geldenhuis 

 gerhardus.geldenh...@gmail.com wrote:

  Hi
  I have written the following script to monitor succesfull startup of
  our webapp:
  I am trying every second to get a webpage but also have a timeout
  which will fail the task after 60 seconds.

  task :monitor_app_startup, :roles = :testct do
   run -CMD
     for ((n=0; n61; n++ )); do
       if wget localhost:8080/gta/buildInfo.jsp --quiet -O - --connect-
  timeout=1 --timeout=1 --tries=1 | grep -q Build Information; then
  exit 0
       elif [ $n -eq 60 ]; then exit 1;
       fi;
       sleep 1;
     done
   CMD
  end

  I would appreciate any feedback or suggestions to improve this or do
  it differently.

  Also if the task fails the error message looks something like this:

  failed: sh -c \for ((n=0; n61; n++ )); do\n      if wget
  localhost:8080/gta/buildInfo.jsp --quiet -O - --connect-timeout=1 --
  timeout=1 --tries=1 | grep -q \\\Build rrInformation\\\; then exit
  0;\n      elif [ \\$n -eq 5 ]; then exit 1;\n      fi;
  \n      sleep 1;\n    done\ on longtct03g
  [

  which is very ugly. Is there a way to override the failure message for
  a task?

  Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: RFC on script

2009-01-22 Thread Gerhardus Geldenhuis

Thanks,
I need to configure wget that it does not try 60 times in one second
but that is just some man page reading.

My confusions were that I was assuming that capistrano would handle
exit 1 statements and not fail completely.

Regards

On Jan 22, 3:56 pm, Mike Bailey m...@bailey.net.au wrote:
 For 60 retries use:

 if wget --tries=60 --wait=1 --connect-timeout=1 --timeout=1 
 --quiethttp://localhost:8080/;then echo 'success'; else echo 'fail'; fi; exit  0

 I don't understand why you suggest not to fail with exit 1. The task

  has failed. The plan is that I want to later on implement rollback
  logic and then I need the task to fail to trigger the rollback logic.

 exiting on anything but 0 halts capistrano.



  I am also unsure about where you meant me to put the [puts fail]
  statement. Surely it must be in a if statement of some sorts otherwise
  it would just print fail regardless of whether it worked or not.

 Sorry, I'm a bit sleepy. The shell command above is echoing success or fail.

 - Mike
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: exit status and task success

2009-01-22 Thread Gerhardus Geldenhuis

On Jan 22, 4:08 pm, Jamis Buck ja...@37signals.com wrote:
 The run() command does not return success/failure. If it succeeds, it
 returns. If it fails, it raises an exception.

 To get the result of a command, you can use the capture() method:

  http://wiki.capify.org/article/Capture

 Note, though, that it runs the command only on a single host, so if you
 want the output of multiple hosts, you'll need to use run() and give it
 a block, so you can process the output yourself:

  http://wiki.capify.org/article/Run

 To answer your question about one-command-per-task, you can definitely
 put as many commands in as you want. As for conditionally running
 commands, you can do that in a few ways.

 First, if you have really complex conditional logic, it might be best to
 put the entire task in a shell and run the script from capistrano, a la:

   task :do_something_hard do
     run my_script
   end

I am in two minds about this. I want as little as possible scripts
on my servers. I believe that all/most logic should sit on
management server. This also makes building new boxes more simple.
On the other hand one can just just capistrano to distribute the
scripts or whichever other tool.


 And my_script could either be shell script, or ruby, whichever floats
 your boat.

 Alternatively, for simpler needs, you can use shell if conditions
 directly in capistrano:

   run if [ some_command ]; then other_command; else last_command; fi

 However, it's really not feasible to test the run() command itself (via
 exception rescuing, etc.) because just because the command fails on one
 server, doesn't mean it failed on all servers. Consider:

   begin
     run something that might fail
   rescue Exception
     run something assuming the first failed
   end

 If you run this task against more than one server, then it could be that
 one server fails while the others succeed. In that event, an exception
 would still be raised, resulting in the second run() being executed
 against ALL SERVERS, not just the one(s) that failed.

 Hope that makes sense,

It does now. :-)
One needs to remember that a task executed against a group of servers
will be considered a single entity eg I create a directory on my
test servers. if one fails then the task evaluate false in a true
statement, but if you have exception handling then the individual
server would still be taking care off.

Regards

--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: How to deploy to a single specific server using Capistrano

2009-01-22 Thread Gerhardus Geldenhuis

That is brilliant clear, thanks.

Basically defining a task with a role safeguards you against using the
task on a server where it would'nt make any sense.

I have been thinking of tasks as a bit more abstract. For me copy
files to a apache server is a generic task but specific to webservers.
However my server list is not static and might change 3 times a day
and I have found it strange to include my server lists as part of my
capistrano program. I guess you can import an external file that
contains a list of servers and dynamically build your role members. It
boils down to how you use capistrano.

Regards

On Jan 22, 4:14 pm, Jamis Buck ja...@37signals.com wrote:
 On 1/22/09 4:12 AM, Gerhardus Geldenhuis wrote:

  I have found this very usefull, however I do not understand the
  difference between HOSTS and HOSTFILTER. It would be great if you
  could explain it from another angle

 I'll give it another try. Consider this concrete example. Suppose your
 script defines three servers, A, B, and C. And it defines a task, foo,
 that (by default) wants to run on A and B, but not C. Like this:

   role :app, A, B
   role :web, C

   task :foo, :roles = :app do
     run echo hello
   end

 Now, if you do cap foo, it will run the echo command on both A and B.

 If you do cap HOSTS=C foo, it will run the echo command on C,
 regardless of the :roles parameter to the task.

 If you do cap HOSTFILTER=C foo, it will not run the echo command at
 all, because the intersection of (A B) and (C) is an empty set. (There
 are no hosts in foo's host list that match C.)

 If you do cap HOSTFILTER=A foo, it will run the echo command on only
 A, because (A B) intersected with (A) is (A).

 Lastly, if you do cap HOSTFILTER=A,B,C foo, it will run the echo
 command on A and B (but not C), because (A B) intersected with (A B C)
 is (A B).

 To summarize: HOSTS completely overrides the hosts or roles declaration
 of the task, and forces everything to run against the specified host(s).
 The HOSTFILTER, on the other hand, simply filters the existing hosts
 against the given list, choosing only those servers that are already in
 the tasks server list.

 Hope that's clearer,

 Jamis



  Regards

  On Jan 21, 5:03 pm, Jamis Buck ja...@37signals.com wrote:
  Try the HOSTS environment variable:

    cap HOSTS=app2.example.com production deploy

  Note that doing this will treat app2 as being in every role, not just
  whichever role(s) it happens to be declared in.

  If what you want is to do a regular deploy, but only act on app2, and
  only as app2 is declared in your recipe file, you can use the HOSTFILTER
  variable instead:

    cap HOSTFILTER=app2.example.com production deploy

  Sorry if the distinction isn't clear there. Let me know if you need more
  clarification as to the difference between HOSTS and HOSTFILTER.

  - Jamis

  On 1/21/09 9:54 AM, Pete Hodgson wrote:

  Hi Folks,
  I have a system in production that has several servers in serveral
  roles. I would like to test a new app server by deploying to that
  specific server, without having to redeploy to every server in
  production. Is there a way to ask Capistrano to deploy to a specific
  server? Ideally I'd like to be able to run something like cap
  SERVER=app2.example.com ROLE=app production deploy if I just wanted to
  deploy to app2.example.com.
  I original posted this question on Stack Overflow a few days back [1]
  and got a few answers, but neither solution seemed to work for me.
  Hope it's not bad form to now post here.
  Cheers,
  Pete
  [1]http://stackoverflow.com/questions/429816/how-to-deploy-to-a-single-s...
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: RFC on script

2009-01-22 Thread Gerhardus Geldenhuis

Hi
This is not really capistrano related anymore but I thought it
worthwhile to mention for anyone following the thread.

I have tried a number of wget flags:
wget longtct03g:8080/gta/buildInfo.jsp  -O - --connect-timeout=1 --
timeout=1 --tries=60 --wait=1 --waitretry=10 --retry-connrefused

Resolving longtct03g... 10.200.31.17
Connecting to longtct03g|10.200.31.17|:8080... connected.
HTTP request sent, awaiting response... 400 Bad Request
17:20:40 ERROR 400: Bad Request.

However because the tomcat application is not available you will get a
Bad Request on which wget will fail immediatly. I thus still need to
encapsulate the wget in my own loop. I would have loved to simplify my
script but the external loop is still needed.

Regards

On Jan 22, 3:56 pm, Mike Bailey m...@bailey.net.au wrote:
 For 60 retries use:

 if wget --tries=60 --wait=1 --connect-timeout=1 --timeout=1 
 --quiethttp://localhost:8080/;then echo 'success'; else echo 'fail'; fi; exit  0

 I don't understand why you suggest not to fail with exit 1. The task

  has failed. The plan is that I want to later on implement rollback
  logic and then I need the task to fail to trigger the rollback logic.

 exiting on anything but 0 halts capistrano.



  I am also unsure about where you meant me to put the [puts fail]
  statement. Surely it must be in a if statement of some sorts otherwise
  it would just print fail regardless of whether it worked or not.

 Sorry, I'm a bit sleepy. The shell command above is echoing success or fail.

 - Mike
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] role/host variable

2009-01-21 Thread Gerhardus Geldenhuis

Hi
Is there a variable that I can access to get the name of each server
in the role?

I want to do something like the following:

task :idfile, :roles = :testtct do
  run touch /tmp/#{testtct.name}
end

Regards


--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] exit status and task success

2009-01-21 Thread Gerhardus Geldenhuis

Hi
Is there a way to run different tasks based on the exit status of a
run command? Also how can I force a task to fail or succeed, how is
the failure/success of a task determined/defined.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] CLI.ui.ask does not prompt

2009-01-19 Thread Gerhardus Geldenhuis

Hi
I can't get the following code snippet to work.

task :promptme, :roles = :gg do
  set(:user) { Capistrano::CLI.ui.ask(User name: ) }
end

I expected it to prompt me on the command line when running cap
promptme but it does not prompt me at all.

cap promptme
  * executing `promptme'

When running the command it just exits immediately.

Any ideas?

Best Regards





--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] problem with cat /etc/passwd do |ch, stream, data|

2009-01-15 Thread Gerhardus Geldenhuis

Hi
I saw the following code on 
http://blog.innerewut.de/2007/9/28/capturing-output-in-capistrano
and thought it was capistrano

run cat /etc/passwd  do |ch, stream, data|
  if stream == :err
logger.debug capured output on STDERR: #{data}
  else # stream == :out
logger.debug capured output on STDOUT: #{data}
  end
end

but I get a syntax error when trying to run it as a task.
capfile:53:in `load': compile error (SyntaxError)
capfile:53: syntax errorfrom /usr/lib/ruby/gems/1.8/gems/
capistrano-2.5.3/lib/capistrano/configuration/loading.rb:172:in
`load_from_file'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:64:in `load_recipes'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:64:in `each'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:64:in `load_recipes'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:30:in `execute!'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/lib/
capistrano/cli/execute.rb:14:in `execute'
from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.3/bin/cap:4
from /usr/bin/cap:16:in `load'
from /usr/bin/cap:16

Is this ruby code I am trying to run or is there something I am doing
wrong?

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Waiting for tasks and tailing files

2009-01-14 Thread Gerhardus Geldenhuis

Hi
I am writing a task that undeploys our application in tomcat.

Normally if we do it by hand we remove the war file and then watch the
tomcat webapp directory for the automatic deletion of the application
directory.

I would appreciate advice on the best way to achieve something similar
like this in capistrano. We have a bunch of bash scripts but I don't
want to distribute bash scripts around if I can do it in caps.

We also tail -f the tomcat log and check for a certain string. Any
suggestions to achieve something similar in capistrano.

I also want to achieve something like the following:
if directory successfully deleted or 60 seconds pass
then do something.

Regards
--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] is if cpu x part of capistrano

2009-01-08 Thread Gerhardus Geldenhuis

Hi
I have emailed this from my gmail account earlier but did not see the
message appear on the group. Apologies if it is double posted.


I have been going through same of the example scripts on the mailing
list page and came acrross this.


Its just an extract from:

http://groups.google.com/group/capistrano/web/useful-recipies---monit


Monit scripts

ferret.monitrc:

  check process ferret with pidfile /www/application/current/log/
ferret.pid

start program = /bin/su -c 'cd /www/application/current/ 
RAILS_ENV=development FERRET_USE_LOCAL_INDEX=1 script/ferret_start'
nobody

stop program = /bin/su -c 'cd /www/application/current/ 
RAILS_ENV=development FERRET_USE_LOCAL_INDEX=1 script/ferret_stop'
nobody

 # cpu usage boundaries

if cpu  60% for 2 cycles then alert

if cpu  90% for 5 cycles then restart



It looks VERY cool but being new to capistrano I am not sure whether
this is part of capistrano. The bits that interested me was the cpu if
statement. Could someone confirm whether this is capistrano and if so
explain the definition of cycles in this context.


Many Regards

--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: is if cpu x part of capistrano

2009-01-08 Thread Gerhardus Geldenhuis
Thanks, do you have a url that you could point me to? I am having difficulty
finding it on google. The name is a bit generic.
Regards

On Thu, Jan 8, 2009 at 2:43 PM, Jonathan Weiss j...@innerewut.de wrote:



   # cpu usage boundaries
 
  if cpu  60% for 2 cycles then alert
 
  if cpu  90% for 5 cycles then restart
 
 
 
  It looks VERY cool but being new to capistrano I am not sure whether
  this is part of capistrano. The bits that interested me was the cpu if
  statement. Could someone confirm whether this is capistrano and if so
  explain the definition of cycles in this context.

 This is not part of Capistrano but is a Monit configuration file.

 Monit is a process level monitoring tool that can react to resource
 consumption.

 Jonathan

 --
 Jonathan Weiss
 http://blog.innerewut.de
 http://twitter.com/jweiss

 



-- 
Gerhardus Geldenhuis
Registered Linux User #193352

--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---