Sha256: 23f8217fa45d71af41eb6012feec371c8fc4def4abc06c5632900d2975955d95

Contents?: true

Size: 1.86 KB

Versions: 51

Compression:

Stored size: 1.86 KB

Contents

module Publisher
  class Tomcat
    attr_accessor :servers
    attr_accessor :runners
    attr_accessor :initd_script
    attr_accessor :application_name
    attr_accessor :catalina_home
    attr_accessor :tomcat_context
    attr_accessor :logfilename
    attr_accessor :check_host
    attr_accessor :worker

    def deploy(options={})
      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)
        if 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
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
depengine-3.0.0 lib/depengine/publisher/tomcat.rb
depengine-0.0.31 lib/depengine/publisher/tomcat.rb
depengine-0.0.30 lib/depengine/publisher/tomcat.rb
depengine-0.0.29 lib/depengine/publisher/tomcat.rb
depengine-0.0.28 lib/depengine/publisher/tomcat.rb
depengine-0.0.27 lib/depengine/publisher/tomcat.rb
depengine-0.0.26 lib/depengine/publisher/tomcat.rb
depengine-0.0.25 lib/depengine/publisher/tomcat.rb
depengine-0.0.24 lib/depengine/publisher/tomcat.rb
depengine-0.0.23 lib/depengine/publisher/tomcat.rb
depengine-0.0.22 lib/depengine/publisher/tomcat.rb
depengine-0.0.21 lib/depengine/publisher/tomcat.rb
depengine-0.0.20 lib/depengine/publisher/tomcat.rb
depengine-0.0.19 lib/depengine/publisher/tomcat.rb
depengine-0.0.18 lib/depengine/publisher/tomcat.rb
depengine-0.0.17 lib/depengine/publisher/tomcat.rb
depengine-0.0.16 lib/depengine/publisher/tomcat.rb
depengine-0.0.15 lib/depengine/publisher/tomcat.rb
depengine-0.0.14 lib/depengine/publisher/tomcat.rb
depengine-0.0.13 lib/depengine/publisher/tomcat.rb