class Pvcglue::Packages::Web

Public Instance Methods

install!() click to toggle source
# File lib/pvcglue/packages/web.rb, line 9
def install!
  Pvcglue::Packages::DirBase.apply(minion)
  Pvcglue::Packages::DirShared.apply(minion)
  Pvcglue::Packages::Rvm.apply(minion)
  Pvcglue::Packages::Ruby.apply(minion)
  Pvcglue::Packages::Bundler.apply(minion)
  Pvcglue::Packages::Secrets.apply(minion)
  connection.write_to_file_from_template(:root, 'web.nginx.conf.erb', '/etc/nginx/nginx.conf')

  set_passenger_ruby # needs to be set before rendering 'web.sites-enabled.erb'
  connection.write_to_file_from_template(:root, 'web.sites-enabled.erb', "/etc/nginx/sites-enabled/#{Pvcglue.cloud.app_and_stage_name}")


end
installed?() click to toggle source
# File lib/pvcglue/packages/web.rb, line 5
def installed?
  false
end
post_install_check?() click to toggle source
# File lib/pvcglue/packages/web.rb, line 24
def post_install_check?
  result = connection.run_get_stdout(:root, '', 'service nginx restart')
  if $?.exitstatus == 0
    # Pvcglue.logger.debug { result }
    true
  else
    Pvcglue.logger.error { 'Unable to (re)start nginx.  Getting status...' }
    result = connection.run_get_stdout(:root, '', 'systemctl status nginx.service')
    puts result
    false
  end

  # TODO:  Ping the server as a double check.
end
set_passenger_ruby() click to toggle source
# File lib/pvcglue/packages/web.rb, line 39
def set_passenger_ruby
  # info = connection.run_get_stdout!(user_name, '', "rvm use #{Pvcglue.configuration.ruby_version} && $(which passenger-config) --ruby-command")
  info = connection.run_get_stdout!(user_name, '', "rvm use #{Pvcglue.configuration.ruby_version} && passenger-config about ruby-command")
  if info =~ /passenger_ruby (.*)/
    Pvcglue.cloud.passenger_ruby = $1
  else
    raise "'passenger_ruby' not found." unless Pvcglue.cloud.passenger_ruby
  end

end