Module: TorqueBox::RemoteDeployUtils

Defined in:
lib/torquebox/remote_deploy_utils.rb

Class Method Summary collapse

Class Method Details

.deploy(archive_file) ⇒ Object



22
23
24
25
26
27
# File 'lib/torquebox/remote_deploy_utils.rb', line 22

def deploy(archive_file)
  with_config(archive_file) do |config, app_name|
    scp_upload(config, archive_file, "#{config.jboss_home}/standalone/deployments/")
    do_deploy(config, app_name)
  end
end

.deploy_from_stage(archive_file) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/torquebox/remote_deploy_utils.rb', line 29

def deploy_from_stage(archive_file)
  with_config(archive_file) do |config, app_name|
    unless config.local
      ssh_exec(config, "cp #{config.torquebox_home}/stage/#{app_name}.knob #{config.jboss_home}/standalone/deployments")
    else
      scp_upload(config, archive_file, "#{config.jboss_home}/standalone/deployments/")
    end
    do_deploy(config, app_name)
  end
end

.exec_ruby(archive_file, cmd) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/torquebox/remote_deploy_utils.rb', line 52

def exec_ruby(archive_file, cmd)
  with_config(archive_file) do |config, app_name|
    unless config.local
      # TODO set RACK_ENV based on env var, and default to production
      ssh_exec(config, "cd #{config.torquebox_home}/stage/#{app_name}",
               "export PATH=$PATH:#{config.torquebox_home}/jruby/bin",
               "export RAILS_ENV=production",
               "export RACK_ENV=production",
               "#{config.torquebox_home}/jruby/bin/jruby -S #{cmd}")
    else
      # not sure what to do here yet
    end
  end
end

.stage(archive_file) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/torquebox/remote_deploy_utils.rb', line 10

def stage(archive_file)
  with_config(archive_file) do |config, app_name|
    # no need to stage if we are local. we'll just run from the app dir
    unless config.local
      cleanup_stage(config, archive_file, app_name)
      prepare_stage(config, app_name)
      stage_archive(config, archive_file)
      unjar_staged_archive(config, archive_file, app_name)
    end
  end
end

.undeploy(archive_file) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/torquebox/remote_deploy_utils.rb', line 40

def undeploy(archive_file)
  with_config(archive_file) do |config, app_name|
    unless config.local
      ssh_exec(config, "rm -f #{config.jboss_home}/standalone/deployments/#{app_name}-knob.yml*")
      ssh_exec(config, "rm -f #{config.jboss_home}/standalone/deployments/#{app_name}.knob")
    else
      FileUtils.rm("#{config.jboss_home}/standalone/deployments/#{app_name}-knob.yml*")
      FileUtils.rm("#{config.jboss_home}/standalone/deployments/#{app_name}.knob")
    end
  end
end