dash 3.2.1 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dash/cli/app/boot.rb +2 -2
- data/lib/dash/cli/app.rb +1 -1
- data/lib/dash/cli/base.rb +1 -1
- data/lib/dash/cli/doctor/endpoint_checks.rb +1 -1
- data/lib/dash/cli/doctor/host_checks.rb +29 -8
- data/lib/dash/cli/main.rb +5 -5
- data/lib/dash/cli/proxy/legacy_rename.rb +58 -0
- data/lib/dash/cli/proxy/loadbalancer_reboot.rb +1 -1
- data/lib/dash/cli/proxy/reboot.rb +8 -8
- data/lib/dash/cli/proxy.rb +14 -10
- data/lib/dash/commander.rb +1 -1
- data/lib/dash/commands/accessory/proxy.rb +1 -1
- data/lib/dash/commands/app/execution.rb +1 -1
- data/lib/dash/commands/app/proxy.rb +1 -1
- data/lib/dash/commands/app.rb +1 -1
- data/lib/dash/commands/docker.rb +35 -1
- data/lib/dash/commands/loadbalancer.rb +47 -17
- data/lib/dash/commands/lock.rb +1 -1
- data/lib/dash/commands/proxy/cert_transfer.rb +4 -4
- data/lib/dash/commands/proxy.rb +117 -15
- data/lib/dash/commands/prune.rb +1 -1
- data/lib/dash/configuration/accessory.rb +2 -2
- data/lib/dash/configuration/docs/accessory.yml +3 -3
- data/lib/dash/configuration/docs/configuration.yml +1 -1
- data/lib/dash/configuration/docs/proxy.yml +38 -38
- data/lib/dash/configuration/loadbalancer.rb +2 -2
- data/lib/dash/configuration/proxy/acme.rb +5 -5
- data/lib/dash/configuration/proxy/boot.rb +2 -4
- data/lib/dash/configuration/proxy/run.rb +10 -10
- data/lib/dash/configuration/proxy.rb +36 -14
- data/lib/dash/configuration/role.rb +2 -2
- data/lib/dash/configuration/validator/proxy.rb +23 -23
- data/lib/dash/configuration.rb +8 -8
- data/lib/dash/utils.rb +1 -1
- data/lib/dash/version.rb +1 -1
- metadata +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Proxy
|
|
2
2
|
#
|
|
3
|
-
# Kamal uses [
|
|
3
|
+
# Kamal uses [dash-proxy](https://github.com/basecamp/dash-proxy) to provide
|
|
4
4
|
# gapless deployments. It runs on ports 80 and 443 and forwards requests to the
|
|
5
5
|
# application container.
|
|
6
6
|
#
|
|
@@ -74,13 +74,13 @@ proxy:
|
|
|
74
74
|
# Sharing one loadbalancer between several dash apps
|
|
75
75
|
#
|
|
76
76
|
# More than one dash app may point `loadbalancer:` at the same host. Each app
|
|
77
|
-
# registers its own service on the shared
|
|
77
|
+
# registers its own service on the shared dash-proxy and keeps its own
|
|
78
78
|
# deploy.yml; the load balancer multiplexes them by hostname.
|
|
79
79
|
#
|
|
80
80
|
# The rules dash enforces for that topology:
|
|
81
81
|
#
|
|
82
|
-
# * Service state survives a reboot.
|
|
83
|
-
# `
|
|
82
|
+
# * Service state survives a reboot. dash-proxy persists its services in the
|
|
83
|
+
# `dash-loadbalancer-config` volume (or `dash-proxy-config` when the
|
|
84
84
|
# loadbalancer shares a proxy host), and `dash proxy reboot` only replaces
|
|
85
85
|
# the container. Rebooting from app A does not drop app B's routes — the
|
|
86
86
|
# surviving service list is printed after the restart.
|
|
@@ -104,7 +104,7 @@ proxy:
|
|
|
104
104
|
|
|
105
105
|
# Automatic proxy reboot on deploy
|
|
106
106
|
#
|
|
107
|
-
# When `dash deploy` detects that the running
|
|
107
|
+
# When `dash deploy` detects that the running dash-proxy container was
|
|
108
108
|
# started with a different image, version or run options than the current
|
|
109
109
|
# configuration, it reboots the proxy automatically — one host at a time —
|
|
110
110
|
# before booting the app.
|
|
@@ -126,13 +126,13 @@ proxy:
|
|
|
126
126
|
|
|
127
127
|
# SSL
|
|
128
128
|
#
|
|
129
|
-
#
|
|
129
|
+
# dash-proxy can provide automatic HTTPS for your application via Let's Encrypt.
|
|
130
130
|
#
|
|
131
131
|
# This requires that we are deploying to one server and the host option is set.
|
|
132
132
|
# The host value must point to the server we are deploying to, and port 443 must be
|
|
133
133
|
# open for the Let's Encrypt challenge to succeed.
|
|
134
134
|
#
|
|
135
|
-
# If you set `ssl` to `true`, `
|
|
135
|
+
# If you set `ssl` to `true`, `dash-proxy` will stop forwarding headers to your app,
|
|
136
136
|
# unless you explicitly set `forward_headers: true`
|
|
137
137
|
#
|
|
138
138
|
# Defaults to `false`:
|
|
@@ -156,7 +156,7 @@ proxy:
|
|
|
156
156
|
# absolute http(s) URL is called directly. Answer 2xx to approve. On-demand TLS
|
|
157
157
|
# replaces the static hostname list, so it cannot be combined with
|
|
158
158
|
# `host`/`hosts`, with `certificate_pem`, or with `ssl_domains` — dash rejects
|
|
159
|
-
# those at config time, because
|
|
159
|
+
# those at config time, because dash-proxy would reject the deploy and there
|
|
160
160
|
# is no sensible winner to pick.
|
|
161
161
|
#
|
|
162
162
|
# `client_ca_pem` requires mutual TLS: clients must present a certificate
|
|
@@ -176,7 +176,7 @@ proxy:
|
|
|
176
176
|
|
|
177
177
|
# SSL redirect
|
|
178
178
|
#
|
|
179
|
-
# By default,
|
|
179
|
+
# By default, dash-proxy will redirect all HTTP requests to HTTPS when SSL is enabled.
|
|
180
180
|
# If you prefer that HTTP traffic is passed through to your application (along with
|
|
181
181
|
# HTTPS traffic), you can disable this redirect by setting `ssl_redirect: false`:
|
|
182
182
|
ssl_redirect: false
|
|
@@ -244,7 +244,7 @@ proxy:
|
|
|
244
244
|
#
|
|
245
245
|
# If you are behind a trusted proxy, you can set this to `true` to forward the headers.
|
|
246
246
|
#
|
|
247
|
-
# By default,
|
|
247
|
+
# By default, dash-proxy will not forward the headers if the `ssl` option is set to `true`, and
|
|
248
248
|
# will forward them if it is set to `false`.
|
|
249
249
|
forward_headers: true
|
|
250
250
|
|
|
@@ -278,7 +278,7 @@ proxy:
|
|
|
278
278
|
set:
|
|
279
279
|
Strict-Transport-Security: max-age=31536000
|
|
280
280
|
add:
|
|
281
|
-
X-Served-By:
|
|
281
|
+
X-Served-By: dash-proxy
|
|
282
282
|
remove:
|
|
283
283
|
- Server
|
|
284
284
|
|
|
@@ -329,7 +329,7 @@ proxy:
|
|
|
329
329
|
#
|
|
330
330
|
# Authentication tokens live in the PROXY's environment, not the app's: polls
|
|
331
331
|
# send `KAMAL_PROXY_REDIRECTS_TOKEN` as a bearer token when set, and
|
|
332
|
-
# `POST /.
|
|
332
|
+
# `POST /.dash-proxy/redirects/refresh` nudges an immediate re-poll when
|
|
333
333
|
# authenticated with `KAMAL_PROXY_REFRESH_TOKEN`. Set both via
|
|
334
334
|
# `proxy.run.options.env`, next to `KAMAL_PROXY_DOMAINS_TOKEN` — never as
|
|
335
335
|
# deploy flags, which leak into process listings and audit logs.
|
|
@@ -397,19 +397,19 @@ proxy:
|
|
|
397
397
|
password_secret: WEB_BASIC_AUTH_PASSWORD
|
|
398
398
|
#
|
|
399
399
|
# ### Notes
|
|
400
|
-
# - Requires a
|
|
400
|
+
# - Requires a dash-proxy that supports `--basic-auth`. This is newer than
|
|
401
401
|
# the current `MINIMUM_VERSION`, so make sure your proxy is up to date
|
|
402
402
|
# before enabling it — an older proxy fails the deploy on an unknown flag.
|
|
403
403
|
# - Basic credentials are replayable and are sent on every request. Use this
|
|
404
404
|
# with `ssl: true`, or terminate TLS in front of the proxy.
|
|
405
|
-
# -
|
|
405
|
+
# - dash-proxy removes the `Authorization` header before forwarding, so a
|
|
406
406
|
# service behind basic auth cannot also pass credentials through to its
|
|
407
407
|
# target. When load balancing, the credentials are enforced by the load
|
|
408
408
|
# balancer only.
|
|
409
409
|
|
|
410
410
|
# Dynamic TLS domains
|
|
411
411
|
#
|
|
412
|
-
#
|
|
412
|
+
# dash-proxy can learn TLS hostnames from your application at runtime
|
|
413
413
|
# instead of fixing them at deploy time. It polls `source` — a path
|
|
414
414
|
# (resolved against a healthy app target) or an absolute http(s) URL —
|
|
415
415
|
# for the domain list and manages Let's Encrypt certificates for it
|
|
@@ -434,21 +434,21 @@ proxy:
|
|
|
434
434
|
# Who the client is
|
|
435
435
|
#
|
|
436
436
|
# Rate limiting and IP allow lists are both only as correct as the address they
|
|
437
|
-
# key on, so configure this first if anything sits in front of
|
|
437
|
+
# key on, so configure this first if anything sits in front of dash-proxy.
|
|
438
438
|
#
|
|
439
439
|
# With no `trusted_proxies`, the client is always the address that opened the
|
|
440
440
|
# connection — nothing a client sends can influence it, which is what makes the
|
|
441
441
|
# allow list meaningful.
|
|
442
442
|
#
|
|
443
443
|
# Once you declare `trusted_proxies`, and only when the connecting address is
|
|
444
|
-
# one of them,
|
|
444
|
+
# one of them, dash-proxy reads the forwarded chain instead: it walks the
|
|
445
445
|
# chain from the nearest hop backwards past every proxy you declared, and the
|
|
446
446
|
# first address none of your proxies wrote is the client. **List every hop**,
|
|
447
|
-
# not only the one that connects to
|
|
447
|
+
# not only the one that connects to dash-proxy — a chain it cannot resolve
|
|
448
448
|
# denies the request rather than falling back to the connecting address.
|
|
449
449
|
#
|
|
450
450
|
# `header` names the header carrying the original client IP (`CF-Connecting-IP`
|
|
451
|
-
# behind Cloudflare, `True-Client-IP` behind some others);
|
|
451
|
+
# behind Cloudflare, `True-Client-IP` behind some others); dash-proxy reads it
|
|
452
452
|
# instead of `X-Forwarded-For`. It is only honoured when `trusted_proxies` is
|
|
453
453
|
# set, because otherwise it is just something the client wrote — dash rejects
|
|
454
454
|
# that combination rather than appearing to honour it.
|
|
@@ -501,7 +501,7 @@ proxy:
|
|
|
501
501
|
#
|
|
502
502
|
# Refuse requests whose full User-Agent matches one of these RE2 patterns,
|
|
503
503
|
# checked after the IP rules. A missing User-Agent only matches an explicit
|
|
504
|
-
# '^$' pattern. Patterns are matched by
|
|
504
|
+
# '^$' pattern. Patterns are matched by dash-proxy (Go RE2), so dash checks
|
|
505
505
|
# only their shape, not their syntax.
|
|
506
506
|
deny_user_agents:
|
|
507
507
|
- 'BadBot/.*'
|
|
@@ -661,7 +661,7 @@ proxy:
|
|
|
661
661
|
# This block is the *policy*, and it is per service. Where the entries live is
|
|
662
662
|
# proxy-wide and set under `run/cache` below.
|
|
663
663
|
#
|
|
664
|
-
# Only `enabled` is required. Everything else keeps
|
|
664
|
+
# Only `enabled` is required. Everything else keeps dash-proxy's own default
|
|
665
665
|
# until you set it.
|
|
666
666
|
#
|
|
667
667
|
# `max_ttl` caps the lifetime the app asks for, in seconds, so one mistaken
|
|
@@ -690,7 +690,7 @@ proxy:
|
|
|
690
690
|
# ### When it is not caching
|
|
691
691
|
#
|
|
692
692
|
# A cache that quietly stores nothing is the usual first surprise. Start with
|
|
693
|
-
# `dash proxy cache stats`;
|
|
693
|
+
# `dash proxy cache stats`; dash-proxy also explains every refusal — check
|
|
694
694
|
# `dash proxy logs` for the reason, and the `cache_refusals_total` metric
|
|
695
695
|
# (by `reason`) if you run with `metrics_port`.
|
|
696
696
|
# The common reasons are a missing `Cache-Control: public, max-age=...` on the
|
|
@@ -739,7 +739,7 @@ proxy:
|
|
|
739
739
|
|
|
740
740
|
# Read-only targets
|
|
741
741
|
#
|
|
742
|
-
#
|
|
742
|
+
# dash-proxy can split traffic between the deployed (writer) targets and a
|
|
743
743
|
# set of read-only targets, e.g. app instances backed by database replicas.
|
|
744
744
|
# Read requests are routed to the read targets; write requests always go to
|
|
745
745
|
# the writers.
|
|
@@ -771,7 +771,7 @@ proxy:
|
|
|
771
771
|
# re-pinned, so a deploy does not strand anybody. Reads served by a
|
|
772
772
|
# `read_targets` replica are never pinned.
|
|
773
773
|
#
|
|
774
|
-
# `cookie` renames the pin cookie;
|
|
774
|
+
# `cookie` renames the pin cookie; dash-proxy picks a sensible default.
|
|
775
775
|
session_affinity:
|
|
776
776
|
enabled: true
|
|
777
777
|
cookie: _kamal_affinity
|
|
@@ -827,19 +827,19 @@ proxy:
|
|
|
827
827
|
publish: false # Publish ports to the host (default: true)
|
|
828
828
|
bind_ips: # List of IPs to bind to when publishing ports
|
|
829
829
|
- 0.0.0.0
|
|
830
|
-
registry: registry:4443 # Extra registry prefix for the
|
|
830
|
+
registry: registry:4443 # Extra registry prefix for the dash-proxy image
|
|
831
831
|
# (default: none). If you set this, also override
|
|
832
832
|
# `repository` to a host-less path (e.g.
|
|
833
|
-
# myfork/
|
|
833
|
+
# myfork/dash-proxy) - the default repository
|
|
834
834
|
# below already embeds its ghcr.io host
|
|
835
835
|
repository: ghcr.io/zoolutions/dash-proxy # Container repository for the
|
|
836
|
-
#
|
|
837
|
-
version: v1.0.0
|
|
836
|
+
# dash-proxy image (this is the default)
|
|
837
|
+
version: v1.1.0.0 # Version tag of the dash-proxy image to use.
|
|
838
838
|
# Defaults to the minimum version this gem
|
|
839
839
|
# requires - only pin it to roll forward early,
|
|
840
840
|
# never below the default
|
|
841
841
|
port_holder: true # Zero-downtime proxy reboots (default: false).
|
|
842
|
-
# Runs a minimal long-lived
|
|
842
|
+
# Runs a minimal long-lived dash-proxy-net container that
|
|
843
843
|
# owns the published ports; proxy generations join its
|
|
844
844
|
# network namespace and overlap during a reboot, so config
|
|
845
845
|
# and version changes apply without dropping requests.
|
|
@@ -857,7 +857,7 @@ proxy:
|
|
|
857
857
|
# DNS-01 on their own. `auto` is an explicit opt-in that picks the provider
|
|
858
858
|
# from the credentials it can see and logs at boot which one it armed;
|
|
859
859
|
# `none` says "no DNS-01" explicitly. An unsupported name is rejected here,
|
|
860
|
-
# at config time -
|
|
860
|
+
# at config time - dash-proxy would only log a warning and then never
|
|
861
861
|
# issue a certificate.
|
|
862
862
|
#
|
|
863
863
|
# A plain string (`dns_provider: cloudflare`) uses one provider for every
|
|
@@ -866,7 +866,7 @@ proxy:
|
|
|
866
866
|
# spread across registrars. Each provider's API credentials must be present
|
|
867
867
|
# under `credentials` for its challenges to succeed.
|
|
868
868
|
#
|
|
869
|
-
#
|
|
869
|
+
# dash-proxy also accepts short aliases for the canonical names - `cf`
|
|
870
870
|
# (cloudflare), `do` (digitalocean), `gcp`/`google`/`googledns` (gcloud),
|
|
871
871
|
# `gd` (godaddy), `hz` (hetzner), `nc` (namecheap), `aws`/`r53` (route53)
|
|
872
872
|
# and `vr` (vultr). Prefer the canonical name; the aliases exist so a
|
|
@@ -1018,15 +1018,15 @@ proxy:
|
|
|
1018
1018
|
# Defaults to false:
|
|
1019
1019
|
reuse_port: true
|
|
1020
1020
|
|
|
1021
|
-
# Escape hatch for `
|
|
1021
|
+
# Escape hatch for `dash-proxy run`
|
|
1022
1022
|
#
|
|
1023
|
-
# Anything
|
|
1023
|
+
# Anything dash-proxy accepts that has no key above. Note the difference
|
|
1024
1024
|
# from `options` below, which many people expect to do this: `flags` goes to
|
|
1025
|
-
# `
|
|
1025
|
+
# `dash-proxy run`, `options` goes to `docker run`.
|
|
1026
1026
|
#
|
|
1027
1027
|
# `true` renders a bare flag; anything else renders `--flag value`. No
|
|
1028
1028
|
# translation is applied, so write Go durations and lists the way
|
|
1029
|
-
#
|
|
1029
|
+
# dash-proxy wants them.
|
|
1030
1030
|
#
|
|
1031
1031
|
# A key here that a named setting already emits is rejected rather than
|
|
1032
1032
|
# passed twice — set one or the other.
|
|
@@ -1037,7 +1037,7 @@ proxy:
|
|
|
1037
1037
|
#
|
|
1038
1038
|
# Path to the container runtime socket, which is what `proxy/sleep` needs in
|
|
1039
1039
|
# order to stop and start containers. Setting it does two things: it passes
|
|
1040
|
-
# the path to
|
|
1040
|
+
# the path to dash-proxy, and it mounts that path into the proxy container,
|
|
1041
1041
|
# since the flag alone only says where to look.
|
|
1042
1042
|
#
|
|
1043
1043
|
# **Reaching this socket is root-equivalent on the host.** It is a separate,
|
|
@@ -1073,11 +1073,11 @@ proxy:
|
|
|
1073
1073
|
store_timeout: 2
|
|
1074
1074
|
memory_size: 134_217_728
|
|
1075
1075
|
# `options` are `docker run` options for the proxy container - resource
|
|
1076
|
-
# limits, labels, extra mounts - NOT
|
|
1076
|
+
# limits, labels, extra mounts - NOT dash-proxy flags. A dash-proxy flag
|
|
1077
1077
|
# the gem has no key for goes in `flags` above instead.
|
|
1078
1078
|
options: # Additional options to pass to `docker run`
|
|
1079
1079
|
label:
|
|
1080
|
-
- custom.label=
|
|
1080
|
+
- custom.label=dash-proxy
|
|
1081
1081
|
memory: 512m
|
|
1082
1082
|
cpus: 0.5
|
|
1083
1083
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class Dash::Configuration::Loadbalancer < Dash::Configuration::Proxy
|
|
2
2
|
CONTAINER_NAME = "load-balancer".freeze
|
|
3
|
-
SHARED_CONTAINER_NAME = "
|
|
3
|
+
SHARED_CONTAINER_NAME = "dash-proxy".freeze
|
|
4
4
|
|
|
5
5
|
def self.validation_config_key
|
|
6
6
|
"proxy"
|
|
@@ -34,7 +34,7 @@ class Dash::Configuration::Loadbalancer < Dash::Configuration::Proxy
|
|
|
34
34
|
File.join config.run_directory, "loadbalancer"
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# The load balancer is a
|
|
37
|
+
# The load balancer is a dash-proxy container, so proxy/run applies to it
|
|
38
38
|
# exactly as it does to the per-host proxies. Without a run block it still
|
|
39
39
|
# needs the default surface (published ports, log rotation, the apps-config
|
|
40
40
|
# mount and the run command) to boot from, so fall back to an empty config
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# ACME configuration for the
|
|
1
|
+
# ACME configuration for the dash-proxy container, including the DNS-01
|
|
2
2
|
# challenge credentials.
|
|
3
3
|
#
|
|
4
|
-
# Everything here except the credentials becomes a `
|
|
4
|
+
# Everything here except the credentials becomes a `dash-proxy run` flag, so it
|
|
5
5
|
# lands in the run command and therefore in Proxy::Run#config_digest — changing
|
|
6
6
|
# the block reboots the proxy on the next deploy.
|
|
7
7
|
#
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
# API token can rewrite your zone; `docker run --env TOKEN=...` would put it in
|
|
10
10
|
# the host's process listing and in kamal's own audit log.
|
|
11
11
|
class Dash::Configuration::Proxy::Acme
|
|
12
|
-
# The canonical provider names
|
|
12
|
+
# The canonical provider names dash-proxy MINIMUM_VERSION advertises. Kept in
|
|
13
13
|
# step with the proxy by test/proxy_flag_coverage_test.rb, which compares this
|
|
14
14
|
# list against the manifest bin/sync-proxy-flags generates from the image.
|
|
15
15
|
DNS_PROVIDERS = %w[
|
|
16
16
|
auto cloudflare digitalocean gcloud godaddy hetzner namecheap none route53 vultr
|
|
17
17
|
].freeze
|
|
18
18
|
|
|
19
|
-
# Short forms
|
|
19
|
+
# Short forms dash-proxy's ParseProviderName accepts but does not advertise,
|
|
20
20
|
# so they cannot be generated from --help and are not drift-checked.
|
|
21
21
|
DNS_PROVIDER_ALIASES = %w[ cf do gcp google googledns gd hz nc aws r53 vr ].freeze
|
|
22
22
|
|
|
@@ -70,7 +70,7 @@ class Dash::Configuration::Proxy::Acme
|
|
|
70
70
|
|
|
71
71
|
private
|
|
72
72
|
# The hash form pins zones to the DNS host that serves them; `default`
|
|
73
|
-
# covers unmatched zones.
|
|
73
|
+
# covers unmatched zones. dash-proxy takes repeatable --acme-dns-provider
|
|
74
74
|
# entries — zone=provider pairs plus at most one bare default — so the hash
|
|
75
75
|
# becomes an array and Utils.optionize repeats the flag. The string form
|
|
76
76
|
# passes through untouched and keeps meaning what it always has.
|
|
@@ -41,10 +41,8 @@ class Dash::Configuration::Proxy::Boot
|
|
|
41
41
|
"#{repository_name}/#{image_name}"
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
# Stays kamal-proxy until the server-artifact rename ships a migration
|
|
45
|
-
# bridge — every deployed host has a running container by this name.
|
|
46
44
|
def container_name
|
|
47
|
-
|
|
45
|
+
Dash::Configuration::Proxy::CONTAINER_NAME
|
|
48
46
|
end
|
|
49
47
|
|
|
50
48
|
def host_directory
|
|
@@ -72,7 +70,7 @@ class Dash::Configuration::Proxy::Boot
|
|
|
72
70
|
end
|
|
73
71
|
|
|
74
72
|
def apps_container_directory
|
|
75
|
-
"/home/
|
|
73
|
+
"/home/dash-proxy/.apps-config"
|
|
76
74
|
end
|
|
77
75
|
|
|
78
76
|
def apps_volume
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
class Dash::Configuration::Proxy::Run
|
|
2
|
-
MINIMUM_VERSION = "v1.0.0
|
|
2
|
+
MINIMUM_VERSION = "v1.1.0.0"
|
|
3
3
|
DEFAULT_HTTP_PORT = 80
|
|
4
4
|
DEFAULT_HTTPS_PORT = 443
|
|
5
5
|
DEFAULT_LOG_MAX_SIZE = "10m"
|
|
@@ -103,7 +103,7 @@ class Dash::Configuration::Proxy::Run
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def container_name
|
|
106
|
-
"
|
|
106
|
+
"dash-proxy"
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
# Zero-downtime reboots: a minimal long-lived holder container owns the
|
|
@@ -114,14 +114,14 @@ class Dash::Configuration::Proxy::Run
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
def holder_container_name
|
|
117
|
-
"
|
|
117
|
+
"dash-proxy-net"
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
def network_args
|
|
121
121
|
if port_holder?
|
|
122
122
|
[ "--network", "container:#{holder_container_name}" ]
|
|
123
123
|
else
|
|
124
|
-
[ "--network", "
|
|
124
|
+
[ "--network", "dash" ]
|
|
125
125
|
end
|
|
126
126
|
end
|
|
127
127
|
|
|
@@ -136,7 +136,7 @@ class Dash::Configuration::Proxy::Run
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
def run_command
|
|
139
|
-
[ "
|
|
139
|
+
[ "dash-proxy", "run", *optionize(run_command_options), *acme.run_command_args ].join(" ")
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
def metrics_port
|
|
@@ -158,7 +158,7 @@ class Dash::Configuration::Proxy::Run
|
|
|
158
158
|
.compact.merge(cache_options).merge(server_options)
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
# Anything
|
|
161
|
+
# Anything dash-proxy accepts that has no key of its own yet. Values are
|
|
162
162
|
# optionized as written - `true` is a bare flag, anything else takes a value -
|
|
163
163
|
# because the point of an escape hatch is that the gem holds no opinion about
|
|
164
164
|
# the flag it is forwarding.
|
|
@@ -189,7 +189,7 @@ class Dash::Configuration::Proxy::Run
|
|
|
189
189
|
].compact
|
|
190
190
|
end
|
|
191
191
|
|
|
192
|
-
# The flag only tells
|
|
192
|
+
# The flag only tells dash-proxy where to look inside its own container, so
|
|
193
193
|
# without this mount the socket is not there and a sleeping service never
|
|
194
194
|
# wakes - which the operator sees as one hung request, not as a misconfiguration.
|
|
195
195
|
def docker_socket_args
|
|
@@ -224,7 +224,7 @@ class Dash::Configuration::Proxy::Run
|
|
|
224
224
|
end
|
|
225
225
|
|
|
226
226
|
def apps_container_directory
|
|
227
|
-
"/home/
|
|
227
|
+
"/home/dash-proxy/.apps-config"
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
def apps_volume
|
|
@@ -288,7 +288,7 @@ class Dash::Configuration::Proxy::Run
|
|
|
288
288
|
end
|
|
289
289
|
|
|
290
290
|
# A passthrough flag that a named key already emits would be optionized
|
|
291
|
-
# twice, and
|
|
291
|
+
# twice, and dash-proxy would silently take the last one. Refuse instead.
|
|
292
292
|
# Only Proxy::Run knows which flags the named keys produce, so the check
|
|
293
293
|
# cannot live in the validator with the rest.
|
|
294
294
|
def ensure_no_conflicting_flags
|
|
@@ -303,7 +303,7 @@ class Dash::Configuration::Proxy::Run
|
|
|
303
303
|
# than of any one service - the policy that fills the cache is per service,
|
|
304
304
|
# in proxy/cache. The store itself is deliberately absent: a store URL may
|
|
305
305
|
# embed credentials, so it travels as CACHE_STORE in the secrets env file
|
|
306
|
-
# (
|
|
306
|
+
# (dash-proxy reads it as the --cache-store default) rather than on a
|
|
307
307
|
# command line that lands in process listings and the audit log.
|
|
308
308
|
def cache_options
|
|
309
309
|
cache = run_config["cache"] || {}
|
|
@@ -2,11 +2,33 @@ class Dash::Configuration::Proxy
|
|
|
2
2
|
include Dash::Configuration::Validation
|
|
3
3
|
|
|
4
4
|
DEFAULT_LOG_REQUEST_HEADERS = [ "Cache-Control", "Last-Modified", "User-Agent" ]
|
|
5
|
-
CONTAINER_NAME = "
|
|
6
|
-
LOADBALANCER_CONTAINER_NAME = "
|
|
5
|
+
CONTAINER_NAME = "dash-proxy"
|
|
6
|
+
LOADBALANCER_CONTAINER_NAME = "dash-loadbalancer"
|
|
7
7
|
CLIENT_CA_FILENAME = "client-ca.pem"
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# The image label the prune filters key on, set by dash-proxy's publish
|
|
10
|
+
# workflow.
|
|
11
|
+
IMAGE_TITLE = "dash-proxy"
|
|
12
|
+
LOADBALANCER_IMAGE_TITLE = "dash-loadbalancer"
|
|
13
|
+
|
|
14
|
+
NETWORK = "dash"
|
|
15
|
+
CONFIG_VOLUME = "dash-proxy-config"
|
|
16
|
+
LOADBALANCER_CONFIG_VOLUME = "dash-loadbalancer-config"
|
|
17
|
+
|
|
18
|
+
# Pre-rename names, kept only so the stage-3c migration can find what a host
|
|
19
|
+
# already has: the container to replace, the volume to copy, the network to
|
|
20
|
+
# bridge, and the image label to keep pruning by. Nothing constructs a
|
|
21
|
+
# resource with these — stage 3d deletes them.
|
|
22
|
+
LEGACY_CONTAINER_NAME = "kamal-proxy"
|
|
23
|
+
LEGACY_LOADBALANCER_CONTAINER_NAME = "kamal-loadbalancer"
|
|
24
|
+
LEGACY_HOLDER_CONTAINER_NAME = "kamal-proxy-net"
|
|
25
|
+
LEGACY_NETWORK = "kamal"
|
|
26
|
+
LEGACY_CONFIG_VOLUME = "kamal-proxy-config"
|
|
27
|
+
LEGACY_LOADBALANCER_CONFIG_VOLUME = "kamal-loadbalancer-config"
|
|
28
|
+
LEGACY_IMAGE_TITLE = "kamal-proxy"
|
|
29
|
+
LEGACY_LOADBALANCER_IMAGE_TITLE = "kamal-loadbalancer"
|
|
30
|
+
|
|
31
|
+
# What `compress: true` offers. dash-proxy has no "on" state without an
|
|
10
32
|
# explicit list - --compress *is* the list - so the shorthand has to pick.
|
|
11
33
|
# Best ratio first, matching the proxy's own default ordering; the client's
|
|
12
34
|
# Accept-Encoding q-values still outrank this preference.
|
|
@@ -14,7 +36,7 @@ class Dash::Configuration::Proxy
|
|
|
14
36
|
|
|
15
37
|
SUPPORTED_COMPRESSION_ENCODINGS = %w[ gzip br zstd ].freeze
|
|
16
38
|
|
|
17
|
-
#
|
|
39
|
+
# dash-proxy maps `brotli` onto the `br` token that travels in Content-Encoding.
|
|
18
40
|
COMPRESSION_ENCODING_ALIASES = { "brotli" => "br" }.freeze
|
|
19
41
|
|
|
20
42
|
# The layering contract. When the fork's load balancer fronts the per-host
|
|
@@ -32,7 +54,7 @@ class Dash::Configuration::Proxy
|
|
|
32
54
|
# Without load balancing the single proxy is every layer at once and the
|
|
33
55
|
# whole surface applies to it.
|
|
34
56
|
DEPLOY_OPTION_DISPOSITIONS = {
|
|
35
|
-
# --- Edge: TLS terminates where the handshake happens, and
|
|
57
|
+
# --- Edge: TLS terminates where the handshake happens, and dash-proxy
|
|
36
58
|
# gates TLSRedirect on TLSEnabled, so the whole family travels together.
|
|
37
59
|
host: :edge,
|
|
38
60
|
tls: :edge,
|
|
@@ -59,7 +81,7 @@ class Dash::Configuration::Proxy
|
|
|
59
81
|
"rate-limit-burst": :edge,
|
|
60
82
|
"rate-limit-exempt": :edge,
|
|
61
83
|
|
|
62
|
-
# --- Edge:
|
|
84
|
+
# --- Edge: dash-proxy deletes the Authorization header once a service
|
|
63
85
|
# enforces basic auth, so an inner proxy would 401 the credential-less
|
|
64
86
|
# request the load balancer forwards. Credentials belong at the edge only.
|
|
65
87
|
"basic-auth": :edge,
|
|
@@ -311,7 +333,7 @@ class Dash::Configuration::Proxy
|
|
|
311
333
|
proxy_config["path_prefixes"] || proxy_config["path_prefix"]&.split(",") || []
|
|
312
334
|
end
|
|
313
335
|
|
|
314
|
-
# Nil when unset: the default lives in
|
|
336
|
+
# Nil when unset: the default lives in dash-proxy, not here.
|
|
315
337
|
def healthcheck_path
|
|
316
338
|
proxy_config.dig("healthcheck", "path")
|
|
317
339
|
end
|
|
@@ -370,7 +392,7 @@ class Dash::Configuration::Proxy
|
|
|
370
392
|
optionize ({ target: "#{target}:#{app_port}" }).merge(deploy_options), with: "="
|
|
371
393
|
end
|
|
372
394
|
|
|
373
|
-
#
|
|
395
|
+
# dash-proxy rollout deploy only accepts the target and the timeouts - the service already
|
|
374
396
|
# exists, so it keeps the host, TLS, buffering and logging options of the live deploy.
|
|
375
397
|
def rollout_deploy_options
|
|
376
398
|
{
|
|
@@ -426,7 +448,7 @@ class Dash::Configuration::Proxy
|
|
|
426
448
|
primary_role.present? && primary_role.running_proxy? && Array(primary_role.hosts).size > 1
|
|
427
449
|
end
|
|
428
450
|
|
|
429
|
-
# Flags for
|
|
451
|
+
# Flags for dash-proxy's dynamic domain source (runtime TLS hostnames).
|
|
430
452
|
# TLS terminates wherever these flags land — :edge in the layering contract.
|
|
431
453
|
def ssl_domains_options
|
|
432
454
|
{
|
|
@@ -449,7 +471,7 @@ class Dash::Configuration::Proxy
|
|
|
449
471
|
# The connection pool between the proxy and this app's containers, and how
|
|
450
472
|
# hard the proxy tries to place a request on a healthy one.
|
|
451
473
|
#
|
|
452
|
-
# Every value is passed through exactly as written.
|
|
474
|
+
# Every value is passed through exactly as written. dash-proxy resolves its
|
|
453
475
|
# own defaults from a zero (target_pool.go), and it has to do that server
|
|
454
476
|
# side because restored state and older RPC clients never see the CLI — so
|
|
455
477
|
# substituting a default here would be both redundant and wrong.
|
|
@@ -517,7 +539,7 @@ class Dash::Configuration::Proxy
|
|
|
517
539
|
proxy_config["headers"] || {}
|
|
518
540
|
end
|
|
519
541
|
|
|
520
|
-
#
|
|
542
|
+
# dash-proxy cuts a rule at the first colon, so a value carrying colons of
|
|
521
543
|
# its own arrives intact.
|
|
522
544
|
def header_rules(direction, verb)
|
|
523
545
|
(headers_config.dig(direction, verb) || {}).map { |name, value| "#{name}: #{value}" }.presence
|
|
@@ -574,7 +596,7 @@ class Dash::Configuration::Proxy
|
|
|
574
596
|
|
|
575
597
|
# The cache policy, which is per service - the store it writes into is
|
|
576
598
|
# proxy-wide and lives in proxy/run/cache. Only --cache is derived from a
|
|
577
|
-
# truthy key; every other default stays in
|
|
599
|
+
# truthy key; every other default stays in dash-proxy, so an unset key emits
|
|
578
600
|
# nothing rather than restating a default the gem would then have to track.
|
|
579
601
|
def cache_options
|
|
580
602
|
cache = proxy_config["cache"] || {}
|
|
@@ -600,7 +622,7 @@ class Dash::Configuration::Proxy
|
|
|
600
622
|
File.join([ directory, role_name, filename ].compact)
|
|
601
623
|
end
|
|
602
624
|
|
|
603
|
-
#
|
|
625
|
+
# dash-proxy takes the credential as <username>:<password> and cuts at the
|
|
604
626
|
# first colon, so a password may contain colons but a username may not (the
|
|
605
627
|
# validator enforces that). The password is read from .dash/secrets when
|
|
606
628
|
# password_secret names it, so it need not live in deploy.yml.
|
|
@@ -628,7 +650,7 @@ class Dash::Configuration::Proxy
|
|
|
628
650
|
Dash::Utils.sensitive("#{basic_auth["username"]}:#{password}")
|
|
629
651
|
end
|
|
630
652
|
|
|
631
|
-
# Serves both --path-timeout and --path-request-timeout, which
|
|
653
|
+
# Serves both --path-timeout and --path-request-timeout, which dash-proxy
|
|
632
654
|
# reads with one parser. A duration may be a Go string ("5m") or plain
|
|
633
655
|
# seconds; 0 is a value, meaning no limit for that prefix.
|
|
634
656
|
def path_timeout_args(key)
|
|
@@ -148,7 +148,7 @@ class Dash::Configuration::Role
|
|
|
148
148
|
def readiness_description
|
|
149
149
|
case readiness_source
|
|
150
150
|
when :proxy
|
|
151
|
-
[ "
|
|
151
|
+
[ "dash-proxy health check", proxy.healthcheck_path ].compact.join(" ")
|
|
152
152
|
when :healthcheck
|
|
153
153
|
healthcheck.port ? "healthcheck #{healthcheck.path}:#{healthcheck.port}" : "healthcheck (custom cmd)"
|
|
154
154
|
when :healthcheck_exec
|
|
@@ -168,7 +168,7 @@ class Dash::Configuration::Role
|
|
|
168
168
|
end
|
|
169
169
|
|
|
170
170
|
def stop_args
|
|
171
|
-
# When deploying with the proxy,
|
|
171
|
+
# When deploying with the proxy, dash-proxy will drain request before returning so we don't need to wait.
|
|
172
172
|
timeout = stop_timeout || (running_proxy? ? nil : config.drain_timeout)
|
|
173
173
|
|
|
174
174
|
[ *argumentize("-t", timeout) ]
|