Class: Sunshine::Apache
- Defined in:
- lib/sunshine/daemons/apache.rb
Overview
A wrapper for configuring the apache2 server. Note: Due to Apache default limitations, the @connections attribute defaults to 256.
Note: The minimum timeout supported by Apache is 1 second.
Constant Summary
Constants inherited from Daemon
Daemon::RESTART_FAILED_CODE, Daemon::START_FAILED_CODE, Daemon::STATUS_DOWN_CODE, Daemon::STOP_FAILED_CODE
Instance Attribute Summary collapse
-
#rails_base_uri ⇒ Object
Returns the value of attribute rails_base_uri.
Attributes inherited from Server
#cluster, #connections, #port, #server_name, #sigkill, #target
Attributes inherited from Daemon
#app, #bin, #config_file, #config_path, #config_template, #name, #pid, #processes, #restart_cmd, #server_apps, #status_cmd, #stop_cmd, #sudo, #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, new_cluster, passenger_root, #supports_passenger?, #supports_rack?, #use_passenger?
Methods inherited from Daemon
#_restart_cmd, #_start_cmd, #_status_cmd, #_stop_cmd, binder_methods, #chown_log_files, #config_binding, #config_file_path, #config_template_files, #configure_remote_dirs, #each_server_app, #exit_on_failure, #has_setup?, #log_file, #log_files, #pick_sudo, #register_after_user_script, #restart, short_name, #start, #status, #stop, underscore, #upload_config_files
Constructor Details
#initialize(app, options = {}) ⇒ Apache
Returns a new instance of Apache.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sunshine/daemons/apache.rb', line 14 def initialize app, ={} super @bin = [:bin] || 'apache2ctl' @sigkill = 'WINCH' @supports_rack = false @supports_passenger = true @connections = [:connections] || 256 @rails_base_uri = [:rails_base_uri] @timeout = 1 if @timeout < 1 @dep_name = [:dep_name] || use_passenger? ? 'passenger-apache' : 'apache2' end |
Instance Attribute Details
#rails_base_uri ⇒ Object
Returns the value of attribute rails_base_uri.
12 13 14 |
# File 'lib/sunshine/daemons/apache.rb', line 12 def rails_base_uri @rails_base_uri end |
Instance Method Details
#setup ⇒ Object
40 41 42 43 44 45 |
# File 'lib/sunshine/daemons/apache.rb', line 40 def setup super do |server_app, binder| binder.set :rails_base_uri, @rails_base_uri yield(server_app, binder) if block_given? end end |
#start_cmd ⇒ Object
35 36 37 |
# File 'lib/sunshine/daemons/apache.rb', line 35 def start_cmd "#{@bin} -f #{self.config_file_path} -E #{log_file :stderr}" end |