Skip to content

Commit

Permalink
Merge pull request #368 from tsvallender/main
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh authored Aug 24, 2023
2 parents 519659b + c2ec04f commit eb3cb81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/kamal/commands/traefik.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def run
docker :run, "--name traefik",
"--detach",
"--restart", "unless-stopped",
"--publish", port,
*publish_args,
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
*env_args,
*config.logging_args,
Expand Down Expand Up @@ -64,6 +64,10 @@ def port
end

private
def publish_args
argumentize "--publish", port unless config.traefik["publish"] == false
end

def label_args
argumentize "--label", labels
end
Expand Down
5 changes: 5 additions & 0 deletions test/commands/traefik_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class CommandsTraefikTest < ActiveSupport::TestCase
assert_equal \
"docker run --name traefik --detach --restart unless-stopped --publish 8080:80 --volume /var/run/docker.sock:/var/run/docker.sock --log-opt max-size=\"10m\" #{@image} --providers.docker --log.level=\"DEBUG\" --accesslog.format=\"json\" --api.insecure --metrics.prometheus.buckets=\"0.1,0.3,1.2,5.0\"",
new_command.run.join(" ")

@config[:traefik]["publish"] = false
assert_equal \
"docker run --name traefik --detach --restart unless-stopped --volume /var/run/docker.sock:/var/run/docker.sock --log-opt max-size=\"10m\" #{@image} --providers.docker --log.level=\"DEBUG\" --accesslog.format=\"json\" --api.insecure --metrics.prometheus.buckets=\"0.1,0.3,1.2,5.0\"",
new_command.run.join(" ")
end

test "run with ports configured" do
Expand Down

0 comments on commit eb3cb81

Please sign in to comment.