Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/kamal/configuration/docs/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ proxy:
# HTTPS traffic), you can disable this redirect by setting `ssl_redirect: false`:
ssl_redirect: false

# ACME cache path
#
# The directory where kamal-proxy stores Let's Encrypt certificates and account keys.
# The path is inside the kamal-proxy container. Use a path on a persistent volume,
# such as below `/home/kamal-proxy/.config/kamal-proxy`, so that the certificates
# are kept when the proxy restarts.
#
# If you mount a shared volume at this path, multiple kamal-proxy instances can share
# the Let's Encrypt certificates for the same domains.
#
# Defaults to the kamal-proxy certificate directory:
ssl_acme_cache_path: /home/kamal-proxy/.config/kamal-proxy/certs

# Forward headers
#
# Whether to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers.
Expand Down
1 change: 1 addition & 0 deletions lib/kamal/configuration/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def deploy_options
tls: ssl? ? true : nil,
"tls-certificate-path": container_tls_cert,
"tls-private-key-path": container_tls_key,
"tls-acme-cache-path": proxy_config["ssl_acme_cache_path"],
"deploy-timeout": seconds_duration(config.deploy_timeout),
"drain-timeout": seconds_duration(config.drain_timeout),
"health-check-interval": seconds_duration(proxy_config.dig("healthcheck", "interval")),
Expand Down
10 changes: 10 additions & 0 deletions test/configuration/proxy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ class ConfigurationProxyTest < ActiveSupport::TestCase
end
end

test "deploy options with acme cache path" do
@deploy[:proxy] = { "ssl" => true, "host" => "example.com", "ssl_acme_cache_path" => "/home/kamal-proxy/.config/kamal-proxy/acme" }
assert_equal "/home/kamal-proxy/.config/kamal-proxy/acme", config.proxy.deploy_options[:"tls-acme-cache-path"]
end

test "deploy options without acme cache path" do
@deploy[:proxy] = { "ssl" => true, "host" => "example.com" }
assert_not config.proxy.deploy_options.key?(:"tls-acme-cache-path")
end

test "ssl with certificate and no private key" do
with_test_secrets("secrets" => "CERT_PEM=certificate") do
@deploy[:proxy] = {
Expand Down
Loading