Class: Deploy::Puge

Inherits:
Object
  • Object
show all
Defined in:
lib/dew/models/deploy/puge.rb

Instance Method Summary collapse

Constructor Details

#initialize(servers, opts) ⇒ Puge

Returns a new instance of Puge.



5
6
7
8
# File 'lib/dew/models/deploy/puge.rb', line 5

def initialize servers, opts
  @servers = servers
  @opts = opts
end

Instance Method Details

#deployObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dew/models/deploy/puge.rb', line 10

def deploy
  execute_in_parallel_and_wait Proc.new { |server|
    Inform.info("%{server_id}: Cloning PUGE and checking out tag %{tag}", :server_id => server.id, :tag => @opts['tag'])
    upload_and_run(server, 'clone_puge.sh', @opts['tag'])

    Inform.info("%{server_id}: Running bundle install", :server_id => server.id)
    upload_and_run(server, 'bundle_install.sh')
  }

  # This task cannot run in parallel as there's only one RDS
  #
  Inform.info("%{server_id}: Setting up Rails database using %{rails_env} Rails environment", :server_id => @servers.first.id, :rails_env => @opts['rails_env'])
  upload_and_run(@servers.first, 'setup_rails_database.sh', @opts['rails_env'])

  execute_in_parallel_and_wait Proc.new { |server|
    Inform.info("%{server_id}: Generating PUGE WAR", :server_id => server.id)
    upload_and_run(server, 'generate_puge_war.sh', @opts['rails_env'])

    Inform.info("%{server_id}: Copying PUGE WAR into Tomcat directory", :server_id => server.id)
    upload_and_run(server, 'copy_puge_war_into_tomcat.sh')

    Inform.info("%{server_id}: Restarting Tomcat", :server_id => server.id)
    upload_and_run(server, 'restart_tomcat.sh')
  }
end