Merge branch 'main' into rolling-traefik-restarts

* main:
  Removed not needed MRSK.traefik.run command in Traefil reboot
  Updated README with locking directory name
  Include service name to lock details
  Configurable SSH log levels
  Add registry container output to debug
  Minor tweaks to hooks section in readme
  Update README.md
  Updated README.md to make setup examples consistent
  Login to the registry proactively before stoping Accessory and Traefik
This commit is contained in:
Lewis Buckley
2023-07-19 14:46:16 +01:00
12 changed files with 77 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
class Mrsk::Cli::Accessory < Mrsk::Cli::Base
desc "boot [NAME]", "Boot new accessory service on host (use NAME=all to boot all accessories)"
def boot(name)
def boot(name, login: true)
mutating do
if name == "all"
MRSK.accessory_names.each { |accessory_name| boot(accessory_name) }
@@ -10,7 +10,7 @@ class Mrsk::Cli::Accessory < Mrsk::Cli::Base
upload(name)
on(accessory.hosts) do
execute *MRSK.registry.login
execute *MRSK.registry.login if login
execute *MRSK.auditor.record("Booted #{name} accessory"), verbosity: :debug
execute *accessory.run
end
@@ -53,9 +53,13 @@ class Mrsk::Cli::Accessory < Mrsk::Cli::Base
def reboot(name)
mutating do
with_accessory(name) do |accessory|
on(accessory.hosts) do
execute *MRSK.registry.login
end
stop(name)
remove_container(name)
boot(name)
boot(name, login: false)
end
end
end

View File

@@ -15,9 +15,9 @@ class Mrsk::Cli::Traefik < Mrsk::Cli::Base
mutating do
on(MRSK.traefik_hosts, in: options[:rolling] ? :sequence : :parallel) do
execute *MRSK.auditor.record("Rebooted traefik"), verbosity: :debug
execute *MRSK.registry.login
execute *MRSK.traefik.stop, raise_on_non_zero_exit: false
execute *MRSK.traefik.remove_container
execute *MRSK.registry.login
execute *MRSK.traefik.run, raise_on_non_zero_exit: false
end
end

View File

@@ -40,7 +40,7 @@ class Mrsk::Commands::Lock < Mrsk::Commands::Base
end
def lock_dir
:mrsk_lock
"mrsk_lock-#{config.service}"
end
def lock_details_file

View File

@@ -153,7 +153,15 @@ class Mrsk::Configuration
end
def ssh_options
{ user: ssh_user, proxy: ssh_proxy, auth_methods: [ "publickey" ] }.compact
{ user: ssh_user, proxy: ssh_proxy, auth_methods: [ "publickey" ], logger: ssh_logger }.compact
end
def ssh_logger
@ssh_logger ||= ::Logger.new(STDERR).tap { |logger| logger.level = ssh_log_level }
end
def ssh_log_level
(raw_config.ssh && raw_config.ssh["log_level"]) || ::Logger::FATAL
end
@@ -185,7 +193,8 @@ class Mrsk::Configuration
service_with_version: service_with_version,
env_args: env_args,
volume_args: volume_args,
ssh_options: ssh_options,
ssh_options: ssh_options.except(:logger),
ssh_log_level: ssh_log_level,
builder: builder.to_h,
accessories: raw_config.accessories,
logging: logging_args,