Files
kamal/lib/tasks/mrsk/setup.rb
2023-01-11 17:05:20 +01:00

29 lines
838 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
require "sshkit"
require "sshkit/dsl"
include SSHKit::DSL
if (config_file = Rails.root.join("config/deploy.yml")).exist?
MRSK_CONFIG = Mrsk::Configuration.load_file(config_file)
SSHKit::Backend::Netssh.configure { |ssh| ssh.ssh_options = MRSK_CONFIG.ssh_options }
# No need to use /usr/bin/env, just clogs up the logs
SSHKit.config.command_map[:docker] = "docker"
else
# MRSK is missing config/deploy.yml run 'rake mrsk:init'
MRSK_CONFIG = Mrsk::Configuration.new({}, validate: false)
end
# Allow easy full verbosity mode
SSHKit.config.output_verbosity = :debug if ENV["VERBOSE"]
# Set a different verbosity level for the duration of the yield
def verbosity(level)
old_level = SSHKit.config.output_verbosity
SSHKit.config.output_verbosity = level
yield
ensure
SSHKit.config.output_verbosity = old_level
end