Files
lucashahmannandClaude Opus 5.5 e66f89f49e feat: ATM10-Statistikportal
Statistikportal für den All-the-Mods-10-Server (Minecraft 1.21.1, NeoForge 21.1):

- mod/: serverseitige NeoForge-Mod atmstats – Ereignisse, Live-Zähler, Servergesundheit,
  FTB-Dateien; Outbox auf der Festplatte, signierter gzip-Versand per HTTPS mit Backoff
- backend/: Fastify + PostgreSQL – idempotenter Ingest, Projektionen, Parser für SNBT,
  FTB Quests/Teams, world/stats, world/advancements und latest.log; Ranglisten, Snapshots,
  Retention, öffentliche API, SSE-Live-Updates, Admin mit argon2/CSRF, SFTP-Worker
- web/: Next.js-Dashboard – Übersicht, Ranglisten, Spielerprofile, ATM10, Server,
  Datenquellen, Verwaltung
- shared/: Protokoll v1 und API-Typen; tools/: Simulator, Log-Anonymisierer, RCON-Client
- deploy/: Docker Compose hinter Traefik, Backup; docs/: Architektur, Datenquellen, Betrieb

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:33:25 +02:00

35 lines
1018 B
Bash
Raw Permalink 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.
#!/bin/sh
# PostgreSQL-Backup für ATM10 Stats.
# backup.sh once – ein Backup jetzt erstellen
# backup.sh loop – täglich ein Backup, ältere als BACKUP_KEEP_DAYS (Standard 14) löschen
# Erwartet PGHOST, PGUSER, PGDATABASE, PGPASSWORD (im Compose-Service gesetzt).
set -u
DIR=/backups
KEEP="${BACKUP_KEEP_DAYS:-14}"
# Each step checks its own result: inside "backup_once || …" the shell ignores set -e.
backup_once() {
file="$DIR/atm-$(date -u +%Y%m%dT%H%M%SZ).dump"
if ! pg_dump --format=custom --file="$file.partial"; then
rm -f "$file.partial"
echo "backup: FAILED (pg_dump)" >&2
return 1
fi
mv "$file.partial" "$file" || { echo "backup: FAILED (mv)" >&2; return 1; }
find "$DIR" -name 'atm-*.dump' -mtime +"$KEEP" -delete
echo "backup: $file ($(du -h "$file" | cut -f1))"
}
mkdir -p "$DIR"
case "${1:-once}" in
once) backup_once ;;
loop)
while true; do
backup_once
sleep 86400
done
;;
*) echo "usage: backup.sh once|loop" >&2; exit 2 ;;
esac