Class: Sunshine::Apache

Inherits:
Server show all
Defined in:
lib/sunshine/daemons/apache.rb

Overview

A wrapper for configuring the apache2 server.

Instance Attribute Summary

Attributes inherited from Server

#port, #server_name, #sigkill

Attributes inherited from Daemon

#app, #bin, #config_file, #config_path, #config_template, #name, #pid, #processes, #restart_cmd, #server_apps, #status_cmd, #stop_cmd, #sudo, #target, #timeout

Instance Method Summary collapse

Methods inherited from Server

binder_methods, passenger_root, #stop_cmd, #supports_rack?, #use_passenger?

Methods inherited from Daemon

binder_methods, #config_file_path, #config_template_files, #each_server_app, #has_setup?, #log_file, #log_files, #restart, #start, #stop, underscore, #upload_config_files

Constructor Details

#initialize(app, options = {}) ⇒ Apache

Returns a new instance of Apache.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sunshine/daemons/apache.rb', line 8

def initialize app, options={}
  super

  @bin = options[:bin] || 'apachectl'

  @sudo = options[:sudo] || @port < 1024

  @sigkill = 'WINCH'

  # TODO: have a separate max_clients and processes
  @max_clients = options[:max_clients] || options[:processes] || 128

  @dep_name = options[:dep_name] ||
    use_passenger? ? 'passenger-apache' : 'apache2'
end

Instance Method Details

#setupObject



30
31
32
33
34
35
# File 'lib/sunshine/daemons/apache.rb', line 30

def setup
  super do |server_app, binder|
    binder.set :max_clients, @max_clients
    yield(server_app, binder) if block_given?
  end
end

#start_cmdObject



25
26
27
# File 'lib/sunshine/daemons/apache.rb', line 25

def start_cmd
  "#{@bin} -f #{self.config_file_path} -E #{log_file :stderr}"
end