Switch to a Commander base to allow lazy loading config
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
require_relative "setup"
|
||||
|
||||
traefik = Mrsk::Commands::Traefik.new(MRSK_CONFIG)
|
||||
|
||||
namespace :mrsk do
|
||||
namespace :traefik do
|
||||
desc "Run Traefik on servers"
|
||||
task :run do
|
||||
on(MRSK_CONFIG.role(:web).hosts) { execute *traefik.run, raise_on_non_zero_exit: false }
|
||||
on(MRSK.config.role(:web).hosts) { execute *MRSK.traefik.run, raise_on_non_zero_exit: false }
|
||||
end
|
||||
|
||||
desc "Start existing Traefik on servers"
|
||||
task :start do
|
||||
on(MRSK_CONFIG.role(:web).hosts) { execute *traefik.start, raise_on_non_zero_exit: false }
|
||||
on(MRSK.config.role(:web).hosts) { execute *MRSK.traefik.start, raise_on_non_zero_exit: false }
|
||||
end
|
||||
|
||||
desc "Stop Traefik on servers"
|
||||
task :stop do
|
||||
on(MRSK_CONFIG.role(:web).hosts) { execute *traefik.stop, raise_on_non_zero_exit: false }
|
||||
on(MRSK.config.role(:web).hosts) { execute *MRSK.traefik.stop, raise_on_non_zero_exit: false }
|
||||
end
|
||||
|
||||
desc "Restart Traefik on servers"
|
||||
@@ -24,14 +22,14 @@ namespace :mrsk do
|
||||
|
||||
desc "Display information about Traefik containers from servers"
|
||||
task :info do
|
||||
on(MRSK_CONFIG.role(:web).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(*MRSK.traefik.info) + "\n\n" }
|
||||
end
|
||||
|
||||
desc "Remove Traefik container and image from servers"
|
||||
task remove: %i[ stop ] do
|
||||
on(MRSK_CONFIG.role(:web).hosts) do
|
||||
execute *traefik.remove_container
|
||||
execute *traefik.remove_image
|
||||
on(MRSK.config.role(:web).hosts) do
|
||||
execute *MRSK.traefik.remove_container
|
||||
execute *MRSK.traefik.remove_image
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user