feat: Auto-import n8n RAG workflow with credentials

- Fixed n8n API login: use 'emailOrLdapLoginId' instead of 'email'
- Added n8n_setup_rag_workflow() function to libsupabase.sh
- Creates PostgreSQL and Ollama credentials automatically
- Imports RAG KI-Bot workflow with correct credential references
- Removed tags from workflow JSON (API validation issue)
- Step 10 now fully automated: credentials + workflow import

Tested successfully on container sb-1769173910
This commit is contained in:
2026-01-23 14:15:16 +01:00
parent b308c91a7b
commit ff1526cc83
11 changed files with 2181 additions and 307 deletions
+52 -35
View File
@@ -1,52 +1,69 @@
#!/bin/bash
# delete_stopped_lxc.sh - Löscht alle gestoppten LXC Container auf PVE
# Skript zum Löschen aller gestoppten LXCs auf dem lokalen Proxmox-Node
# Verwendet pct destroy und berücksichtigt nur den lokalen Node
set -e
# Überprüfen, ob das Skript als Root ausgeführt wird
if [ "$(id -u)" -ne 0 ]; then
echo "Dieses Skript muss als Root ausgeführt werden." >&2
exit 1
fi
# Farben für Output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Überprüfen, ob pct verfügbar ist
if ! command -v pct &> /dev/null; then
echo "pct ist nicht installiert. Bitte installieren Sie es zuerst." >&2
exit 1
fi
echo -e "${YELLOW}=== Gestoppte LXC Container finden ===${NC}\n"
# Alle gestoppten LXCs auf dem lokalen Node abrufen
echo "Suche nach gestoppten LXCs auf diesem Node..."
stopped_lxcs=$(pct list | awk '$2 == "stopped" {print $1}')
# Array für gestoppte Container
declare -a STOPPED_CTS
if [ -z "$stopped_lxcs" ]; then
echo "Keine gestoppten LXCs auf diesem Node gefunden."
# Alle Container durchgehen und gestoppte finden
while read -r line; do
VMID=$(echo "$line" | awk '{print $1}')
STATUS=$(echo "$line" | awk '{print $2}')
NAME=$(echo "$line" | awk '{print $3}')
if [[ "$STATUS" == "stopped" ]]; then
STOPPED_CTS+=("$VMID:$NAME")
echo -e " ${RED}[STOPPED]${NC} CT $VMID - $NAME"
fi
done < <(pct list | tail -n +2)
# Prüfen ob gestoppte Container gefunden wurden
if [[ ${#STOPPED_CTS[@]} -eq 0 ]]; then
echo -e "\n${GREEN}Keine gestoppten Container gefunden.${NC}"
exit 0
fi
echo "Gefundene gestoppte LXCs auf diesem Node:"
echo "$stopped_lxcs" | while read -r lxc_id; do
lxc_name=$(pct config $lxc_id | grep '^hostname:' | awk '{print $2}')
echo " $lxc_id - $lxc_name"
done
echo -e "\n${YELLOW}Gefunden: ${#STOPPED_CTS[@]} gestoppte Container${NC}\n"
# Bestätigung einholen
read -p "Möchten Sie diese LXCs wirklich löschen? (y/n): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo "Löschvorgang abgebrochen."
# Bestätigung anfordern
read -p "Möchten Sie ALLE gestoppten Container unwiderruflich löschen? (ja/nein): " CONFIRM
if [[ "$CONFIRM" != "ja" ]]; then
echo -e "${GREEN}Abgebrochen. Keine Container wurden gelöscht.${NC}"
exit 0
fi
# LXCs löschen
echo "Lösche gestoppte LXCs..."
for lxc_id in $stopped_lxcs; do
echo "Lösche LXC $lxc_id..."
pct destroy $lxc_id
if [ $? -eq 0 ]; then
echo "LXC $lxc_id erfolgreich gelöscht."
# Zweite Bestätigung
read -p "Sind Sie WIRKLICH sicher? Tippen Sie 'LÖSCHEN' ein: " CONFIRM2
if [[ "$CONFIRM2" != "LÖSCHEN" ]]; then
echo -e "${GREEN}Abgebrochen. Keine Container wurden gelöscht.${NC}"
exit 0
fi
echo -e "\n${RED}=== Lösche Container ===${NC}\n"
# Container löschen
for CT in "${STOPPED_CTS[@]}"; do
VMID="${CT%%:*}"
NAME="${CT##*:}"
echo -n "Lösche CT $VMID ($NAME)... "
if pct destroy "$VMID" --purge 2>/dev/null; then
echo -e "${GREEN}OK${NC}"
else
echo "Fehler beim Löschen von LXC $lxc_id." >&2
echo -e "${RED}FEHLER${NC}"
fi
done
echo "Vorgang abgeschlossen."
echo -e "\n${GREEN}=== Fertig ===${NC}"