# 🚀 BotKonzept - Quick Start Guide ## In 5 Schritten zur funktionierenden Registrierung --- ## ✅ Voraussetzungen - [ ] n8n läuft auf `https://n8n.userman.de` - [ ] PostgreSQL/Supabase Datenbank verfügbar - [ ] PVE20 Proxmox Server erreichbar - [ ] SMTP-Server oder Amazon SES konfiguriert --- ## 📋 Schritt 1: Datenbank einrichten (5 Minuten) ```bash # Auf Ihrem PostgreSQL/Supabase Server psql -U postgres -d botkonzept < sql/botkonzept_schema.sql ``` **Oder in Supabase Dashboard:** 1. SQL Editor öffnen 2. Inhalt von `sql/botkonzept_schema.sql` kopieren 3. Ausführen **Prüfen:** ```sql SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'; ``` Sollte zeigen: `customers`, `instances`, `emails_sent`, `subscriptions`, `payments`, `usage_stats`, `audit_log` --- ## 🔑 Schritt 2: n8n Credentials erstellen (10 Minuten) ### 2.1 PostgreSQL Credential 1. n8n → Credentials → **New Credential** 2. Typ: **Postgres** 3. Name: `Supabase Local` 4. Konfiguration: ``` Host: localhost (oder Ihr Supabase Host) Port: 5432 Database: botkonzept User: postgres Password: [Ihr Passwort] SSL: Enabled (für Supabase) ``` 5. **Test** → **Save** ### 2.2 SSH Credential **SSH Key generieren (falls noch nicht vorhanden):** ```bash ssh-keygen -t ed25519 -C "n8n@botkonzept" -f ~/.ssh/n8n_pve20 ssh-copy-id -i ~/.ssh/n8n_pve20.pub root@192.168.45.20 ``` **In n8n:** 1. Credentials → **New Credential** 2. Typ: **SSH (Private Key)** 3. Name: `PVE20` 4. Konfiguration: ``` Host: 192.168.45.20 Port: 22 Username: root Private Key: [Inhalt von ~/.ssh/n8n_pve20] ``` 5. **Save** ### 2.3 SMTP Credential **Option A: Amazon SES** 1. Credentials → **New Credential** 2. Typ: **SMTP** 3. Name: `Postfix SES` 4. Konfiguration: ``` Host: email-smtp.eu-central-1.amazonaws.com Port: 587 User: [SMTP Username] Password: [SMTP Password] From Email: noreply@botkonzept.de ``` 5. **Save** **Option B: Gmail (für Tests)** ``` Host: smtp.gmail.com Port: 587 User: your-email@gmail.com Password: [App-spezifisches Passwort] From Email: your-email@gmail.com ``` --- ## 📥 Schritt 3: Workflows importieren (5 Minuten) ### 3.1 Customer Registration Workflow 1. n8n → **"+"** → **Import from File** 2. Datei wählen: `BotKonzept-Customer-Registration-Workflow.json` 3. **Import** 4. Workflow öffnen 5. **Jeden Node prüfen** und Credentials zuweisen: - "Create Customer in DB" → `Supabase Local` - "Create Customer Instance" → `PVE20` - "Save Instance to DB" → `Supabase Local` - "Send Welcome Email" → `Postfix SES` - "Log Email Sent" → `Supabase Local` 6. **Save** 7. **Activate** (Toggle oben rechts) ### 3.2 Trial Management Workflow 1. Import: `BotKonzept-Trial-Management-Workflow.json` 2. Credentials zuweisen 3. **Save** → **Activate** --- ## 🧪 Schritt 4: Testen (10 Minuten) ### 4.1 Webhook-URL kopieren 1. Workflow "Customer Registration" öffnen 2. Node "Registration Webhook" klicken 3. **Production URL** kopieren - Sollte sein: `https://n8n.userman.de/webhook/botkonzept-registration` ### 4.2 Frontend aktualisieren ```bash # customer-frontend/js/main.js const CONFIG = { WEBHOOK_URL: 'https://n8n.userman.de/webhook/botkonzept-registration', // ... }; ``` ### 4.3 Test mit curl ```bash curl -X POST https://n8n.userman.de/webhook/botkonzept-registration \ -H "Content-Type: application/json" \ -d '{ "firstName": "Max", "lastName": "Test", "email": "max.test@example.com", "company": "Test GmbH" }' ``` **Erwartete Antwort:** ```json { "success": true, "message": "Registrierung erfolgreich!", "customerId": "...", "instanceUrl": "https://sb-XXXXX.userman.de" } ``` ### 4.4 Prüfen **Datenbank:** ```sql SELECT * FROM customers ORDER BY created_at DESC LIMIT 1; SELECT * FROM instances ORDER BY created_at DESC LIMIT 1; ``` **PVE20:** ```bash pct list | grep sb- ``` **E-Mail:** - Prüfen Sie Ihren Posteingang (max.test@example.com) --- ## 🌐 Schritt 5: Frontend deployen (5 Minuten) ### Option A: Lokaler Test ```bash cd customer-frontend python3 -m http.server 8000 ``` Öffnen: `http://localhost:8000` ### Option B: Nginx ```bash # Auf Ihrem Webserver cp -r customer-frontend /var/www/botkonzept.de # Nginx Config cat > /etc/nginx/sites-available/botkonzept.de <<'EOF' server { listen 80; server_name botkonzept.de www.botkonzept.de; root /var/www/botkonzept.de; index index.html; location / { try_files $uri $uri/ =404; } } EOF ln -s /etc/nginx/sites-available/botkonzept.de /etc/nginx/sites-enabled/ nginx -t systemctl reload nginx ``` ### Option C: Vercel/Netlify ```bash cd customer-frontend # Vercel vercel deploy # Netlify netlify deploy ``` --- ## ✅ Fertig! Ihre Registrierung ist jetzt live! 🎉 ### Nächste Schritte: 1. **SSL-Zertifikat** für botkonzept.de einrichten 2. **DNS-Records** konfigurieren (SPF, DKIM, DMARC) 3. **Amazon SES** aus Sandbox-Modus holen 4. **Monitoring** einrichten 5. **Backup-Strategie** planen --- ## 🆘 Probleme? ### Häufigste Fehler: **1. "Credential not found"** → Prüfen Sie ob alle 3 Credentials erstellt sind **2. "SSH connection failed"** → Prüfen Sie SSH Key: `ssh root@192.168.45.20` **3. "Table does not exist"** → Führen Sie das Schema erneut aus **4. "Email not sent"** → Prüfen Sie SMTP-Credentials und Absender-Verifizierung ### Detaillierte Hilfe: - **Setup-Guide:** `REGISTRATION_SETUP_GUIDE.md` - **Troubleshooting:** `REGISTRATION_TROUBLESHOOTING.md` --- ## 📊 Monitoring ### n8n Executions ``` n8n → Sidebar → Executions Filter: "Failed" oder "Running" ``` ### Datenbank ```sql -- Registrierungen heute SELECT COUNT(*) FROM customers WHERE DATE(created_at) = CURRENT_DATE; -- Aktive Trials SELECT COUNT(*) FROM customers WHERE status = 'trial'; -- Letzte 5 Registrierungen SELECT email, first_name, last_name, created_at FROM customers ORDER BY created_at DESC LIMIT 5; ``` ### Logs ```bash # n8n docker logs -f n8n # install.sh tail -f /root/customer-installer/logs/install_*.log # E-Mail (Postfix) journalctl -u postfix -f ``` --- ## 🎯 Checkliste - [ ] Datenbank-Schema erstellt - [ ] 3 Credentials in n8n angelegt - [ ] 2 Workflows importiert und aktiviert - [ ] Test-Registrierung erfolgreich - [ ] E-Mail erhalten - [ ] LXC-Container erstellt - [ ] Frontend deployed - [ ] DNS konfiguriert - [ ] SSL-Zertifikat installiert --- **Geschätzte Gesamtzeit:** 35 Minuten **Support:** support@botkonzept.de **Version:** 1.0.0 **Datum:** 26.01.2025