Merge branch 'main' into role-awareness

This commit is contained in:
David Heinemeier Hansson
2023-03-13 15:16:44 +01:00
committed by GitHub
15 changed files with 74 additions and 33 deletions

View File

@@ -149,13 +149,13 @@ class Mrsk::Cli::Accessory < Mrsk::Cli::Base
end
end
desc "remove [NAME]", "Remove accessory container and image from host (use NAME=all to remove all accessories)"
desc "remove [NAME]", "Remove accessory container, image and data directory from host (use NAME=all to remove all accessories)"
option :confirmed, aliases: "-y", type: :boolean, default: false, desc: "Proceed without confirmation question"
def remove(name)
if name == "all"
MRSK.accessory_names.each { |accessory_name| remove(accessory_name) }
else
if options[:confirmed] || ask("This will remove all containers and images for #{name}. Are you sure?", limited_to: %w( y N ), default: "N") == "y"
if options[:confirmed] || ask("This will remove all containers, images and data directories for #{name}. Are you sure?", limited_to: %w( y N ), default: "N") == "y"
with_accessory(name) do
stop(name)
remove_container(name)

View File

@@ -14,6 +14,7 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
"--restart unless-stopped",
"--log-opt", "max-size=#{MAX_LOG_SIZE}",
"--name", service_with_version_and_destination_and_role,
"-e", "MRSK_CONTAINER_NAME=\"#{service_with_version_and_destination}\"",
*role.env_args,
*config.volume_args,
*role.label_args,

View File

@@ -9,8 +9,10 @@ class Mrsk::Commands::Healthcheck < Mrsk::Commands::Base
"--name", container_name_with_version,
"--publish", "#{EXPOSED_PORT}:#{config.healthcheck["port"]}",
"--label", "service=#{container_name}",
"-e", "MRSK_CONTAINER_NAME=\"#{container_name}\"",
*web.env_args,
*config.volume_args,
*web.option_args,
config.absolute_image,
web.cmd
end

View File

@@ -55,7 +55,7 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
private
def cmd_option_args
if args = config.raw_config.dig(:traefik, "args")
if args = config.traefik["args"]
optionize args
else
[]
@@ -63,6 +63,6 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
end
def host_port
config.raw_config.dig(:traefik, "host_port") || CONTAINER_PORT
config.traefik["host_port"] || CONTAINER_PORT
end
end

View File

@@ -165,6 +165,9 @@ class Mrsk::Configuration
}.compact
end
def traefik
raw_config.traefik || {}
end
private
# Will raise ArgumentError if any required config keys are missing