Add role concern with specialized cmds for job running

This commit is contained in:
David Heinemeier Hansson
2023-01-10 17:27:56 +01:00
parent 1cee87d440
commit e8beb362d0
8 changed files with 273 additions and 62 deletions

View File

@@ -9,15 +9,18 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
docker :pull, config.absolute_image
end
def run
def run(role: :web)
role = config.role(role)
docker :run,
"-d",
"--restart unless-stopped",
"--name", config.service_with_version,
"-e", redact("RAILS_MASTER_KEY=#{config.master_key}"),
*config.envs,
*config.labels,
config.absolute_image
*config.env_args,
*role.label_args,
config.absolute_image,
role.cmd
end
def start
@@ -39,7 +42,7 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
def exec(*command)
docker :exec,
"-e", redact("RAILS_MASTER_KEY=#{config.master_key}"),
*config.envs,
*config.env_args,
config.service_with_version,
*command
end