Add remove tasks to clean up

This commit is contained in:
David Heinemeier Hansson
2023-01-08 14:55:06 +01:00
parent 23c2cb898c
commit ffb532a50d
5 changed files with 40 additions and 0 deletions

View File

@@ -39,5 +39,13 @@ namespace :mrsk do
task :info do
on(MRSK_CONFIG.servers) { |host| puts "Host: #{host}\n" + capture(app.info) + "\n\n" }
end
desc "Remove app containers and images from servers"
task remove: %i[ stop ] do
on(MRSK_CONFIG.servers) do
execute app.remove_containers
execute app.remove_images
end
end
end
end

View File

@@ -20,4 +20,7 @@ namespace :mrsk do
Pathname.new(File.expand_path("templates/deploy.yml", __dir__)),
Rails.root.join("config/deploy.yml")
end
desc "Remove Traefik, app, and registry session from servers"
task remove: %w[ traefik:remove app:remove registry:logout ]
end

View File

@@ -21,5 +21,13 @@ namespace :mrsk do
task :info do
on(MRSK_CONFIG.servers) { |host| puts "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.servers) do
execute traefik.remove_container
execute traefik.remove_image
end
end
end
end