refactor: abstract logging + proxy directives in caddyfile
This commit is contained in:
parent
2711671071
commit
08f886f5f4
1 changed files with 29 additions and 55 deletions
84
Caddyfile
84
Caddyfile
|
@ -1,3 +1,27 @@
|
|||
# Components
|
||||
|
||||
(application_logging) {
|
||||
log {
|
||||
level INFO
|
||||
output stdout
|
||||
output file /var/log/caddy/caddy_{args[0]}.log {
|
||||
roll_size 100MiB
|
||||
roll_keep 5
|
||||
roll_keep_for 100d
|
||||
}
|
||||
format json
|
||||
}
|
||||
}
|
||||
|
||||
(reverse_proxy_host) {
|
||||
reverse_proxy host.containers.internal:{args[0]}
|
||||
}
|
||||
|
||||
(application_base) {
|
||||
import application_logging {args[0]}
|
||||
import reverse_proxy_host {args[1]}
|
||||
}
|
||||
|
||||
{
|
||||
log default {
|
||||
output stdout
|
||||
|
@ -16,70 +40,20 @@
|
|||
admin :2019
|
||||
}
|
||||
|
||||
# Grafana
|
||||
# Routes
|
||||
|
||||
:53100 {
|
||||
log {
|
||||
level INFO
|
||||
output stdout
|
||||
output file /var/log/caddy/caddy_grafana.log {
|
||||
roll_size 100MiB
|
||||
roll_keep 5
|
||||
roll_keep_for 100d
|
||||
import application_base "grafana" 3100
|
||||
}
|
||||
format json
|
||||
}
|
||||
|
||||
reverse_proxy host.containers.internal:3100
|
||||
}
|
||||
|
||||
# Forgejo (web)
|
||||
|
||||
:53000 {
|
||||
log {
|
||||
level INFO
|
||||
output stdout
|
||||
output file /var/log/caddy/caddy_forgejo.log {
|
||||
roll_size 100MiB
|
||||
roll_keep 5
|
||||
roll_keep_for 100d
|
||||
import application_base "forgejo" 3000
|
||||
}
|
||||
format json
|
||||
}
|
||||
|
||||
reverse_proxy host.containers.internal:3000
|
||||
}
|
||||
|
||||
# Forgejo (ssh)
|
||||
|
||||
:52052 {
|
||||
log {
|
||||
level INFO
|
||||
output stdout
|
||||
output file /var/log/caddy/caddy_forgejo-ssh.log {
|
||||
roll_size 100MiB
|
||||
roll_keep 5
|
||||
roll_keep_for 100d
|
||||
import application_base "forgejo-ssh" 2052
|
||||
}
|
||||
format json
|
||||
}
|
||||
|
||||
reverse_proxy host.containers.internal:2052
|
||||
}
|
||||
|
||||
# Forgejo (postgres exporter / Prometheus)
|
||||
|
||||
:53001 {
|
||||
log {
|
||||
level INFO
|
||||
output stdout
|
||||
output file /var/log/caddy/caddy_forgejo-pg-exporter.log {
|
||||
roll_size 10MiB
|
||||
roll_keep 5
|
||||
roll_keep_for 10d
|
||||
}
|
||||
format json
|
||||
}
|
||||
|
||||
reverse_proxy host.containers.internal:3001
|
||||
import application_base "forgejo-pg-exporter" 3001
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue