Skip to content

fix(loadbalancer): propagate full proxy deploy options to the LB - #14

Merged
mhenrixon merged 3 commits into
dashfrom
issue-1-loadbalancer-deploy-options
Jul 10, 2026
Merged

mhenrixon merged 3 commits into
dashfrom
issue-1-loadbalancer-deploy-options

Conversation

@mhenrixon

Copy link
Copy Markdown
Collaborator

Summary

Fixes the loadbalancer deploy dropping every rich per-app proxy option (R1, size:S, bugfix). Discovered via the integration failures on 2026-07-03.

The load balancer runs the same kamal-proxy image as the per-app proxy, but Kamal::Commands::Loadbalancer#deploy hand-built only --target/--host/--tls, so timeouts, health checks, buffering, path prefixes, error pages, and logged headers configured in deploy.yml never reached it. It also hardcoded target port :80 (ignoring app_port) and --publish 80:80 --publish 443:443 in run (ignoring proxy.run.publish/ports/options).

Changes

  • Commands::Loadbalancer#deploy reuses the config's inherited deploy_command_args, propagating the full flag set (lib/kamal/commands/loadbalancer.rb).
  • New Configuration::Loadbalancer#deploy_command_args(targets:) — the multi-target analogue of the parent's single-target method, honouring app_port.
  • #run honours proxy.run (publish/ports/options) when present, default 80/443 otherwise.
  • Fixed a latent --tls= dangling-flag bug in Configuration::Loadbalancer#deploy_options (tls: nil survived the parent's compact).

Test plan

  • bundle exec rubocop --parallel — clean
  • Unit suite — only the 2 known Apple-Silicon builder failures remain (confirmed pre-existing on the base branch, pass in CI)
  • Integration: multi-host app deploys through the LB with custom deploy_timeout/healthcheck/proxy.run and they take effect (bin/test, needs Docker + published proxy image)

Closes #1

## Summary
The loadbalancer deploy re-implemented flag construction from scratch and
silently dropped every rich per-app proxy option (deploy/drain/health-check
timeouts, response timeout, buffering, path prefixes, error pages, logged
headers), hardcoded the target port to `:80` ignoring `app_port`, and
hardcoded `--publish 80:80 --publish 443:443` in `run` ignoring
`proxy.run.publish`/ports/options.

Now `Commands::Loadbalancer#deploy` reuses the LB config's inherited
`deploy_command_args`, so the LB deploys with the same flags as the per-app
proxy (it is the same kamal-proxy image). `#run` honours `proxy.run` when
present, falling back to the default 80/443 publish otherwise.

Also fixes a latent bug in `Configuration::Loadbalancer#deploy_options`: it
re-added `tls: proxy_config["ssl"].presence` after the parent compacted, so
non-SSL load balancers emitted a dangling `--tls=`. Now `tls: true if ssl?`,
matching the parent semantics.

## Test Coverage
- deploy propagates rich options (timeouts, healthcheck, path prefix)
- deploy uses app_port for target ports (not hardcoded 80)
- deploy with multiple hosts emits repeated --host flags
- run honors proxy.run.publish false + custom options
- run honors custom http/https ports
- updated cli/proxy loadbalancer deploy assertion (fixture deploy_timeout: 6 now flows through)

## Verification
- [x] bundle exec rubocop --parallel passes (4 files, no offenses)
- [x] unit tests pass (only the 2 known Apple-Silicon builder failures remain, confirmed pre-existing on the base branch)

Closes #1
@mhenrixon mhenrixon added this to the R1 — Foundations & fixes milestone Jul 4, 2026
@mhenrixon mhenrixon added gem Legacy: the gem side of cross-repo work (every item in this repo is) bugfix size:S Small: hours labels Jul 4, 2026
…deploy-options

# Conflicts:
#	test/commands/loadbalancer_test.rb
@mhenrixon
mhenrixon merged commit 0932998 into dash Jul 10, 2026
9 checks passed
@mhenrixon
mhenrixon deleted the issue-1-loadbalancer-deploy-options branch July 10, 2026 20:27
@mhenrixon mhenrixon added bug Something isn't working and removed bugfix labels Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gem Legacy: the gem side of cross-repo work (every item in this repo is) size:S Small: hours

Projects

None yet

Development

Successfully merging this pull request may close these issues.

R1: Loadbalancer deploy propagates full proxy deploy_options

1 participant