-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add commands for managing proxy boot config. Since the proxy can be shared by multiple applications, the configuration doesn't belong in `config/deploy.yml`. Instead you can set the config with: ``` Usage: kamal proxy boot_config <set|get|clear> Options: [--publish], [--no-publish], [--skip-publish] # Publish the proxy ports on the host # Default: true [--http-port=N] # HTTP port to publish on the host # Default: 80 [--https-port=N] # HTTPS port to publish on the host # Default: 443 [--docker-options=option=value option2=value2] # Docker options to pass to the proxy container ``` By default we boot the proxy with `--publish 80:80 --publish 443:443`. You can stop it from publishing ports, specify different ports and pass other docker options. The config is stored in `.kamal/proxy/options` as arguments to be passed verbatim to docker run. Where someone wants to set the options in their application they can do that by calling `kamal proxy boot_config set` in a pre-deploy hook. There's an example in the integration tests showing how to use this to front kamal-proxy with Traefik, using an accessory.
- Loading branch information
Showing
15 changed files
with
241 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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
3 changes: 3 additions & 0 deletions
3
test/integration/docker/deployer/app_with_traefik/.kamal/hooks/pre-deploy
This file contains 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,3 @@ | ||
kamal proxy boot_config set --publish false \ | ||
--docker_options label=traefik.http.services.kamal_proxy.loadbalancer.server.scheme=http \ | ||
label=traefik.http.routers.kamal_proxy.rule=PathPrefix\(\`/\`\) |
1 change: 1 addition & 0 deletions
1
test/integration/docker/deployer/app_with_traefik/.kamal/secrets
This file contains 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 @@ | ||
SECRET_TOKEN='1234 with "中文"' |
This file contains 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,9 @@ | ||
FROM registry:4443/nginx:1-alpine-slim | ||
|
||
COPY default.conf /etc/nginx/conf.d/default.conf | ||
|
||
ARG COMMIT_SHA | ||
RUN echo $COMMIT_SHA > /usr/share/nginx/html/version | ||
RUN mkdir -p /usr/share/nginx/html/versions && echo "version" > /usr/share/nginx/html/versions/$COMMIT_SHA | ||
RUN mkdir -p /usr/share/nginx/html/versions && echo "hidden" > /usr/share/nginx/html/versions/.hidden | ||
RUN echo "Up!" > /usr/share/nginx/html/up |
29 changes: 29 additions & 0 deletions
29
test/integration/docker/deployer/app_with_traefik/config/deploy.yml
This file contains 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,29 @@ | ||
service: app_with_traefik | ||
image: app_with_traefik | ||
servers: | ||
- vm1 | ||
- vm2 | ||
deploy_timeout: 2 | ||
drain_timeout: 2 | ||
readiness_delay: 0 | ||
|
||
registry: | ||
server: registry:4443 | ||
username: root | ||
password: root | ||
builder: | ||
driver: docker | ||
arch: <%= Kamal::Utils.docker_arch %> | ||
args: | ||
COMMIT_SHA: <%= `git rev-parse HEAD` %> | ||
accessories: | ||
traefik: | ||
service: traefik | ||
image: traefik:v2.10 | ||
port: 80 | ||
cmd: "--providers.docker" | ||
options: | ||
volume: | ||
- "/var/run/docker.sock:/var/run/docker.sock" | ||
roles: | ||
- web |
17 changes: 17 additions & 0 deletions
17
test/integration/docker/deployer/app_with_traefik/default.conf
This file contains 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,17 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
} | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
Oops, something went wrong.