From 38be6c13f76e893cf47636257071b440dec0c5b2 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Sun, 7 Sep 2025 17:32:13 +0200 Subject: initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- bundles/lhost/files/Caddyfile | 45 ++++++++++++++++++++++++++++++++++++++++ bundles/lhost/files/lhost-prune | 20 ++++++++++++++++++ bundles/lhost/files/lhost.conf | 1 + bundles/lhost/files/traefik.yaml | 18 ++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 bundles/lhost/files/Caddyfile create mode 100755 bundles/lhost/files/lhost-prune create mode 100644 bundles/lhost/files/lhost.conf create mode 100644 bundles/lhost/files/traefik.yaml (limited to 'bundles/lhost/files') diff --git a/bundles/lhost/files/Caddyfile b/bundles/lhost/files/Caddyfile new file mode 100644 index 0000000..497ef30 --- /dev/null +++ b/bundles/lhost/files/Caddyfile @@ -0,0 +1,45 @@ +# vim: noet ts=2 sw=2 +{ + admin off + auto_https off + http_port {$CADDY_HTTP_PORT:1414} +} + +http:// { + encode zstd gzip + + handle /healthz { + respond OK 200 + } + + handle { + root . + file_server { + hide Caddyfile + hide .keep + } + } + + # catch all + respond 404 + + log { + format filter { + wrap console { + time_format wall_milli + level_format color + } + fields { + common_log delete + request>headers>Accept-Encoding delete + request>headers>Accept-Language delete + request>headers>Connection delete + request>headers>Authorization delete + request>remote_addr ip_mask { + ipv4 24 + ipv6 32 + } + } + } + } +} diff --git a/bundles/lhost/files/lhost-prune b/bundles/lhost/files/lhost-prune new file mode 100755 index 0000000..8788941 --- /dev/null +++ b/bundles/lhost/files/lhost-prune @@ -0,0 +1,20 @@ +#!/bin/sh +set -eu + +main() { + local dryrun=$(test -n "${DRYRUN:-}" && printf echo) + local root=${ROOT:-/var/www/lhost} + local maxage=${MAXAGE:-30} + + find ${root} \ + -type f \ + -mtime ${maxage} \ + -not \( \ + -name 'Caddyfile' -or \ + -name '.keep' -or \ + -name "$(cat ${root}/.keep)" \ + \) \ + -exec ${dryrun} rm -rv {} + +} + +main >/dev/null 2>&1 diff --git a/bundles/lhost/files/lhost.conf b/bundles/lhost/files/lhost.conf new file mode 100644 index 0000000..fbf2dc6 --- /dev/null +++ b/bundles/lhost/files/lhost.conf @@ -0,0 +1 @@ +www_port=${node.metadata.get("www/lhost/port")} diff --git a/bundles/lhost/files/traefik.yaml b/bundles/lhost/files/traefik.yaml new file mode 100644 index 0000000..d1722a0 --- /dev/null +++ b/bundles/lhost/files/traefik.yaml @@ -0,0 +1,18 @@ +http: + services: + lhost: + loadBalancer: + servers: + - url: http://${node.metadata.get("container_gateway", "10.89.0.1")}:${node.metadata.get("www/lhost/port")} + + routers: + lhost: + rule: Host(`l.gzr.im`) + entryPoints: + - http + - https + service: lhost + middlewares: + - tls-redirect@file + tls: + certResolver: le -- cgit 1.4.1