Method: Cloudkeeper::Nginx::HttpServer#start

Defined in:
lib/cloudkeeper/nginx/http_server.rb

#start(image_file) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cloudkeeper/nginx/http_server.rb', line 17

def start(image_file)
  logger.debug 'Starting NGINX server'
  @access_data = {}
  credentials = prepare_credentials
  configuration = prepare_configuration File.dirname(image_file), File.basename(image_file)
  prepare_configuration_file configuration
  fill_access_data credentials, configuration

  Cloudkeeper::CommandExecutioner.execute Cloudkeeper::Settings[:'nginx-binary'],
                                          '-c', conf_file.path,
                                          '-p', Cloudkeeper::Settings[:'nginx-runtime-dir']
rescue Cloudkeeper::Errors::CommandExecutionError, ::IOError => ex
  stop
  raise Cloudkeeper::Errors::NginxError, ex
end