diff --git a/lib/kamal/cli/app/boot.rb b/lib/kamal/cli/app/boot.rb index d9ef5093..9e36cb43 100644 --- a/lib/kamal/cli/app/boot.rb +++ b/lib/kamal/cli/app/boot.rb @@ -48,7 +48,7 @@ class Kamal::Cli::App::Boot audit "Booted app version #{version}" execute *app.run(hostname: "#{host}-#{SecureRandom.hex(6)}") if running_proxy? - execute *KAMAL.proxy.deploy(app.container_name(version)) + execute *KAMAL.proxy.deploy("#{app.container_name(version)}:#{role.port}") end end diff --git a/lib/kamal/configuration.rb b/lib/kamal/configuration.rb index b32c0f94..a181b7b3 100644 --- a/lib/kamal/configuration.rb +++ b/lib/kamal/configuration.rb @@ -6,7 +6,7 @@ require "erb" require "net/ssh/proxy/jump" class Kamal::Configuration - delegate :service, :image, :servers, :labels, :registry, :stop_wait_time, :hooks_path, :logging, to: :raw_config, allow_nil: true + delegate :service, :image, :port, :servers, :labels, :registry, :stop_wait_time, :hooks_path, :logging, to: :raw_config, allow_nil: true delegate :argumentize, :optionize, to: Kamal::Utils attr_reader :destination, :raw_config diff --git a/lib/kamal/configuration/role.rb b/lib/kamal/configuration/role.rb index 9749189a..69cf189b 100644 --- a/lib/kamal/configuration/role.rb +++ b/lib/kamal/configuration/role.rb @@ -16,6 +16,10 @@ class Kamal::Configuration::Role @hosts ||= extract_hosts_from_config end + def port + specializations["port"] || config.port || "3000" + end + def cmd specializations["cmd"] end diff --git a/test/integration/docker/deployer/app/config/deploy.yml b/test/integration/docker/deployer/app/config/deploy.yml index b504a138..a8e541c4 100644 --- a/test/integration/docker/deployer/app/config/deploy.yml +++ b/test/integration/docker/deployer/app/config/deploy.yml @@ -3,6 +3,7 @@ image: app servers: - vm1 - vm2 +port: 80 env: clear: CLEAR_TOKEN: 4321 diff --git a/test/integration/docker/deployer/app_with_roles/config/deploy.yml b/test/integration/docker/deployer/app_with_roles/config/deploy.yml index 2c2ca14f..1dc63948 100644 --- a/test/integration/docker/deployer/app_with_roles/config/deploy.yml +++ b/test/integration/docker/deployer/app_with_roles/config/deploy.yml @@ -9,6 +9,7 @@ servers: hosts: - vm3 cmd: sleep infinity +port: 80 asset_path: /usr/share/nginx/html/versions