feat: complete n8n stack setup

Docker Compose stack (n8n, PostgreSQL 16, Redis 7, 1 worker) with:
- nginx local proxy on port 8088, YunoHost TLS termination config
- helper scripts: backup/restore/import/export/update
- .env.example, README with architecture, ops commands, to-do list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-05-05 17:31:59 +02:00
commit 87cd005352
12 changed files with 586 additions and 2 deletions

48
scripts/backup-n8n.sh Executable file
View file

@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(dirname "$SCRIPT_DIR")"
COMPOSE="$ROOT/compose/docker-compose.yml"
ENV="$ROOT/.env"
BACKUP_DIR="$ROOT/backups"
MAX_BACKUPS=2
# shellcheck source=/dev/null
source "$ENV"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
TARGET="$BACKUP_DIR/backup_$TIMESTAMP"
mkdir -p "$TARGET"
echo "[backup] Starte Backup → $TARGET"
# PostgreSQL dump
echo "[backup] Datenbank-Dump..."
docker compose -f "$COMPOSE" exec -T postgres \
pg_dump -U "$POSTGRES_USER" "$POSTGRES_DB" \
> "$TARGET/postgres.sql"
# n8n data
echo "[backup] n8n Datendirectory..."
tar -czf "$TARGET/n8n-data.tar.gz" -C "$ROOT/data" n8n
# Compose-Konfiguration
echo "[backup] Compose + .env..."
cp "$COMPOSE" "$TARGET/docker-compose.yml"
cp "$ENV" "$TARGET/.env"
echo "[backup] Backup abgeschlossen: $TARGET"
# Retention: nur die letzten MAX_BACKUPS behalten
EXISTING=$(ls -dt "$BACKUP_DIR"/backup_* 2>/dev/null)
COUNT=$(echo "$EXISTING" | wc -l)
if [ "$COUNT" -gt "$MAX_BACKUPS" ]; then
TO_DELETE=$(echo "$EXISTING" | tail -n +"$((MAX_BACKUPS + 1))")
echo "[backup] Lösche alte Backups:"
echo "$TO_DELETE"
echo "$TO_DELETE" | xargs rm -rf
fi
echo "[backup] Fertig. Aktuelle Backups:"
ls -lht "$BACKUP_DIR"