diff --git a/Caddyfile b/Caddyfile index cc08871..305dcba 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,6 +1,11 @@ { log default { output stdout + output file /var/log/caddy/caddy_main.log { + roll_size 100MiB + roll_keep 5 + roll_keep_for 100d + } format json } @@ -16,6 +21,13 @@ :53100 { log { level INFO + output stdout + output file /var/log/caddy/caddy_grafana.log { + roll_size 100MiB + roll_keep 5 + roll_keep_for 100d + } + format json } reverse_proxy host.containers.internal:3100 @@ -26,6 +38,13 @@ :53000 { log { level INFO + output stdout + output file /var/log/caddy/caddy_forgejo.log { + roll_size 100MiB + roll_keep 5 + roll_keep_for 100d + } + format json } reverse_proxy host.containers.internal:3000 @@ -36,6 +55,13 @@ :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 + } + format json } reverse_proxy host.containers.internal:2052 @@ -46,6 +72,13 @@ :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 diff --git a/promtail.yml b/promtail.yml new file mode 100644 index 0000000..a2cdd8a --- /dev/null +++ b/promtail.yml @@ -0,0 +1,28 @@ +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +# See spadinastan/panopticon +clients: +- url: http://host.containers.internal:3101/loki/api/v1/push + +scrape_configs: +- job_name: caddy + static_configs: + - targets: + - localhost + labels: + job: caddy + __path__: /var/caddy-logs/* + agent: caddy-promtail + pipeline_stages: + - json: + expressions: + duration: duration + status: status + - labels: + duration: + status: diff --git a/service.yml b/service.yml index 682352c..2ab3d10 100644 --- a/service.yml +++ b/service.yml @@ -1,5 +1,6 @@ name: sesame ports: + # Reverse proxied ports. - host: 53100 container: 53100 - host: 53000 @@ -8,11 +9,13 @@ ports: container: 52052 - host: 53001 container: 53001 + # Caddy admin API - host: 2019 container: 2019 volumes: - name: caddy-data - name: caddy-config + - name: caddy-logs containers: - name: caddy image: caddy:2.8.4-alpine @@ -21,7 +24,17 @@ containers: container: /data - name: caddy-config container: /config + - name: caddy-logs + container: /var/log/caddy - host: ./Caddyfile container: /etc/caddy/Caddyfile readonly: true - + - name: promtail + image: grafana/promtail:main-a08ee68 # Updated: 11/6/2024 + volumes: + - name: caddy-logs + container: /var/caddy-logs + readonly: true + - host: ./promtail.yml + container: /etc/promtail/config.yml + readonly: true