Class: Sunshine::Apache
- Defined in:
- lib/sunshine/daemons/apache.rb
Overview
A wrapper for configuring the apache2 server.
Instance Attribute Summary
Attributes inherited from Server
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
-
#initialize(app, options = {}) ⇒ Apache
constructor
A new instance of Apache.
- #setup ⇒ Object
- #start_cmd ⇒ Object
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, ={} super @bin = [:bin] || 'apachectl' @sudo = [:sudo] || @port < 1024 @sigkill = 'WINCH' # TODO: have a separate max_clients and processes @max_clients = [:max_clients] || [:processes] || 128 @dep_name = [:dep_name] || use_passenger? ? 'passenger-apache' : 'apache2' end |
Instance Method Details
#setup ⇒ Object
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_cmd ⇒ Object
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 |