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:
parent
78aa8da747
commit
87cd005352
12 changed files with 586 additions and 2 deletions
50
scripts/restore-n8n.sh
Executable file
50
scripts/restore-n8n.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/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"
|
||||
|
||||
if [ -z "${1:-}" ]; then
|
||||
echo "Verwendung: $0 <backup-verzeichnis>"
|
||||
echo "Verfügbare Backups:"
|
||||
ls -lht "$ROOT/backups/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BACKUP="$1"
|
||||
if [ ! -d "$BACKUP" ]; then
|
||||
echo "Fehler: Verzeichnis '$BACKUP' nicht gefunden."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$ENV"
|
||||
|
||||
echo "[restore] Stelle wieder her aus: $BACKUP"
|
||||
echo "[restore] Stack wird gestoppt..."
|
||||
docker compose -f "$COMPOSE" down
|
||||
|
||||
# n8n data
|
||||
echo "[restore] n8n Daten..."
|
||||
rm -rf "$ROOT/data/n8n"
|
||||
mkdir -p "$ROOT/data/n8n"
|
||||
tar -xzf "$BACKUP/n8n-data.tar.gz" -C "$ROOT/data"
|
||||
|
||||
# Postgres
|
||||
echo "[restore] Datenbank wird gestartet..."
|
||||
docker compose -f "$COMPOSE" up -d postgres
|
||||
echo "[restore] Warte auf PostgreSQL..."
|
||||
sleep 10
|
||||
|
||||
echo "[restore] Datenbank-Restore..."
|
||||
docker compose -f "$COMPOSE" exec -T postgres \
|
||||
psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" \
|
||||
< "$BACKUP/postgres.sql"
|
||||
|
||||
echo "[restore] Stack wird neu gestartet..."
|
||||
docker compose -f "$COMPOSE" up -d
|
||||
|
||||
echo "[restore] Fertig. Stack-Status:"
|
||||
docker compose -f "$COMPOSE" ps
|
||||
Loading…
Add table
Add a link
Reference in a new issue