Modified in response to PR comments
This commit is contained in:
@@ -426,13 +426,13 @@ traefik:
|
|||||||
host_port: 8080
|
host_port: 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
### Additional entrypoints for traefik
|
### Configure entrypoints for traefik
|
||||||
|
|
||||||
You can configure additional ports and entrypoints for traefik list so:
|
You can override the ports and entrypoints for traefik list so:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
traefik:
|
traefik:
|
||||||
additional_ports:
|
ports:
|
||||||
- 9000
|
- 9000
|
||||||
- 9001
|
- 9001
|
||||||
args:
|
args:
|
||||||
@@ -455,7 +455,8 @@ labels:
|
|||||||
traefik.http.services.myservice.loadbalancer.server.port: 8080
|
traefik.http.services.myservice.loadbalancer.server.port: 8080
|
||||||
|
|
||||||
traefik:
|
traefik:
|
||||||
additional_ports:
|
ports:
|
||||||
|
- 80
|
||||||
- 9000
|
- 9000
|
||||||
args:
|
args:
|
||||||
'entrypoints.web.address=:80': true
|
'entrypoints.web.address=:80': true
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
|
|||||||
"--detach",
|
"--detach",
|
||||||
"--restart", "unless-stopped",
|
"--restart", "unless-stopped",
|
||||||
"--log-opt", "max-size=#{MAX_LOG_SIZE}",
|
"--log-opt", "max-size=#{MAX_LOG_SIZE}",
|
||||||
"--publish", port,
|
*published_ports,
|
||||||
*additional_ports,
|
|
||||||
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
|
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
|
||||||
"traefik",
|
"traefik",
|
||||||
"--providers.docker",
|
"--providers.docker",
|
||||||
@@ -55,11 +54,11 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def additional_ports
|
def published_ports
|
||||||
if args = config.raw_config.dig(:traefik, "additional_ports")
|
if args = config.raw_config.dig(:traefik, "ports")
|
||||||
args.collect { |value| "--publish #{value}:#{value}" }.compact
|
args.collect { |value| "--publish #{value}:#{value}" }.compact
|
||||||
else
|
else
|
||||||
[]
|
["--publish #{port}"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ class CommandsTraefikTest < ActiveSupport::TestCase
|
|||||||
new_command.run.join(" ")
|
new_command.run.join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "run with additional entrypoints" do
|
test "run with ports configured" do
|
||||||
assert_equal \
|
assert_equal \
|
||||||
"docker run --name traefik --detach --restart unless-stopped --log-opt max-size=10m --publish 80:80 --volume /var/run/docker.sock:/var/run/docker.sock traefik --providers.docker --log.level=DEBUG --accesslog.format \"json\" --metrics.prometheus.buckets \"0.1,0.3,1.2,5.0\"",
|
"docker run --name traefik --detach --restart unless-stopped --log-opt max-size=10m --publish 80:80 --volume /var/run/docker.sock:/var/run/docker.sock traefik --providers.docker --log.level=DEBUG --accesslog.format \"json\" --metrics.prometheus.buckets \"0.1,0.3,1.2,5.0\"",
|
||||||
new_command.run.join(" ")
|
new_command.run.join(" ")
|
||||||
|
|
||||||
@config[:traefik]["additional_ports"] = %w[9000 9001]
|
@config[:traefik]["ports"] = %w[9000 9001]
|
||||||
assert_equal \
|
assert_equal \
|
||||||
"docker run --name traefik --detach --restart unless-stopped --log-opt max-size=10m --publish 80:80 --publish 9000:9000 --publish 9001:9001 --volume /var/run/docker.sock:/var/run/docker.sock traefik --providers.docker --log.level=DEBUG --accesslog.format \"json\" --metrics.prometheus.buckets \"0.1,0.3,1.2,5.0\"",
|
"docker run --name traefik --detach --restart unless-stopped --log-opt max-size=10m --publish 9000:9000 --publish 9001:9001 --volume /var/run/docker.sock:/var/run/docker.sock traefik --providers.docker --log.level=DEBUG --accesslog.format \"json\" --metrics.prometheus.buckets \"0.1,0.3,1.2,5.0\"",
|
||||||
new_command.run.join(" ")
|
new_command.run.join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user