Class: Mrsk::Cli::Traefik
- Inherits:
-
Base
- Object
- Thor
- Base
- Mrsk::Cli::Traefik
show all
- Defined in:
- lib/mrsk/cli/traefik.rb
Instance Method Summary
collapse
Methods inherited from Base
exit_on_failure?, #initialize
Instance Method Details
#boot ⇒ Object
3
4
5
6
7
|
# File 'lib/mrsk/cli/traefik.rb', line 3
def boot
with_lock do
on(MRSK.traefik_hosts) { execute *MRSK.traefik.run, raise_on_non_zero_exit: false }
end
end
|
#details ⇒ Object
47
48
49
|
# File 'lib/mrsk/cli/traefik.rb', line 47
def details
on(MRSK.traefik_hosts) { |host| puts_by_host host, capture_with_info(*MRSK.traefik.info), type: "Traefik" }
end
|
#logs ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/mrsk/cli/traefik.rb', line 56
def logs
grep = options[:grep]
if options[:follow]
run_locally do
info "Following logs on #{MRSK.primary_host}..."
info MRSK.traefik.follow_logs(host: MRSK.primary_host, grep: grep)
exec MRSK.traefik.follow_logs(host: MRSK.primary_host, grep: grep)
end
else
since = options[:since]
lines = options[:lines].presence || ((since || grep) ? nil : 100)
on(MRSK.traefik_hosts) do |host|
puts_by_host host, capture(*MRSK.traefik.logs(since: since, lines: lines, grep: grep)), type: "Traefik"
end
end
end
|
#reboot ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/mrsk/cli/traefik.rb', line 10
def reboot
with_lock do
stop
remove_container
boot
end
end
|
#remove ⇒ Object
76
77
78
79
80
81
82
|
# File 'lib/mrsk/cli/traefik.rb', line 76
def remove
with_lock do
stop
remove_container
remove_image
end
end
|
#remove_container ⇒ Object
85
86
87
88
89
90
91
92
|
# File 'lib/mrsk/cli/traefik.rb', line 85
def remove_container
with_lock do
on(MRSK.traefik_hosts) do
execute *MRSK.auditor.record("Removed traefik container"), verbosity: :debug
execute *MRSK.traefik.remove_container
end
end
end
|
#remove_image ⇒ Object
95
96
97
98
99
100
101
102
|
# File 'lib/mrsk/cli/traefik.rb', line 95
def remove_image
with_lock do
on(MRSK.traefik_hosts) do
execute *MRSK.auditor.record("Removed traefik image"), verbosity: :debug
execute *MRSK.traefik.remove_image
end
end
end
|
#restart ⇒ Object
39
40
41
42
43
44
|
# File 'lib/mrsk/cli/traefik.rb', line 39
def restart
with_lock do
stop
start
end
end
|
#start ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/mrsk/cli/traefik.rb', line 19
def start
with_lock do
on(MRSK.traefik_hosts) do
execute *MRSK.auditor.record("Started traefik"), verbosity: :debug
execute *MRSK.traefik.start, raise_on_non_zero_exit: false
end
end
end
|
#stop ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/mrsk/cli/traefik.rb', line 29
def stop
with_lock do
on(MRSK.traefik_hosts) do
execute *MRSK.auditor.record("Stopped traefik"), verbosity: :debug
execute *MRSK.traefik.stop, raise_on_non_zero_exit: false
end
end
end
|