Format Caddyfile

This commit is contained in:
Florian Zirker 2024-12-10 13:45:54 +01:00
parent 02e5e0b682
commit 8325b9a759
4 changed files with 79 additions and 74 deletions

View file

@ -16,3 +16,12 @@ tab_width = 2
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[Caddyfile]
indent_style = tab
indent_size = 4
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View file

@ -1,91 +1,85 @@
{ {
# acme_ca https://acme-v02.api.letsencrypt.org/directory email {env.EMAIL}
email {env.EMAIL} log default {
log { output stdout
format console format console
} }
} }
*.{$DOMAIN} { *.{$DOMAIN} {
tls { tls {
dns netcup { dns netcup {
customer_number {env.NETCUP_CUSTOMER_NUMBER} customer_number {env.NETCUP_CUSTOMER_NUMBER}
api_key {env.NETCUP_API_KEY} api_key {env.NETCUP_API_KEY}
api_password {env.NETCUP_API_PASSWORD} api_password {env.NETCUP_API_PASSWORD}
} }
propagation_timeout 900s propagation_timeout 900s
propagation_delay 600s propagation_delay 600s
resolvers 46.38.225.230 46.38.252.230 resolvers 46.38.225.230 46.38.252.230
} }
header Strict-Transport-Security "max-age=63072000" header Strict-Transport-Security "max-age=63072000"
@git host git.{$DOMAIN} @git host git.{$DOMAIN}
handle @git { handle @git {
reverse_proxy forgejo:3000 reverse_proxy forgejo:3000
} }
@news host news.{$DOMAIN} @news host news.{$DOMAIN}
handle @news { handle @news {
reverse_proxy miniflux:8080 reverse_proxy miniflux:8080
} }
@nc-push expression `(host('cloud.{$DOMAIN}') && path('/push/*'))` @nc-push expression `(host('cloud.{$DOMAIN}') && path('/push/*'))`
handle @nc-push { handle @nc-push {
reverse_proxy push:7867 reverse_proxy push:7867
} }
@nextcloud host cloud.{$DOMAIN} @nextcloud host cloud.{$DOMAIN}
handle @nextcloud { handle @nextcloud {
reverse_proxy webserver-nextcloud:80 reverse_proxy webserver-nextcloud:80
} }
@office host office.{$DOMAIN} @office host office.{$DOMAIN}
handle @office { handle @office {
reverse_proxy collabora:9980 reverse_proxy collabora:9980
} }
@drawio host drawio.{$DOMAIN} @drawio host drawio.{$DOMAIN}
handle @drawio { handle @drawio {
reverse_proxy drawio:8080 reverse_proxy drawio:8080
} }
@whoami host whoami.{$DOMAIN} @whoami host whoami.{$DOMAIN}
handle @whoami { handle @whoami {
reverse_proxy whoami:80 reverse_proxy whoami:80
} }
@push host push.{$DOMAIN} @push host push.{$DOMAIN}
handle @push { handle @push {
reverse_proxy ntfy:80 reverse_proxy ntfy:80
} }
@wallabag host wallabag.{$DOMAIN} @wallabag host wallabag.{$DOMAIN}
handle @wallabag { handle @wallabag {
reverse_proxy wallabag:80 reverse_proxy wallabag:80
} }
@www host www.{$DOMAIN} @www host www.{$DOMAIN}
handle @www { handle @www {
reverse_proxy webserver-www:80 reverse_proxy webserver-www:80
} }
@mail host mail.{$DOMAIN} @mail host mail.{$DOMAIN}
handle @mail { handle @mail {
reverse_proxy nginx-mailcow:8090 reverse_proxy nginx-mailcow:8090
} }
# Fallback for otherwise unhandled domains # Fallback for otherwise unhandled domains
handle { handle {
respond 404 respond 404
} }
} }
{$DOMAIN} { {$DOMAIN} {
redir https://www.{$DOMAIN}{uri} redir https://www.{$DOMAIN}{uri}
} }

View file

@ -11,9 +11,9 @@ services:
- "443:443" - "443:443"
- "443:443/udp" - "443:443/udp"
volumes: volumes:
- $PWD/caddy/Caddyfile:/etc/caddy/Caddyfile - $PWD/caddy/Caddyfile:/etc/caddy/Caddyfile
- ${STORAGE_PATH}/caddy/data:/data - ${STORAGE_PATH}/caddy/data:/data
- ${STORAGE_PATH}/caddy/config:/config - ${STORAGE_PATH}/caddy/config:/config
environment: environment:
- NETCUP_CUSTOMER_NUMBER=${NETCUP_CUSTOMER_NUMBER} - NETCUP_CUSTOMER_NUMBER=${NETCUP_CUSTOMER_NUMBER}
- NETCUP_API_KEY=${NETCUP_API_KEY} - NETCUP_API_KEY=${NETCUP_API_KEY}

2
proxy/reload.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
docker compose exec -w /etc/caddy caddy caddy reload