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
8
9
10
|
# File 'lib/mrsk/cli/traefik.rb', line 3
def boot
mutating do
on(MRSK.traefik_hosts) do
execute *MRSK.registry.login
execute *MRSK.traefik.run, raise_on_non_zero_exit: false
end
end
end
|
#details ⇒ Object
55
56
57
|
# File 'lib/mrsk/cli/traefik.rb', line 55
def details
on(MRSK.traefik_hosts) { |host| puts_by_host host, capture_with_info(*MRSK.traefik.info), type: "Traefik" }
end
|
#logs ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/mrsk/cli/traefik.rb', line 64
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
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/mrsk/cli/traefik.rb', line 14
def reboot
mutating do
on(MRSK.traefik_hosts, in: options[:rolling] ? :sequence : :parallel) do
execute *MRSK.auditor.record("Rebooted traefik"), verbosity: :debug
execute *MRSK.registry.login
execute *MRSK.traefik.stop, raise_on_non_zero_exit: false
execute *MRSK.traefik.remove_container
execute *MRSK.traefik.run, raise_on_non_zero_exit: false
end
end
end
|
#remove ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/mrsk/cli/traefik.rb', line 84
def remove
mutating do
stop
remove_container
remove_image
end
end
|
#remove_container ⇒ Object
93
94
95
96
97
98
99
100
|
# File 'lib/mrsk/cli/traefik.rb', line 93
def remove_container
mutating 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
103
104
105
106
107
108
109
110
|
# File 'lib/mrsk/cli/traefik.rb', line 103
def remove_image
mutating 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
47
48
49
50
51
52
|
# File 'lib/mrsk/cli/traefik.rb', line 47
def restart
mutating do
stop
start
end
end
|
#start ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/mrsk/cli/traefik.rb', line 27
def start
mutating 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
37
38
39
40
41
42
43
44
|
# File 'lib/mrsk/cli/traefik.rb', line 37
def stop
mutating 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
|