|
|
@ -82,3 +82,89 @@ sudo make uninstall clean |
|
|
```sh |
|
|
```sh |
|
|
sudo make test |
|
|
sudo make test |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## What if I want to use a TLS certificate provided by the "lego" cookbook? |
|
|
|
|
|
|
|
|
|
|
|
**/etc/containers/systemd/traefik.container.d/lego.conf**: |
|
|
|
|
|
|
|
|
|
|
|
```ini |
|
|
|
|
|
[Unit] |
|
|
|
|
|
# Now, Traefik depends on the lego target, which will ensure that the TLS certificates are generated and available before Traefik starts |
|
|
|
|
|
After=lego.target |
|
|
|
|
|
Wants=lego.target |
|
|
|
|
|
|
|
|
|
|
|
[Container] |
|
|
|
|
|
# Mount the directory containing the TLS certificates generated by lego into the Traefik container |
|
|
|
|
|
Volume=/run/quadlets/traefik/tls:/etc/traefik/tls:Z |
|
|
|
|
|
|
|
|
|
|
|
# Health check on HTTPS |
|
|
|
|
|
HealthCmd=wget -q -O /dev/null --no-check-certificate --header 'Host: ping' https://127.0.0.1/ |
|
|
|
|
|
|
|
|
|
|
|
[Service] |
|
|
|
|
|
# Get the TLS certificates in place before starting traefik |
|
|
|
|
|
ExecStartPre=/bin/sh -c 'install -o 10001 -g 10000 -m 0600 -t /run/quadlets/traefik/tls /var/lib/quadlets/lego/certificates/*.crt /var/lib/quadlets/lego/certificates/*.key' |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
**/etc/quadlets/traefik/conf.d/tls.yaml**: |
|
|
|
|
|
|
|
|
|
|
|
```yaml |
|
|
|
|
|
tls: |
|
|
|
|
|
certificates: |
|
|
|
|
|
- certFile: /etc/traefik/tls/f.q.d.n.crt |
|
|
|
|
|
keyFile: /etc/traefik/tls/f.q.d.n.key |
|
|
|
|
|
stores: |
|
|
|
|
|
default: |
|
|
|
|
|
defaultCertificate: |
|
|
|
|
|
certFile: /etc/traefik/tls/f.q.d.n.crt |
|
|
|
|
|
keyFile: /etc/traefik/tls/f.q.d.n.key |
|
|
|
|
|
|
|
|
|
|
|
http: |
|
|
|
|
|
routers: |
|
|
|
|
|
traefik-ping-tls: |
|
|
|
|
|
rule: Host(`ping`) |
|
|
|
|
|
entryPoints: |
|
|
|
|
|
- https |
|
|
|
|
|
service: "ping@internal" |
|
|
|
|
|
tls: {} |
|
|
|
|
|
middlewares: |
|
|
|
|
|
- localhost-only |
|
|
|
|
|
middlewares: |
|
|
|
|
|
localhost-only: |
|
|
|
|
|
ipAllowList: |
|
|
|
|
|
sourceRange: |
|
|
|
|
|
- "127.0.0.1/32" |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
**/etc/quadlets/traefik/traefik.yaml**: |
|
|
|
|
|
|
|
|
|
|
|
```yaml |
|
|
|
|
|
entryPoints: |
|
|
|
|
|
# <-- no http entrypoint here |
|
|
|
|
|
https: |
|
|
|
|
|
address: ":443" |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
**/etc/tmpfiles.d/traefik-lego.conf**: |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
|
d /run/quadlets/traefik 0755 10001 10000 - |
|
|
|
|
|
d /run/quadlets/traefik/tls 0700 10001 10000 - |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
**/etc/quadlets/traefik/conf.d/$yoursite.yaml**: |
|
|
|
|
|
|
|
|
|
|
|
```yaml |
|
|
|
|
|
http: |
|
|
|
|
|
routers: |
|
|
|
|
|
example: |
|
|
|
|
|
rule: "Host(`service.example.test`)" |
|
|
|
|
|
entryPoints: |
|
|
|
|
|
- https |
|
|
|
|
|
service: "example" |
|
|
|
|
|
tls: {} # <-- this tells Traefik to enable TLS and find a matching certificate by SNI |
|
|
|
|
|
services: |
|
|
|
|
|
example: |
|
|
|
|
|
loadBalancer: |
|
|
|
|
|
servers: |
|
|
|
|
|
- url: "http://127.0.0.1:8080" |
|
|
|
|
|
``` |
|
|
|