Only run Traefik on web role

This commit is contained in:
David Heinemeier Hansson
2023-01-10 19:04:35 +01:00
parent 73b7c691d6
commit f9010c1b75

View File

@@ -6,17 +6,17 @@ namespace :mrsk do
namespace :traefik do
desc "Run Traefik on servers"
task :run do
on(MRSK_CONFIG.hosts) { execute *traefik.run, raise_on_non_zero_exit: false }
on(MRSK_CONFIG.role(:web).hosts) { execute *traefik.run, raise_on_non_zero_exit: false }
end
desc "Start existing Traefik on servers"
task :start do
on(MRSK_CONFIG.hosts) { execute *traefik.start, raise_on_non_zero_exit: false }
on(MRSK_CONFIG.role(:web).hosts) { execute *traefik.start, raise_on_non_zero_exit: false }
end
desc "Stop Traefik on servers"
task :stop do
on(MRSK_CONFIG.hosts) { execute *traefik.stop, raise_on_non_zero_exit: false }
on(MRSK_CONFIG.role(:web).hosts) { execute *traefik.stop, raise_on_non_zero_exit: false }
end
desc "Restart Traefik on servers"
@@ -24,12 +24,12 @@ namespace :mrsk do
desc "Display information about Traefik containers from servers"
task :info do
on(MRSK_CONFIG.hosts) { |host| puts "Traefik Host: #{host}\n" + capture(*traefik.info) + "\n\n" }
on(MRSK_CONFIG.role(:web).hosts) { |host| puts "Traefik Host: #{host}\n" + capture(*traefik.info) + "\n\n" }
end
desc "Remove Traefik container and image from servers"
task remove: %i[ stop ] do
on(MRSK_CONFIG.hosts) do
on(MRSK_CONFIG.role(:web).hosts) do
execute *traefik.remove_container
execute *traefik.remove_image
end