Class: Publisher::Tomcat
- Inherits:
-
Object
- Object
- Publisher::Tomcat
- Defined in:
- lib/depengine/publisher/tomcat.rb
Instance Attribute Summary collapse
-
#application_name ⇒ Object
Returns the value of attribute application_name.
-
#catalina_home ⇒ Object
Returns the value of attribute catalina_home.
-
#check_host ⇒ Object
Returns the value of attribute check_host.
-
#initd_script ⇒ Object
Returns the value of attribute initd_script.
-
#logfilename ⇒ Object
Returns the value of attribute logfilename.
-
#runners ⇒ Object
Returns the value of attribute runners.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#tomcat_context ⇒ Object
Returns the value of attribute tomcat_context.
-
#worker ⇒ Object
Returns the value of attribute worker.
Instance Method Summary collapse
Instance Attribute Details
#application_name ⇒ Object
Returns the value of attribute application_name.
6 7 8 |
# File 'lib/depengine/publisher/tomcat.rb', line 6 def application_name @application_name end |
#catalina_home ⇒ Object
Returns the value of attribute catalina_home.
7 8 9 |
# File 'lib/depengine/publisher/tomcat.rb', line 7 def catalina_home @catalina_home end |
#check_host ⇒ Object
Returns the value of attribute check_host.
10 11 12 |
# File 'lib/depengine/publisher/tomcat.rb', line 10 def check_host @check_host end |
#initd_script ⇒ Object
Returns the value of attribute initd_script.
5 6 7 |
# File 'lib/depengine/publisher/tomcat.rb', line 5 def initd_script @initd_script end |
#logfilename ⇒ Object
Returns the value of attribute logfilename.
9 10 11 |
# File 'lib/depengine/publisher/tomcat.rb', line 9 def logfilename @logfilename end |
#runners ⇒ Object
Returns the value of attribute runners.
4 5 6 |
# File 'lib/depengine/publisher/tomcat.rb', line 4 def runners @runners end |
#servers ⇒ Object
Returns the value of attribute servers.
3 4 5 |
# File 'lib/depengine/publisher/tomcat.rb', line 3 def servers @servers end |
#tomcat_context ⇒ Object
Returns the value of attribute tomcat_context.
8 9 10 |
# File 'lib/depengine/publisher/tomcat.rb', line 8 def tomcat_context @tomcat_context end |
#worker ⇒ Object
Returns the value of attribute worker.
11 12 13 |
# File 'lib/depengine/publisher/tomcat.rb', line 11 def worker @worker end |
Instance Method Details
#deploy(_options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/depengine/publisher/tomcat.rb', line 13 def deploy( = {}) Helper.validates_presence_of servers, 'servers not set' Helper.validates_presence_of runners, 'runners not set' Helper.validates_presence_of initd_script, 'initd_script not set' Helper.validates_presence_of application_name, 'application_name not set' Helper.validates_presence_of catalina_home, 'catalina_home not set' Helper.validates_presence_of tomcat_context, 'tomcat_context not set' Helper.validates_presence_of logfilename, 'logfilename not set' Helper.validates_presence_of check_host, 'check_host not set' servers.each do |server| $log.writer.info "========== Processing #{server}" is_runner = runners.include?(server) if is_runner $log.writer.info "Stopping tomcat on #{server}" stdout = worker.remote_execute("sudo #{initd_script} stop", remote_host: server) $log.writer.info stdout end $log.writer.info 'Deploying to webapp' worker.rsync("target/#{application_name}/", "#{catalina_home}/webapps/#{tomcat_context}", remote_host: server) next unless is_runner $log.writer.info "Starting tomcat on #{server}" stdout = worker.remote_execute("sudo #{initd_script} start", remote_host: server) $log.writer.info stdout stdout = worker.remote_execute("sleep 10; tail -50 #{catalina_home}/logs/#{logfilename}", remote_host: server) $log.writer.debug stdout worker.assert_url_response_of(check_host: check_host) end end |