Class: Sunshine::Thin

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

Overview

Simple server wrapper for Thin setup and control. Thin is considered a backend server and therefore does not support the :point_to proxying option.

Note: Thin only supports a single log file. The default stdout file is used.

Note: Thin manipulates the passed pid filepath to: path/.[port].pid Sunshine::Thin will adjust the @pid attribute value accordingly.

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

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

Methods inherited from Server

binder_methods, new_cluster, passenger_root, #setup, #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, #setup, short_name, #start, #status, #stop, underscore, #upload_config_files

Constructor Details

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

Returns a new instance of Thin.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sunshine/daemons/thin.rb', line 16

def initialize app, options={}
  super

  @start_pid = @pid

  pid_name  = File.basename(@pid, ".pid")
  @pid      = File.join File.dirname(@pid), "#{pid_name}.#{@port}.pid"

  @timeout = options[:timeout] || 3

  @supports_rack = true
  @supports_passenger = false
end

Instance Method Details

#start_cmdObject



31
32
33
34
# File 'lib/sunshine/daemons/thin.rb', line 31

def start_cmd
  "cd #{@app.current_path} && "+
    "#{@bin} start -C #{self.config_file_path} -P #{@start_pid};"
end