Class: Kamal::Cli::Traefik
- Inherits:
-
Base
- Object
- Thor
- Base
- Kamal::Cli::Traefik
show all
- Defined in:
- lib/kamal/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/kamal/cli/traefik.rb', line 3
def boot
mutating do
on(KAMAL.traefik_hosts) do
execute *KAMAL.registry.login
execute *KAMAL.traefik.start_or_run
end
end
end
|
#details ⇒ Object
61
62
63
|
# File 'lib/kamal/cli/traefik.rb', line 61
def details
on(KAMAL.traefik_hosts) { |host| puts_by_host host, capture_with_info(*KAMAL.traefik.info), type: "Traefik" }
end
|
#logs ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/kamal/cli/traefik.rb', line 70
def logs
grep = options[:grep]
if options[:follow]
run_locally do
info "Following logs on #{KAMAL.primary_host}..."
info KAMAL.traefik.follow_logs(host: KAMAL.primary_host, grep: grep)
exec KAMAL.traefik.follow_logs(host: KAMAL.primary_host, grep: grep)
end
else
since = options[:since]
lines = options[:lines].presence || ((since || grep) ? nil : 100)
on(KAMAL.traefik_hosts) do |host|
puts_by_host host, capture(*KAMAL.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
25
26
27
28
29
30
|
# File 'lib/kamal/cli/traefik.rb', line 14
def reboot
mutating do
host_groups = options[:rolling] ? KAMAL.traefik_hosts : [KAMAL.traefik_hosts]
host_groups.each do |hosts|
host_list = Array(hosts).join(",")
run_hook "pre-traefik-reboot", hosts: host_list
on(hosts) do
execute *KAMAL.auditor.record("Rebooted traefik"), verbosity: :debug
execute *KAMAL.registry.login
execute *KAMAL.traefik.stop
execute *KAMAL.traefik.remove_container
execute *KAMAL.traefik.run
end
run_hook "post-traefik-reboot", hosts: host_list
end
end
end
|
#remove ⇒ Object
90
91
92
93
94
95
96
|
# File 'lib/kamal/cli/traefik.rb', line 90
def remove
mutating do
stop
remove_container
remove_image
end
end
|
#remove_container ⇒ Object
99
100
101
102
103
104
105
106
|
# File 'lib/kamal/cli/traefik.rb', line 99
def remove_container
mutating do
on(KAMAL.traefik_hosts) do
execute *KAMAL.auditor.record("Removed traefik container"), verbosity: :debug
execute *KAMAL.traefik.remove_container
end
end
end
|
#remove_image ⇒ Object
109
110
111
112
113
114
115
116
|
# File 'lib/kamal/cli/traefik.rb', line 109
def remove_image
mutating do
on(KAMAL.traefik_hosts) do
execute *KAMAL.auditor.record("Removed traefik image"), verbosity: :debug
execute *KAMAL.traefik.remove_image
end
end
end
|
#restart ⇒ Object
53
54
55
56
57
58
|
# File 'lib/kamal/cli/traefik.rb', line 53
def restart
mutating do
stop
start
end
end
|
#start ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/kamal/cli/traefik.rb', line 33
def start
mutating do
on(KAMAL.traefik_hosts) do
execute *KAMAL.auditor.record("Started traefik"), verbosity: :debug
execute *KAMAL.traefik.start
end
end
end
|
#stop ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'lib/kamal/cli/traefik.rb', line 43
def stop
mutating do
on(KAMAL.traefik_hosts) do
execute *KAMAL.auditor.record("Stopped traefik"), verbosity: :debug
execute *KAMAL.traefik.stop
end
end
end
|