Repository navigation
feat(proxy): deploy.yml plumbing for redirects_source, deny lists, cert transfer and per-zone DNS providers #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
583d574
chore(proxy): require kamal-proxy v1.0.0.2
mhenrixon 33f7d83
feat(proxy): redirects_source, deny lists and per-zone DNS-01 providers
mhenrixon 5c48bbc
feat(proxy): kamal proxy export_certs / import_certs
mhenrixon e57caac
chore(proxy): move the proxy image to ghcr.io/zoolutions, require v1.…
mhenrixon 75ab6d9
fix(integration): fail setup.sh at a broken seed pull
mhenrixon 43d03ed
fix(proxy): harden cert transfer per review; finish org sweep
mhenrixon eece8f3
fix(integration): surface setup.sh stderr in the harness failure message
mhenrixon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Certificate store transfer, shared by the proxy and loadbalancer command | ||
| # builders (kamal proxy export_certs / import_certs). | ||
| # | ||
| # Archives leave through the apps-config bind mount — the one container path | ||
| # that is also a host path — and arrive through stdin into a one-off container: | ||
| # a bind-mounted source would need host permissions the container user cannot | ||
| # be guaranteed to have, and the store must be written as the image's own user | ||
| # or the proxy cannot read it afterwards. | ||
| # | ||
| # The including class provides `container_name`, `cert_store_volume_args` (the | ||
| # config volume mount) and `one_off_image` (the image tokens for a one-off | ||
| # container). | ||
| module Kamal::Commands::Proxy::CertTransfer | ||
| CERT_ARCHIVE_FILENAME = "certs-export.tar.gz" | ||
| CERT_IMPORT_STAGING_FILENAME = "certs-import" | ||
| CONTAINER_IMPORT_PATH = "/tmp/kamal-cert-import" | ||
|
|
||
| # Through the RPC socket of the running container, under the proxy's own | ||
| # certificate write lock, so a backup taken mid-renewal is never torn. | ||
| def export_certs | ||
| docker :exec, container_name, "kamal-proxy", :export, :certs, certs_archive_container_path | ||
| end | ||
|
|
||
| # Reads the data directory offline over the config volume — only safe when | ||
| # the container is stopped, which Kamal::Cli::Proxy guarantees. | ||
| def export_certs_offline | ||
| docker :run, "--rm", | ||
| *cert_store_volume_args, | ||
| *config.proxy_boot.apps_volume.docker_args, | ||
| *one_off_image, | ||
| "kamal-proxy", :export, :certs, certs_archive_container_path | ||
| end | ||
|
|
||
| # Offline by design (kamal-proxy import has no RPC path): the one-off | ||
| # container mounts the config volume — creating it when no proxy has booted | ||
| # yet, which is the Traefik-migration case — and the staged source streams | ||
| # through stdin. | ||
| def import_certs(traefik_acme: false, resolver: nil, force: false, verify: false) | ||
| source_flag = traefik_acme ? "traefik-acme" : "archive" | ||
| import_command = [ | ||
| "cat > #{CONTAINER_IMPORT_PATH} &&", | ||
| "kamal-proxy import certs", | ||
| *optionize({ source_flag => CONTAINER_IMPORT_PATH, resolver: resolver, force: force || nil, verify: verify || nil }.compact, with: "=") | ||
| ].join(" ") | ||
|
|
||
| [ | ||
| *docker(:run, "--rm", "--interactive", *cert_store_volume_args, *one_off_image, "sh", "-c", "'#{import_command}'"), | ||
|
mhenrixon marked this conversation as resolved.
Outdated
|
||
| "<", certs_import_host_path | ||
| ] | ||
| end | ||
|
|
||
| def certs_archive_host_path | ||
| File.join config.proxy_boot.apps_directory, CERT_ARCHIVE_FILENAME | ||
| end | ||
|
|
||
| def certs_archive_container_path | ||
| File.join config.proxy_boot.apps_container_directory, CERT_ARCHIVE_FILENAME | ||
| end | ||
|
|
||
| def certs_import_host_path | ||
| File.join config.proxy_boot.host_directory, CERT_IMPORT_STAGING_FILENAME | ||
| end | ||
|
|
||
| def remove_certs_archive | ||
| remove_file certs_archive_host_path | ||
| end | ||
|
|
||
| def remove_certs_import | ||
| remove_file certs_import_host_path | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.