module Luban::Deployment::Applications::Rack::WebServers::Thin::Common

Public Instance Methods

default_web_server_options() click to toggle source
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 88
def default_web_server_options
  @default_web_server_options ||= {
    # Server options
    address: "127.0.0.1",
    port: port + 1,
    socket: socket_file_path.to_s,
    chdir: release_path.to_s,
    environment: stage,
    # Daemon options
    daemonize: !dockerized?,
    log: log_file_path.to_s,
    pid: pid_file_path.to_s,
    tag: "#{env_name}:#{release_tag}",
    # Cluster options
    servers: 2,
    wait: 30,
    # Tuning options
    timeout: 30,
    max_conns: 1024,
    max_persistent_conns: 100,
    # Common options
    trace: true
  }
end
process_pattern() click to toggle source
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 128
def process_pattern
  @process_pattern ||= "^thin server.+\\[#{Regexp.escape(env_name)}:.*\\]"
end
start_command() click to toggle source
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 120
def start_command
  @start_command ||= bundle_command("#{thin_command} start")
end
stop_command() click to toggle source
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 124
def stop_command
  @stop_command ||= bundle_command("#{thin_command} stop")
end
tcp_socket?() click to toggle source
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 113
def tcp_socket?; @tcp_socket; end
thin_command() click to toggle source
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 116
def thin_command
  @thin_command ||= "thin -C #{control_file_path}"
end
unix_socket?() click to toggle source
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 114
def unix_socket?; @unix_socket; end

Protected Instance Methods

init_docker_command() click to toggle source
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 134
def init_docker_command
  docker_command ["bundle", "exec", "thin", "start", "-C", control_file_path.to_s]
end
set_web_server_options() click to toggle source
Calls superclass method
# File lib/luban/deployment/applications/rack/web_servers/thin.rb, line 138
def set_web_server_options
  super.tap do |opts|
    @unix_socket = !!opts.delete(:unix_socket)
    @tcp_socket = !@unix_socket
    if unix_socket?
      opts.delete(:address)
      opts.delete(:port)
    else
      opts.delete(:socket)
    end
    if dockerized?
      opts.delete(:servers)
      opts.delete(:wait)
    end
  end
end