Hi I am struggling to find a elegant solution for the following problem: We have multiple apache servers that load balance across the same set of tomcat app servers. Thus if you update an app server you have to disable it in multiple places.
My code: namespace :modjk do task :disablenode, :roles => :apacluster do run "wget --quiet -O - --connect-timeout=1 --timeout=1 --tries=1 'http://$CAPISTRANO:HOST$/jkserver-status?cmd=update&from=list&w=# {modjk_loadbalancergroup}&sw=#{current_tomcat}&wa=1&wf=1&wn=# {current_tomcat}&wr=&wc=&wd=0' 1>&2>/dev/null" # this does not work atm as I can't get the current_tomcat variable set end and in my stage file I have the following: role :appservers, "longtct02c", "longtct02d" role :apacluster, "longapa02c" #role :apacluster, "longapa02c", "longapa02d" set :app_type, "gta-jcbs-xml" set :modjk_loadbalancergroup, "xml-lb" set :test_url, "localhost:8080/gta-jcbs-xml/buildInfo.jsp" set :test_url_result_string, "Build Information" task :staggered_deploy do find_servers(:roles => :appservers).each do |server| run "uname -a", :hosts => server #just for id purposes. # A possible solution but can't get assignment to work yet. # set :current_tomcat, "$CAPISTRANO:HOST$" modjk.disablenode end end my logic was that when iterating through the list of servers I would just call disablenode which will then only run on the apacluster list of servers. This works great and keeps the code clean however I need to pass a parameter in my wget statement to enable to current tomcat node that I am looping through in the staggered_deploy task. My set statement does not work yet, I am trying to figure out the correct syntax, and when I get it working I am not sure it will behave as I expect by changing the variable everytime it loops. If there is a better way of approaching the problem I would appreciate any thoughts. The abbility to pass an parameter to a task would help a lot. Regards --~--~---------~--~----~------------~-------~--~----~ To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/capistrano -~----------~----~----~----~------~----~------~--~---
