Class: Tomo::Plugin::Puma::Tasks
Defined Under Namespace
Classes: SystemdUnit
Instance Method Summary
collapse
Methods inherited from TaskLibrary
#initialize
Instance Method Details
#check_active ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'lib/tomo/plugin/puma/tasks.rb', line 29
def check_active
logger.info "Checking if puma is active and listening on port #{port}..."
active = wait_until { dry_run? || (assert_active! && listening?) }
remote.run("systemctl", "--user", "status", service.name)
return if active
logger.warn "Timed out waiting for puma to respond on port #{port}"
end
|
#log ⇒ Object
39
40
41
|
# File 'lib/tomo/plugin/puma/tasks.rb', line 39
def log
remote.attach "journalctl", "-q", raw("--user-unit=#{service.name.shellescape}"), *settings[:run_args]
end
|
#restart ⇒ Object
24
25
26
27
|
# File 'lib/tomo/plugin/puma/tasks.rb', line 24
def restart
remote.run "systemctl", "--user", "start", socket.name
remote.run "systemctl", "--user", "restart", service.name
end
|
#setup_systemd ⇒ Object
rubocop:disable Metrics/AbcSize
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/tomo/plugin/puma/tasks.rb', line 7
def setup_systemd linger_must_be_enabled!
setup_directories
remote.write template: socket.template, to: socket.path
remote.write template: service.template, to: service.path
remote.run "systemctl --user daemon-reload"
remote.run "systemctl", "--user", "enable", service.name, socket.name
end
|
#tail_log ⇒ Object
43
44
45
|
# File 'lib/tomo/plugin/puma/tasks.rb', line 43
def tail_log
remote.attach "journalctl -q --user-unit=#{service.name.shellescape} -f"
end
|