Files
hx-ki.com2/repos/hxki-inventory/chaos/hxki_caddy_services_setup.sh
2026-03-06 15:22:40 +00:00

63 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
CADDYFILE="/opt/hx-caddy/Caddyfile"
echo "==> Prüfe, ob Caddyfile existiert ..."
if [ ! -f "$CADDYFILE" ]; then
echo "FEHLER: $CADDYFILE nicht gefunden."
exit 1
fi
BACKUP="/opt/hx-caddy/Caddyfile.bak.$(date +%Y%m%d%H%M%S)"
echo "==> Backup der Caddyfile nach: $BACKUP"
cp "$CADDYFILE" "$BACKUP"
add_block () {
local host="$1"
local block="$2"
if grep -q "^[[:space:]]*${host}[[:space:]]*{" "$CADDYFILE"; then
echo "==> Block für ${host} existiert schon überspringe."
else
echo "==> Füge Block für ${host} hinzu ..."
printf "\n%s\n\n" "$block" >> "$CADDYFILE"
fi
}
# Grafana
add_block "grafana.hx-ki.com" \
"grafana.hx-ki.com {
reverse_proxy hxki-grafana:3000
}"
# Gitea (git.hx-ki.com)
add_block "git.hx-ki.com" \
"git.hx-ki.com {
reverse_proxy hxki-gitea:3000
}"
# Syncthing (sync.hx-ki.com)
add_block "sync.hx-ki.com" \
"sync.hx-ki.com {
reverse_proxy hxki-syncthing:8384
}"
# Mautic
add_block "mautic.hx-ki.com" \
"mautic.hx-ki.com {
reverse_proxy hxki-mautic:80
}"
echo "==> Starte Caddy neu ..."
docker restart hx-caddy-caddy-1
echo "=================================================="
echo "FERTIG."
echo "Folgende URLs sollten jetzt funktionieren (wenn DNS auf 49.12.97.28 zeigt):"
echo " https://grafana.hx-ki.com"
echo " https://git.hx-ki.com"
echo " https://sync.hx-ki.com"
echo " https://mautic.hx-ki.com"
echo "=================================================="