Module: Luban::Deployment::Applications::Rack::WebServers::Puma::Common

Included in:
Luban::Deployment::Applications::Rack::WebServers::Puma
Defined in:
lib/luban/deployment/applications/rack/web_servers/puma.rb

Instance Method Summary collapse

Instance Method Details

#control_socket_file_nameObject



55
56
57
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 55

def control_socket_file_name
  @control_socket_file_name ||= "#{current_web_server}ctl.sock"
end

#control_socket_file_pathObject



51
52
53
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 51

def control_socket_file_path
  @control_socket_file_path ||= sockets_path.join(control_socket_file_name)
end

#default_web_server_optionsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 8

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,
    directory: release_path.to_s,
    environment: stage,
    # Daemon options
    daemonize: true,
    pidfile: pid_file_path.to_s,
    state_path: state_file_path.to_s,
    redirect_stdout: log_file_path.to_s,
    redirect_stderr: error_log_file_path.to_s,
    redirect_append: true,
    quiet: false,
    tag: "#{env_name}:#{release_tag}",
    # Cluster options
    servers: 2,
    threads: "1:1",
    preload: false,
    prune_bundler: true,
    # Control app options
    control_socket: control_socket_file_path.to_s,
    control_opts: { auth_token: port.to_s }
  }
end

#error_log_file_pathObject



47
48
49
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 47

def error_log_file_path
  @error_log_file_path ||= log_path.join("#{current_web_server}_error.log")
end

#process_patternObject



71
72
73
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 71

def process_pattern
  @process_pattern ||= "^puma .+\\[#{Regexp.escape(env_name)}:.*\\]"
end

#puma_commandObject



59
60
61
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 59

def puma_command
  @puma_command ||= "pumactl -F #{control_file_path}"
end

#service_entryObject



75
76
77
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 75

def service_entry
  @serivce_entry ||= "#{super}.#{current_web_server}"
end

#start_commandObject



63
64
65
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 63

def start_command
  @start_command ||= bundle_command("#{puma_command} start")
end

#state_file_nameObject



43
44
45
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 43

def state_file_name
  @state_file_name ||= "#{current_web_server}.state"
end

#state_file_pathObject



39
40
41
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 39

def state_file_path
  @state_file_path ||= pids_path.join(state_file_name)
end

#stop_commandObject



67
68
69
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 67

def stop_command
  @stop_command ||= bundle_command("#{puma_command} stop")
end

#tcp_socket?Boolean

Returns:

  • (Boolean)


36
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 36

def tcp_socket?; @tcp_socket; end

#unix_socket?Boolean

Returns:

  • (Boolean)


37
# File 'lib/luban/deployment/applications/rack/web_servers/puma.rb', line 37

def unix_socket?; @unix_socket; end