Clarify exec modes and drop tailored versions

This commit is contained in:
David Heinemeier Hansson
2023-02-03 16:07:25 +01:00
parent a3d998508b
commit 3c1053fedd
4 changed files with 56 additions and 57 deletions

View File

@@ -42,14 +42,14 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
("grep '#{grep}'" if grep)
end
def exec(*command, interactive: false)
def execute_in_existing_container(*command, interactive: false)
docker :exec,
("-it" if interactive),
config.service_with_version,
*command
end
def run_exec(*command, interactive: false)
def execute_in_new_container(*command, interactive: false)
docker :run,
("-it" if interactive),
"--rm",
@@ -60,8 +60,12 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
*command
end
def exec_over_ssh(*command, host:)
run_over_ssh run_exec(*command, interactive: true).join(" "), host: host
def execute_in_existing_container_over_ssh(*command, host:)
run_over_ssh execute_in_existing_container(*command, interactive: true).join(" "), host: host
end
def execute_in_new_container_over_ssh(*command, host:)
run_over_ssh execute_in_new_container(*command, interactive: true).join(" "), host: host
end
def follow_logs(host:, grep: nil)
@@ -72,14 +76,6 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
).join(" "), host: host
end
def console(host:)
exec_over_ssh "bin/rails", "c", host: host
end
def bash(host:)
exec_over_ssh "bash", host: host
end
def list_containers
docker :container, :ls, "-a", *service_filter
end