The proxy can be enabled via the config:
```
proxy:
enabled: true
hosts:
- 10.0.0.1
- 10.0.0.2
```
This will enable the proxy and cause it to be run on the hosts listed
under `hosts`, after running `kamal proxy reboot`.
Enabling the proxy disables `kamal traefik` commands and replaces them
with `kamal proxy` ones. However only the marked hosts will run the
kamal-proxy container, the rest will run Traefik as before.
39 lines
1.1 KiB
Ruby
39 lines
1.1 KiB
Ruby
module Kamal::Commands::App::Containers
|
|
DOCKER_HEALTH_LOG_FORMAT = "'{{json .State.Health}}'"
|
|
|
|
def list_containers
|
|
docker :container, :ls, "--all", *filter_args
|
|
end
|
|
|
|
def list_container_names
|
|
[ *list_containers, "--format", "'{{ .Names }}'" ]
|
|
end
|
|
|
|
def remove_container(version:)
|
|
pipe \
|
|
container_id_for(container_name: container_name(version)),
|
|
xargs(docker(:container, :rm))
|
|
end
|
|
|
|
def rename_container(version:, new_version:)
|
|
docker :rename, container_name(version), container_name(new_version)
|
|
end
|
|
|
|
def remove_containers
|
|
docker :container, :prune, "--force", *filter_args
|
|
end
|
|
|
|
def container_health_log(version:)
|
|
pipe \
|
|
container_id_for(container_name: container_name(version)),
|
|
xargs(docker(:inspect, "--format", DOCKER_HEALTH_LOG_FORMAT))
|
|
end
|
|
|
|
def container_endpoint(version:)
|
|
pipe \
|
|
container_id_for(container_name: container_name(version)),
|
|
xargs(docker(:inspect, "--format", "'{{.NetworkSettings.IPAddress}}{{range $k, $v := .NetworkSettings.Ports}}{{printf \":%s\" $k}}{{break}}{{end}}'")),
|
|
[ :sed, "-e", "'s/\\/tcp$//'" ]
|
|
end
|
|
end
|