Class: Indocker::ServerPools::DeployServerConnection

Inherits:
ServerConnection show all
Defined in:
lib/indocker/server_pools/deploy_server_connection.rb

Instance Attribute Summary

Attributes inherited from ServerConnection

#server, #session

Instance Method Summary collapse

Methods inherited from ServerConnection

#busy?, #close_session, #create_session!, #exec!, #initialize, #set_busy

Constructor Details

This class inherits a constructor from Indocker::ServerPools::ServerConnection

Instance Method Details

#run_container_remotely(configuration_name:, container_name:, force_restart:) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/indocker/server_pools/deploy_server_connection.rb', line 2

def run_container_remotely(configuration_name:, container_name:, force_restart:)
  command_output  = @logger.debug? ? "" : " > /dev/null"
  debug_options   = @logger.debug? ? "-d" : ""
  force_restart_options = force_restart ? "-f" : ""

  result = exec!(
    "cd #{Indocker::IndockerHelper.indocker_dir} && ./bin/remote/run -C #{configuration_name} -c #{container_name} #{debug_options} #{command_output} #{force_restart_options}"
  )

  Indocker::SshResultLogger
    .new(@logger)
    .log(result, "#{container_name.to_s.green} deployment for server #{server.name} failed")
  
  result
end