docs: Registrierungs-Setup und Troubleshooting Guides

Neue Dateien:
- BotKonzept-Customer-Registration-Workflow.json: n8n Workflow für Kundenregistrierung
- BotKonzept-Trial-Management-Workflow.json: n8n Workflow für Trial-Management
- REGISTRATION_SETUP_GUIDE.md: Kompletter Setup-Guide (Datenbank, Credentials, Workflows)
- REGISTRATION_TROUBLESHOOTING.md: Troubleshooting-Guide mit 10 häufigen Problemen

Gelöscht:
- 20250119_Logo_Botkozept.svg: Verschoben nach customer-frontend

Die Workflows enthalten:
- Webhook-Trigger für Registrierung
- Datenbank-Integration (PostgreSQL/Supabase)
- SSH-Integration zu PVE20 für LXC-Erstellung
- E-Mail-Versand (Willkommens-E-Mail)
- Trial-Management mit automatischen E-Mails (Tag 3, 5, 7)

Setup-Guide erklärt:
- Datenbank-Schema einrichten
- n8n Credentials konfigurieren (Supabase, SSH, SMTP)
- Workflows importieren und aktivieren
- Testing und Monitoring

Troubleshooting-Guide behandelt:
- Workflow-Probleme
- Credential-Fehler
- SSH-Verbindungsprobleme
- Datenbank-Fehler
- E-Mail-Versand-Probleme
- JSON-Parsing-Fehler
- Performance-Probleme
- Debugging-Checkliste
This commit is contained in:
2026-01-29 11:30:45 +01:00
parent bf1b3b05f2
commit 4275a07a9b
5 changed files with 1455 additions and 75 deletions

View File

@@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="359px" height="60px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 2150 359"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
<defs>
<style type="text/css">
<![CDATA[
.fil1 {fill:#FEFEFE;fill-rule:nonzero}
.fil4 {fill:#88CED7;fill-rule:nonzero}
.fil3 {fill:#4FC0EF;fill-rule:nonzero}
.fil2 {fill:#3A7ABD;fill-rule:nonzero}
.fil0 {fill:#234182;fill-rule:nonzero}
]]>
</style>
</defs>
<g id="Bot_x0020_TV">
<metadata id="CorelCorpID_0Corel-Layer"/>
<g id="_1548485603296">
<g>
<path class="fil0" d="M204 168l0 22c0,8 5,14 12,14 3,0 6,-2 9,-4 2,-3 4,-6 4,-10l0 -22c0,-8 -5,-14 -12,-14 -3,0 -6,2 -9,4 -2,3 -4,6 -4,10z"/>
</g>
<g>
<path class="fil0" d="M142 168l0 22c0,8 5,14 12,14 3,0 6,-2 9,-4 2,-3 4,-6 4,-10l0 -22c0,-8 -5,-14 -12,-14 -3,0 -6,2 -9,4 -2,3 -4,6 -4,10z"/>
</g>
</g>
<g id="_1548485603200">
<g>
<path class="fil1" d="M209 192l2 0c1,0 1,0 1,-1l0 -24c0,-1 0,-1 -1,-1l-2 0c-1,0 -1,0 -1,1l0 24c0,1 0,1 1,1z"/>
</g>
<g>
<path class="fil1" d="M147 192l2 0c1,0 1,0 1,-1l0 -24c0,-1 0,-1 -1,-1l-2 0c-1,0 -1,0 -1,1l0 24c0,1 0,1 1,1z"/>
</g>
</g>
<path class="fil0" d="M119 24l0 32 -38 0 0 -32c0,-10 8,-19 19,-19 10,0 19,8 19,19zm221 259l-221 0 0 56c0,10 -8,19 -18,20 -11,1 -20,-8 -20,-19l0 -219 0 -8 47 0c-5,0 -8,3 -9,8 0,1 0,1 0,2l0 113c0,5 4,9 9,9l211 0c10,0 19,8 20,18 1,11 -8,20 -19,20z"/>
<g id="_1548485605696">
<path class="fil2" d="M251 302l38 0 0 38c0,10 -8,19 -19,19 -10,0 -19,-8 -19,-19l0 -38z"/>
</g>
<g id="_1548485607712">
<path class="fil3" d="M359 94c0,10 -8,19 -19,19l-32 0 0 -38 32 0c10,0 19,8 19,19z"/>
</g>
<g id="_1548485606320">
<path class="fil4" d="M19 245l43 0 0 38 -43 0c-10,0 -19,-8 -19,-19 0,-10 8,-19 19,-19z"/>
</g>
<path class="fil2" d="M251 237l0 -2 0 -112c0,-5 -4,-9 -9,-9l-222 0c-10,0 -19,-8 -20,-18 -1,-11 8,-20 19,-20l232 0 0 -55c0,-11 9,-20 20,-19 10,1 18,9 18,20l0 217 0 8 -47 0c4,0 8,-3 9,-8 0,0 0,-1 0,-1z"/>
<path class="fil0" d="M391 213l0 -212 90 0c40,0 60,16 60,49 0,24 -13,41 -39,52 28,5 42,21 42,48 0,42 -22,63 -66,63l-87 0zm86 -22c25,0 38,-13 38,-38 0,-25 -17,-37 -51,-37l-12 0 0 -18c40,-5 61,-20 61,-44 0,-20 -11,-30 -34,-30l-60 0 0 167 58 0z"/>
<path id="_1" class="fil0" d="M609 107c0,57 26,86 77,86 51,0 76,-29 76,-86 0,-56 -25,-85 -76,-85 -52,0 -77,28 -77,85zm-29 1c0,-72 35,-108 106,-108 70,0 105,36 105,108 0,71 -35,107 -105,107 -71,0 -106,-36 -106,-107z"/>
<polygon id="_2" class="fil0" points="977,1 977,24 910,24 910,213 883,213 883,24 816,24 816,1 "/>
<path id="_3" class="fil0" d="M1037 1l0 212 -27 0 0 -212 27 0zm149 0l-95 100 97 112 -38 0 -86 -102 0 -17 88 -93 35 0z"/>
<path id="_4" class="fil0" d="M1216 107c0,57 26,86 77,86 51,0 76,-29 76,-86 0,-56 -25,-85 -76,-85 -52,0 -77,28 -77,85zm-29 1c0,-72 35,-108 106,-108 70,0 105,36 105,108 0,71 -35,107 -105,107 -71,0 -106,-36 -106,-107z"/>
<polygon id="_5" class="fil0" points="1594,1 1594,24 1468,191 1592,191 1592,213 1435,213 1435,191 1565,24 1438,24 1438,1 "/>
<polygon id="_6" class="fil0" points="1777,1 1777,24 1666,24 1666,95 1771,95 1771,117 1666,117 1666,191 1779,191 1779,213 1638,213 1638,1 "/>
<path id="_7" class="fil0" d="M1820 213l0 -212 86 0c43,0 65,19 65,57 0,41 -30,66 -89,75l-6 -23c43,-6 65,-23 65,-51 0,-24 -13,-35 -38,-35l-56 0 0 189 -27 0z"/>
<polygon id="_8" class="fil0" points="2150,1 2150,24 2083,24 2083,213 2056,213 2056,24 1989,24 1989,1 "/>
<polygon class="fil2" points="391,359 391,254 411,254 446,333 481,254 500,254 500,359 482,359 482,286 454,359 437,359 409,286 409,359 "/>
<polygon id="_1_8" class="fil2" points="593,254 593,271 541,271 541,297 591,297 591,315 541,315 541,342 594,342 594,359 522,359 522,254 "/>
<path id="_2_9" class="fil2" d="M653 342c22,0 32,-13 32,-38 0,-22 -11,-32 -32,-32l-21 0 0 71 21 0zm-41 17l0 -104 41 0c34,0 52,16 52,49 0,37 -17,55 -52,55l-41 0z"/>
<polygon id="_3_10" class="fil2" points="740,254 740,359 721,359 721,254 "/>
<polygon id="_4_11" class="fil2" points="773,359 753,359 797,254 818,254 863,359 842,359 830,330 796,330 802,313 823,313 807,274 "/>
<polygon id="_5_12" class="fil2" points="876,359 876,254 896,254 931,333 966,254 985,254 985,359 967,359 967,286 939,359 922,359 893,286 893,359 "/>
<polygon id="_6_13" class="fil2" points="1078,254 1078,271 1026,271 1026,297 1076,297 1076,315 1026,315 1026,342 1079,342 1079,359 1007,359 1007,254 "/>
<polygon id="_7_14" class="fil2" points="1165,254 1165,271 1135,271 1135,359 1116,359 1116,271 1086,271 1086,254 "/>
<polygon id="_8_15" class="fil2" points="1251,254 1251,271 1196,342 1251,342 1251,359 1174,359 1174,342 1232,271 1176,271 1176,254 "/>
<polygon id="_9" class="fil2" points="1332,359 1332,254 1352,254 1407,330 1407,254 1425,254 1425,359 1406,359 1351,281 1351,359 "/>
<polygon id="_10" class="fil2" points="1518,254 1518,271 1466,271 1466,297 1516,297 1516,315 1466,315 1466,342 1519,342 1519,359 1447,359 1447,254 "/>
<polygon id="_11" class="fil2" points="1605,254 1605,271 1576,271 1576,359 1556,359 1556,271 1526,271 1526,254 "/>
<polygon id="_12" class="fil2" points="1608,254 1628,254 1639,329 1666,254 1684,254 1710,326 1721,254 1740,254 1721,359 1703,359 1674,277 1643,359 1625,359 "/>
<path id="_13" class="fil2" d="M1770 306c0,24 11,36 32,36 21,0 31,-12 31,-36 0,-24 -10,-36 -31,-36 -22,0 -32,12 -32,36zm-20 0c0,-35 17,-53 52,-53 34,0 51,18 51,53 0,35 -17,53 -51,53 -33,0 -51,-18 -52,-53z"/>
<path id="_14" class="fil2" d="M1872 358l0 -104 47 0c21,0 32,9 32,28 0,13 -8,23 -25,31l33 45 -24 0 -32 -45 0 -9c18,-3 28,-10 28,-21 0,-8 -4,-12 -13,-12l-26 0 0 87 -20 0z"/>
<path id="_15" class="fil2" d="M1988 254l0 104 -19 0 0 -104 19 0zm73 0l-44 49 49 56 -27 0 -40 -49 0 -13 39 -43 24 0z"/>
<path id="_16" class="fil2" d="M2071 354l0 -17c10,4 22,6 35,6 16,0 24,-5 24,-16 0,-8 -5,-12 -15,-12l-16 0c-21,0 -32,-10 -32,-29 0,-21 15,-32 46,-32 12,0 23,2 33,5l0 17c-10,-4 -21,-6 -33,-6 -17,0 -26,5 -26,15 0,8 4,12 13,12l16 0c23,0 34,10 34,29 0,22 -14,33 -43,33 -13,0 -25,-2 -35,-5z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -0,0 +1,312 @@
{
"name": "BotKonzept - Customer Registration & Trial Management",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "botkonzept-registration",
"responseMode": "responseNode",
"options": {}
},
"id": "webhook-registration",
"name": "Registration Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1.1,
"position": [250, 300],
"webhookId": "botkonzept-registration"
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.body.email}}",
"operation": "isNotEmpty"
},
{
"value1": "={{$json.body.firstName}}",
"operation": "isNotEmpty"
},
{
"value1": "={{$json.body.lastName}}",
"operation": "isNotEmpty"
}
]
}
},
"id": "validate-input",
"name": "Validate Input",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [450, 300]
},
{
"parameters": {
"operation": "insert",
"schema": "public",
"table": "customers",
"columns": "email,first_name,last_name,company,status,created_at,trial_end_date",
"additionalFields": {
"returnFields": "*"
}
},
"id": "create-customer",
"name": "Create Customer in DB",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [650, 200],
"credentials": {
"postgres": {
"id": "supabase-local",
"name": "Supabase Local"
}
}
},
{
"parameters": {
"authentication": "privateKey",
"command": "=/root/customer-installer/install.sh --storage local-zfs --bridge vmbr0 --ip dhcp --vlan 90 --apt-proxy http://192.168.45.2:3142 --n8n-owner-email {{ $json.email }} --n8n-owner-pass \"{{ $('Generate-Password').item.json.password }}\"",
"cwd": "/root/customer-installer/"
},
"id": "create-instance",
"name": "Create Customer Instance",
"type": "n8n-nodes-base.ssh",
"typeVersion": 1,
"position": [850, 200],
"credentials": {
"sshPrivateKey": {
"id": "pve20-ssh",
"name": "PVE20"
}
}
},
{
"parameters": {
"jsCode": "// Parse installation output\nconst stdout = $input.item.json.stdout;\nconst installData = JSON.parse(stdout);\n\n// Add customer info\ninstallData.customer = {\n id: $('Create Customer in DB').item.json.id,\n email: $('Create Customer in DB').item.json.email,\n firstName: $('Create Customer in DB').item.json.first_name,\n lastName: $('Create Customer in DB').item.json.last_name,\n company: $('Create Customer in DB').item.json.company\n};\n\nreturn installData;"
},
"id": "parse-install-output",
"name": "Parse Install Output",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [1050, 200]
},
{
"parameters": {
"operation": "insert",
"schema": "public",
"table": "instances",
"columns": "customer_id,ctid,hostname,ip,fqdn,status,credentials,created_at,trial_end_date",
"additionalFields": {}
},
"id": "save-instance",
"name": "Save Instance to DB",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [1250, 200],
"credentials": {
"postgres": {
"id": "supabase-local",
"name": "Supabase Local"
}
}
},
{
"parameters": {
"fromEmail": "noreply@botkonzept.de",
"toEmail": "={{ $json.customer.email }}",
"subject": "Willkommen bei BotKonzept - Ihre Instanz ist bereit! 🎉",
"emailType": "html",
"message": "=<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"UTF-8\">\n <style>\n body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }\n .container { max-width: 600px; margin: 0 auto; padding: 20px; }\n .header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center; border-radius: 10px 10px 0 0; }\n .content { background: #f9fafb; padding: 30px; }\n .credentials { background: white; padding: 20px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #667eea; }\n .button { display: inline-block; background: #667eea; color: white; padding: 12px 30px; text-decoration: none; border-radius: 6px; margin: 20px 0; }\n .footer { text-align: center; padding: 20px; color: #6b7280; font-size: 14px; }\n .highlight { background: #fef3c7; padding: 2px 6px; border-radius: 3px; }\n </style>\n</head>\n<body>\n <div class=\"container\">\n <div class=\"header\">\n <h1>🎉 Willkommen bei BotKonzept!</h1>\n <p>Ihre KI-Chatbot-Instanz ist bereit</p>\n </div>\n \n <div class=\"content\">\n <p>Hallo {{ $json.customer.firstName }},</p>\n \n <p>vielen Dank für Ihre Registrierung! Ihre persönliche KI-Chatbot-Instanz wurde erfolgreich erstellt und ist jetzt einsatzbereit.</p>\n \n <div class=\"credentials\">\n <h3>📋 Ihre Zugangsdaten</h3>\n <p><strong>Dashboard-URL:</strong><br>\n <a href=\"{{ $json.urls.n8n_external }}\">{{ $json.urls.n8n_external }}</a></p>\n \n <p><strong>E-Mail:</strong> {{ $json.n8n.owner_email }}<br>\n <strong>Passwort:</strong> <span class=\"highlight\">{{ $json.n8n.owner_password }}</span></p>\n \n <p><strong>Chat-Webhook:</strong><br>\n <code>{{ $json.urls.chat_webhook }}</code></p>\n \n <p><strong>Upload-Formular:</strong><br>\n <a href=\"{{ $json.urls.upload_form }}\">{{ $json.urls.upload_form }}</a></p>\n </div>\n \n <h3>🚀 Nächste Schritte:</h3>\n <ol>\n <li><strong>Einloggen:</strong> Klicken Sie auf den Link oben und loggen Sie sich ein</li>\n <li><strong>Dokumente hochladen:</strong> Laden Sie Ihre PDFs, FAQs oder andere Dokumente hoch</li>\n <li><strong>Chatbot testen:</strong> Testen Sie Ihren Chatbot direkt im Dashboard</li>\n <li><strong>Code einbinden:</strong> Kopieren Sie den Widget-Code auf Ihre Website</li>\n </ol>\n \n <a href=\"{{ $json.urls.n8n_external }}\" class=\"button\">Jetzt Dashboard öffnen →</a>\n \n <div style=\"background: #fef3c7; padding: 15px; border-radius: 8px; margin: 20px 0;\">\n <p><strong>💰 Frühbucher-Angebot:</strong></p>\n <p>Upgraden Sie in den nächsten 3 Tagen und erhalten Sie <strong>30% Rabatt</strong> auf Ihr erstes Jahr!</p>\n </div>\n \n <p><strong>Trial-Zeitraum:</strong> 7 Tage (bis {{ $json.trial_end_date }})</p>\n \n <p>Bei Fragen stehen wir Ihnen jederzeit zur Verfügung!</p>\n \n <p>Viel Erfolg mit Ihrem KI-Chatbot!<br>\n Ihr BotKonzept-Team</p>\n </div>\n \n <div class=\"footer\">\n <p>BotKonzept | KI-Chatbots für moderne Unternehmen</p>\n <p><a href=\"https://botkonzept.de\">botkonzept.de</a> | <a href=\"mailto:support@botkonzept.de\">support@botkonzept.de</a></p>\n </div>\n </div>\n</body>\n</html>",
"options": {
"allowUnauthorizedCerts": false
}
},
"id": "send-welcome-email",
"name": "Send Welcome Email",
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2.1,
"position": [1450, 200],
"credentials": {
"smtp": {
"id": "postfix-ses",
"name": "Postfix SES"
}
}
},
{
"parameters": {
"operation": "insert",
"schema": "public",
"table": "emails_sent",
"columns": "customer_id,email_type,sent_at",
"additionalFields": {}
},
"id": "log-email",
"name": "Log Email Sent",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [1650, 200],
"credentials": {
"postgres": {
"id": "supabase-local",
"name": "Supabase Local"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { \"success\": true, \"message\": \"Registrierung erfolgreich! Sie erhalten in Kürze eine E-Mail mit Ihren Zugangsdaten.\", \"customerId\": $json.customer.id, \"instanceUrl\": $json.urls.n8n_external } }}",
"options": {
"responseCode": 200
}
},
"id": "success-response",
"name": "Success Response",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [1850, 200]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { \"success\": false, \"error\": \"Ungültige Eingabedaten. Bitte überprüfen Sie Ihre Angaben.\" } }}",
"options": {
"responseCode": 400
}
},
"id": "error-response",
"name": "Error Response",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [650, 400]
},
{
"parameters": {
"jsCode": "// Generate secure password\nconst length = 16;\nconst charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';\nlet password = '';\n\nfor (let i = 0; i < length; i++) {\n const randomIndex = Math.floor(Math.random() * charset.length);\n password += charset[randomIndex];\n}\n\n// Calculate trial end date (7 days from now)\nconst trialEndDate = new Date();\ntrialEndDate.setDate(trialEndDate.getDate() + 7);\n\nreturn {\n password: password,\n trialEndDate: trialEndDate.toISOString(),\n email: $json.body.email,\n firstName: $json.body.firstName,\n lastName: $json.body.lastName,\n company: $json.body.company || null\n};"
},
"id": "generate-password",
"name": "Generate Password & Trial Date",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [650, 100]
}
],
"connections": {
"Registration Webhook": {
"main": [
[
{
"node": "Validate Input",
"type": "main",
"index": 0
}
]
]
},
"Validate Input": {
"main": [
[
{
"node": "Generate Password & Trial Date",
"type": "main",
"index": 0
}
],
[
{
"node": "Error Response",
"type": "main",
"index": 0
}
]
]
},
"Generate Password & Trial Date": {
"main": [
[
{
"node": "Create Customer in DB",
"type": "main",
"index": 0
}
]
]
},
"Create Customer in DB": {
"main": [
[
{
"node": "Create Customer Instance",
"type": "main",
"index": 0
}
]
]
},
"Create Customer Instance": {
"main": [
[
{
"node": "Parse Install Output",
"type": "main",
"index": 0
}
]
]
},
"Parse Install Output": {
"main": [
[
{
"node": "Save Instance to DB",
"type": "main",
"index": 0
}
]
]
},
"Save Instance to DB": {
"main": [
[
{
"node": "Send Welcome Email",
"type": "main",
"index": 0
}
]
]
},
"Send Welcome Email": {
"main": [
[
{
"node": "Log Email Sent",
"type": "main",
"index": 0
}
]
]
},
"Log Email Sent": {
"main": [
[
{
"node": "Success Response",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [],
"triggerCount": 0,
"updatedAt": "2025-01-25T00:00:00.000Z",
"versionId": "1"
}

View File

@@ -0,0 +1,122 @@
{
"name": "BotKonzept - Trial Management & Email Automation",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 9 * * *"
}
]
}
},
"id": "daily-cron",
"name": "Daily at 9 AM",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [250, 300]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT c.id as customer_id, c.email, c.first_name, c.last_name, c.company, c.created_at, c.status, i.ctid, i.hostname, i.fqdn, i.trial_end_date, i.credentials, EXTRACT(DAY FROM (NOW() - c.created_at)) as days_since_registration FROM customers c JOIN instances i ON c.id = i.customer_id WHERE c.status = 'trial' AND i.status = 'active' AND c.created_at >= NOW() - INTERVAL '8 days'",
"additionalFields": {}
},
"id": "get-trial-customers",
"name": "Get Trial Customers",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [450, 300],
"credentials": {
"postgres": {
"id": "supabase-local",
"name": "Supabase Local"
}
}
},
{
"parameters": {
"conditions": {
"number": [
{
"value1": "={{$json.days_since_registration}}",
"operation": "equal",
"value2": 3
}
]
}
},
"id": "check-day-3",
"name": "Day 3?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [650, 200]
},
{
"parameters": {
"operation": "insert",
"schema": "public",
"table": "emails_sent",
"columns": "customer_id,email_type,sent_at",
"additionalFields": {}
},
"id": "log-email-sent",
"name": "Log Email Sent",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [1450, 200],
"credentials": {
"postgres": {
"id": "supabase-local",
"name": "Supabase Local"
}
}
}
],
"connections": {
"Daily at 9 AM": {
"main": [
[
{
"node": "Get Trial Customers",
"type": "main",
"index": 0
}
]
]
},
"Get Trial Customers": {
"main": [
[
{
"node": "Day 3?",
"type": "main",
"index": 0
}
]
]
},
"Day 3?": {
"main": [
[
{
"node": "Log Email Sent",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [],
"triggerCount": 0,
"updatedAt": "2025-01-25T00:00:00.000Z",
"versionId": "1"
}

440
REGISTRATION_SETUP_GUIDE.md Normal file
View File

@@ -0,0 +1,440 @@
# 🚀 BotKonzept - Registrierungs-Setup Guide
## 📋 Übersicht
Dieser Guide erklärt, wie Sie die Benutzerregistrierung für BotKonzept zum Laufen bringen.
---
## ✅ Was bereits vorhanden ist
### 1. Frontend (customer-frontend)
- ✅ Registrierungsformular (`index.html`)
- ✅ Formular-Validierung (`js/main.js`)
- ✅ Webhook-URL: `https://n8n.userman.de/webhook/botkonzept-registration`
### 2. Backend (customer-installer)
-`install.sh` - Erstellt LXC-Container automatisch
-`setup_nginx_proxy.sh` - Konfiguriert Reverse Proxy
- ✅ Datenbank-Schema (`sql/botkonzept_schema.sql`)
### 3. n8n Workflows
-`BotKonzept-Customer-Registration-Workflow.json`
-`BotKonzept-Trial-Management-Workflow.json`
---
## 🔧 Setup-Schritte
### Schritt 1: Datenbank einrichten
```bash
# Auf Ihrem Supabase/PostgreSQL Server
psql -U postgres -d botkonzept < customer-installer/sql/botkonzept_schema.sql
```
**Oder in Supabase Dashboard:**
1. Gehen Sie zu SQL Editor
2. Kopieren Sie den Inhalt von `sql/botkonzept_schema.sql`
3. Führen Sie das SQL aus
**Tabellen die erstellt werden:**
- `customers` - Kundendaten
- `instances` - LXC-Instanzen
- `emails_sent` - E-Mail-Tracking
- `subscriptions` - Abonnements
- `payments` - Zahlungen
- `usage_stats` - Nutzungsstatistiken
- `audit_log` - Audit-Trail
---
### Schritt 2: n8n Credentials einrichten
Sie benötigen folgende Credentials in n8n:
#### 2.1 PostgreSQL/Supabase Credential
**Name:** `Supabase Local`
**Typ:** Postgres
**Konfiguration:**
```
Host: localhost (oder Ihr Supabase Host)
Port: 5432
Database: botkonzept
User: postgres (oder service_role)
Password: [Ihr Passwort]
SSL: Enabled (für Supabase)
```
#### 2.2 SSH Credential für PVE20
**Name:** `PVE20`
**Typ:** SSH (Private Key)
**Konfiguration:**
```
Host: 192.168.45.20 (oder Ihre PVE20 IP)
Port: 22
Username: root
Private Key: [Ihr SSH Private Key]
```
**SSH Key generieren (falls noch nicht vorhanden):**
```bash
# Auf dem n8n Server
ssh-keygen -t ed25519 -C "n8n@botkonzept"
# Public Key auf PVE20 kopieren
ssh-copy-id root@192.168.45.20
```
#### 2.3 SMTP Credential für E-Mails
**Name:** `Postfix SES`
**Typ:** SMTP
**Konfiguration:**
**Option A: Amazon SES**
```
Host: email-smtp.eu-central-1.amazonaws.com
Port: 587
User: [Ihr SMTP Username]
Password: [Ihr SMTP Password]
From Email: noreply@botkonzept.de
```
**Option B: Postfix (lokal)**
```
Host: localhost
Port: 25
From Email: noreply@botkonzept.de
```
**Option C: 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: n8n Workflows importieren
#### 3.1 Customer Registration Workflow
1. Öffnen Sie n8n: `https://n8n.userman.de`
2. Klicken Sie auf **"+"** → **"Import from File"**
3. Wählen Sie `BotKonzept-Customer-Registration-Workflow.json`
4. **Wichtig:** Passen Sie folgende Nodes an:
**Node: "Create Customer in DB"**
- Credential: `Supabase Local` auswählen
- Query anpassen falls nötig
**Node: "Create Customer Instance"**
- Credential: `PVE20` auswählen
- Command prüfen:
```bash
/root/customer-installer/install.sh \
--storage local-zfs \
--bridge vmbr0 \
--ip dhcp \
--vlan 90 \
--apt-proxy http://192.168.45.2:3142 \
--n8n-owner-email {{ $json.email }} \
--n8n-owner-pass "{{ $('Generate Password & Trial Date').item.json.password }}"
```
**Node: "Send Welcome Email"**
- Credential: `Postfix SES` auswählen
- From Email anpassen: `noreply@botkonzept.de`
5. Klicken Sie auf **"Save"**
6. Klicken Sie auf **"Activate"** (oben rechts)
#### 3.2 Trial Management Workflow
1. Importieren Sie `BotKonzept-Trial-Management-Workflow.json`
2. Passen Sie die Credentials an
3. Aktivieren Sie den Workflow
---
### Schritt 4: Webhook-URL testen
#### 4.1 Webhook-URL ermitteln
Nach dem Import sollte die Webhook-URL sein:
```
https://n8n.userman.de/webhook/botkonzept-registration
```
**Prüfen Sie die URL:**
1. Öffnen Sie den Workflow
2. Klicken Sie auf den Node "Registration Webhook"
3. Kopieren Sie die "Production URL"
#### 4.2 Test mit curl
```bash
curl -X POST https://n8n.userman.de/webhook/botkonzept-registration \
-H "Content-Type: application/json" \
-d '{
"firstName": "Max",
"lastName": "Mustermann",
"email": "test@example.com",
"company": "Test GmbH",
"website": "https://example.com",
"newsletter": true
}'
```
**Erwartete Antwort:**
```json
{
"success": true,
"message": "Registrierung erfolgreich! Sie erhalten in Kürze eine E-Mail mit Ihren Zugangsdaten.",
"customerId": "uuid-hier",
"instanceUrl": "https://sb-XXXXX.userman.de"
}
```
---
## 🐛 Häufige Probleme & Lösungen
### Problem 1: "Credential not found"
**Lösung:**
- Stellen Sie sicher, dass alle Credentials in n8n angelegt sind
- Namen müssen exakt übereinstimmen: `Supabase Local`, `PVE20`, `Postfix SES`
### Problem 2: SSH-Verbindung schlägt fehl
**Lösung:**
```bash
# Auf n8n Server
ssh root@192.168.45.20
# Falls Fehler:
# 1. SSH Key generieren
ssh-keygen -t ed25519 -C "n8n@botkonzept"
# 2. Public Key kopieren
ssh-copy-id root@192.168.45.20
# 3. Testen
ssh root@192.168.45.20 "ls /root/customer-installer/"
```
### Problem 3: install.sh nicht gefunden
**Lösung:**
```bash
# Auf PVE20
cd /root
git clone https://backoffice.userman.de/MediaMetz/customer-installer.git
# Oder Pfad im Workflow anpassen
```
### Problem 4: Datenbank-Fehler
**Lösung:**
```bash
# Prüfen ob Tabellen existieren
psql -U postgres -d botkonzept -c "\dt"
# Falls nicht, Schema erneut ausführen
psql -U postgres -d botkonzept < sql/botkonzept_schema.sql
```
### Problem 5: E-Mail wird nicht versendet
**Lösung:**
**Für Amazon SES:**
1. Verifizieren Sie die Absender-E-Mail in AWS SES
2. Prüfen Sie SMTP-Credentials
3. Stellen Sie sicher, dass Sie aus dem Sandbox-Modus raus sind
**Für Postfix:**
```bash
# Auf dem Server
systemctl status postfix
journalctl -u postfix -f
# Test-E-Mail senden
echo "Test" | mail -s "Test" test@example.com
```
### Problem 6: Workflow wird nicht ausgeführt
**Lösung:**
1. Prüfen Sie ob Workflow aktiviert ist (grüner Toggle oben rechts)
2. Schauen Sie in die Execution History (linke Sidebar → Executions)
3. Prüfen Sie die Logs jedes Nodes
---
## 📊 Workflow-Ablauf im Detail
### Registration Workflow
```
1. Webhook empfängt POST-Request
2. Validierung (E-Mail, Name, etc.)
3. Passwort generieren (16 Zeichen)
4. Kunde in DB anlegen (customers Tabelle)
5. SSH zu PVE20 → install.sh ausführen
6. JSON-Output parsen (CTID, URLs, Credentials)
7. Instanz in DB speichern (instances Tabelle)
8. Willkommens-E-Mail senden
9. E-Mail-Versand loggen (emails_sent Tabelle)
10. Success-Response an Frontend
```
**Dauer:** Ca. 2-5 Minuten (abhängig von LXC-Erstellung)
### Trial Management Workflow
```
1. Cron-Trigger (täglich 9:00 Uhr)
2. Alle Trial-Kunden abrufen (0-8 Tage alt)
3. Für jeden Kunden:
- Tag 3? → 30% Rabatt-E-Mail
- Tag 5? → 15% Rabatt-E-Mail
- Tag 7? → Letzte Chance-E-Mail
- Tag 8? → Instanz löschen + Goodbye-E-Mail
4. E-Mail-Versand loggen
```
---
## 🧪 Testing-Checkliste
### Frontend-Test
- [ ] Formular öffnen: `http://192.168.0.20:8000`
- [ ] Alle Felder ausfüllen
- [ ] Absenden klicken
- [ ] Erfolgsmeldung erscheint
### Backend-Test
- [ ] n8n Execution History prüfen
- [ ] Datenbank prüfen: `SELECT * FROM customers ORDER BY created_at DESC LIMIT 1;`
- [ ] PVE20 prüfen: `pct list | grep sb-`
- [ ] E-Mail erhalten?
### End-to-End-Test
- [ ] Registrierung durchführen
- [ ] E-Mail mit Zugangsdaten erhalten
- [ ] In n8n Dashboard einloggen
- [ ] PDF hochladen
- [ ] Chatbot testen
---
## 📈 Monitoring
### n8n Executions überwachen
```bash
# In n8n UI
Sidebar → Executions → Filter: "Failed"
```
### Datenbank-Queries
```sql
-- Neue Registrierungen heute
SELECT COUNT(*) FROM customers WHERE DATE(created_at) = CURRENT_DATE;
-- Aktive Trials
SELECT COUNT(*) FROM customers WHERE status = 'trial';
-- Versendete E-Mails heute
SELECT email_type, COUNT(*)
FROM emails_sent
WHERE DATE(sent_at) = CURRENT_DATE
GROUP BY email_type;
-- Trials die bald ablaufen
SELECT * FROM trials_expiring_soon;
```
### Logs prüfen
```bash
# n8n Logs
docker logs -f n8n
# install.sh Logs
ls -lh /root/customer-installer/logs/
# Postfix Logs
journalctl -u postfix -f
```
---
## 🔐 Sicherheit
### Wichtige Punkte
1. **Credentials verschlüsseln**
- n8n verschlüsselt Credentials automatisch
- Encryption Key sichern: `N8N_ENCRYPTION_KEY`
2. **SSH Keys schützen**
```bash
chmod 600 ~/.ssh/id_ed25519
```
3. **Datenbank-Zugriff**
- Verwenden Sie `service_role` Key für n8n
- Niemals `anon` Key für Backend-Operationen
4. **E-Mail-Sicherheit**
- SPF, DKIM, DMARC konfigurieren
- Absender-Domain verifizieren
---
## 📚 Weitere Ressourcen
- **n8n Dokumentation:** https://docs.n8n.io
- **Supabase Docs:** https://supabase.com/docs
- **Proxmox Docs:** https://pve.proxmox.com/wiki/Main_Page
---
## 🆘 Support
Bei Problemen:
1. **Logs prüfen** (siehe Monitoring-Sektion)
2. **n8n Execution History** ansehen
3. **Datenbank-Queries** ausführen
4. **Workflow Schritt für Schritt testen**
**Kontakt:**
- E-Mail: support@botkonzept.de
- Dokumentation: Dieses Dokument
---
**Version:** 1.0.0
**Letzte Aktualisierung:** 26.01.2025
**Autor:** MediaMetz

View File

@@ -0,0 +1,581 @@
# 🔧 BotKonzept - Registrierung Troubleshooting
## Häufige Probleme und Lösungen
---
## 🚨 Problem 1: Workflow wird nicht ausgeführt
### Symptome
- Frontend zeigt "Verbindungsfehler"
- Keine Execution in n8n History
- Timeout-Fehler
### Diagnose
```bash
# 1. Prüfen ob n8n läuft
curl -I https://n8n.userman.de
# 2. Webhook-URL testen
curl -X POST https://n8n.userman.de/webhook/botkonzept-registration \
-H "Content-Type: application/json" \
-d '{"firstName":"Test","lastName":"User","email":"test@test.de"}'
```
### Lösungen
#### A) Workflow nicht aktiviert
1. Öffnen Sie n8n
2. Öffnen Sie den Workflow
3. Klicken Sie auf den **Toggle oben rechts** (muss grün sein)
4. Speichern Sie den Workflow
#### B) Webhook-Pfad falsch
1. Öffnen Sie den Workflow
2. Klicken Sie auf "Registration Webhook" Node
3. Prüfen Sie den Pfad: Sollte `botkonzept-registration` sein
4. Kopieren Sie die "Production URL"
5. Aktualisieren Sie `customer-frontend/js/main.js`:
```javascript
const CONFIG = {
WEBHOOK_URL: 'https://n8n.userman.de/webhook/botkonzept-registration',
// ...
};
```
#### C) n8n nicht erreichbar
```bash
# Auf dem n8n Server
docker ps | grep n8n
docker logs n8n
# Falls Container nicht läuft
docker start n8n
```
---
## 🚨 Problem 2: "Credential not found" Fehler
### Symptome
- Workflow stoppt bei einem Node
- Fehler: "Credential 'Supabase Local' not found"
- Execution zeigt roten Fehler
### Lösung
#### Schritt 1: Credentials prüfen
1. n8n → Sidebar → **Credentials**
2. Prüfen Sie ob folgende existieren:
- `Supabase Local` (Postgres)
- `PVE20` (SSH)
- `Postfix SES` (SMTP)
#### Schritt 2: Credential erstellen (falls fehlend)
**Supabase Local:**
```
Name: Supabase Local
Type: Postgres
Host: localhost (oder Ihr Supabase Host)
Port: 5432
Database: botkonzept
User: postgres
Password: [Ihr Passwort]
SSL: Enabled
```
**PVE20:**
```
Name: PVE20
Type: SSH (Private Key)
Host: 192.168.45.20
Port: 22
Username: root
Private Key: [Fügen Sie Ihren Private Key ein]
```
**Postfix SES:**
```
Name: Postfix SES
Type: SMTP
Host: email-smtp.eu-central-1.amazonaws.com
Port: 587
User: [SMTP Username]
Password: [SMTP Password]
From: noreply@botkonzept.de
```
#### Schritt 3: Credential im Workflow zuweisen
1. Öffnen Sie den betroffenen Node
2. Klicken Sie auf "Credential to connect with"
3. Wählen Sie das richtige Credential
4. Speichern Sie den Workflow
---
## 🚨 Problem 3: SSH-Verbindung zu PVE20 schlägt fehl
### Symptome
- Node "Create Customer Instance" schlägt fehl
- Fehler: "Connection refused" oder "Permission denied"
### Diagnose
```bash
# Auf dem n8n Server (im Container)
docker exec -it n8n sh
# SSH-Verbindung testen
ssh root@192.168.45.20 "echo 'Connection OK'"
```
### Lösungen
#### A) SSH Key nicht konfiguriert
```bash
# Auf dem n8n Server (Host, nicht Container)
ssh-keygen -t ed25519 -C "n8n@botkonzept" -f ~/.ssh/n8n_key
# Public Key auf PVE20 kopieren
ssh-copy-id -i ~/.ssh/n8n_key.pub root@192.168.45.20
# Private Key anzeigen (für n8n Credential)
cat ~/.ssh/n8n_key
```
#### B) SSH Key im Container nicht verfügbar
```bash
# SSH Key als Volume mounten
docker run -d \
--name n8n \
-v ~/.ssh:/home/node/.ssh:ro \
-v n8n_data:/home/node/.n8n \
-p 5678:5678 \
n8nio/n8n
```
#### C) Firewall blockiert
```bash
# Auf PVE20
iptables -L -n | grep 22
# Falls blockiert, Regel hinzufügen
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
```
---
## 🚨 Problem 4: install.sh schlägt fehl
### Symptome
- SSH-Verbindung OK, aber install.sh gibt Fehler
- Fehler: "No such file or directory"
- Fehler: "Permission denied"
### Diagnose
```bash
# Auf PVE20
ls -lh /root/customer-installer/install.sh
# Ausführbar?
chmod +x /root/customer-installer/install.sh
# Manuell testen
cd /root/customer-installer
./install.sh --help
```
### Lösungen
#### A) Repository nicht geklont
```bash
# Auf PVE20
cd /root
git clone https://backoffice.userman.de/MediaMetz/customer-installer.git
cd customer-installer
chmod +x install.sh
```
#### B) Pfad im Workflow falsch
1. Öffnen Sie den Node "Create Customer Instance"
2. Prüfen Sie den Command:
```bash
/root/customer-installer/install.sh --storage local-zfs ...
```
3. Passen Sie den Pfad an falls nötig
#### C) Abhängigkeiten fehlen
```bash
# Auf PVE20
apt-get update
apt-get install -y jq curl python3
```
---
## 🚨 Problem 5: Datenbank-Fehler
### Symptome
- Fehler: "relation 'customers' does not exist"
- Fehler: "permission denied for table customers"
- Fehler: "connection refused"
### Diagnose
```bash
# Verbindung testen
psql -h localhost -U postgres -d botkonzept -c "SELECT 1;"
# Tabellen prüfen
psql -h localhost -U postgres -d botkonzept -c "\dt"
```
### Lösungen
#### A) Schema nicht erstellt
```bash
# Schema erstellen
psql -U postgres -d botkonzept < /root/customer-installer/sql/botkonzept_schema.sql
# Prüfen
psql -U postgres -d botkonzept -c "\dt"
```
#### B) Datenbank existiert nicht
```bash
# Datenbank erstellen
createdb -U postgres botkonzept
# Schema importieren
psql -U postgres -d botkonzept < /root/customer-installer/sql/botkonzept_schema.sql
```
#### C) Berechtigungen fehlen
```sql
-- Als postgres User
GRANT ALL ON ALL TABLES IN SCHEMA public TO service_role;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO service_role;
```
#### D) Supabase: Falsche Credentials
1. Gehen Sie zu Supabase Dashboard
2. Settings → Database
3. Kopieren Sie die Connection String
4. Aktualisieren Sie das n8n Credential
---
## 🚨 Problem 6: E-Mail wird nicht versendet
### Symptome
- Workflow läuft durch, aber keine E-Mail
- Fehler: "SMTP connection failed"
- E-Mail landet im Spam
### Diagnose
```bash
# SMTP-Verbindung testen
telnet email-smtp.eu-central-1.amazonaws.com 587
# Postfix Status (falls lokal)
systemctl status postfix
journalctl -u postfix -n 50
```
### Lösungen
#### A) Amazon SES: E-Mail nicht verifiziert
1. Gehen Sie zu AWS SES Console
2. Verified Identities → Verify new email
3. Bestätigen Sie die E-Mail
4. Warten Sie auf Verifizierung
#### B) Amazon SES: Sandbox-Modus
1. AWS SES Console → Account Dashboard
2. Request production access
3. Füllen Sie das Formular aus
4. Warten Sie auf Genehmigung (24-48h)
**Workaround für Tests:**
- Verifizieren Sie auch die Empfänger-E-Mail
- Oder verwenden Sie Gmail für Tests
#### C) SMTP-Credentials falsch
1. AWS IAM → Users → Ihr SMTP User
2. Security Credentials → Create SMTP credentials
3. Kopieren Sie Username und Password
4. Aktualisieren Sie n8n SMTP Credential
#### D) SPF/DKIM nicht konfiguriert
```bash
# DNS-Records prüfen
dig TXT botkonzept.de
dig TXT _dmarc.botkonzept.de
# Fehlende Records hinzufügen (bei Ihrem DNS-Provider)
```
**Benötigte DNS-Records:**
```
# SPF
botkonzept.de. IN TXT "v=spf1 include:amazonses.com ~all"
# DKIM (von AWS SES bereitgestellt)
[selector]._domainkey.botkonzept.de. IN CNAME [value-from-ses]
# DMARC
_dmarc.botkonzept.de. IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@botkonzept.de"
```
---
## 🚨 Problem 7: JSON-Parsing-Fehler
### Symptome
- Fehler: "Unexpected token in JSON"
- Node "Parse Install Output" schlägt fehl
### Diagnose
```bash
# install.sh manuell ausführen und Output prüfen
cd /root/customer-installer
./install.sh --storage local-zfs --bridge vmbr0 --ip dhcp --vlan 90 2>&1 | tee test-output.log
# Ist der Output valides JSON?
cat test-output.log | jq .
```
### Lösungen
#### A) install.sh gibt Fehler aus
- Prüfen Sie die Logs in `/root/customer-installer/logs/`
- Beheben Sie die Fehler in install.sh
- Testen Sie erneut
#### B) Output enthält zusätzliche Zeilen
1. Öffnen Sie `install.sh`
2. Stellen Sie sicher, dass nur JSON auf stdout ausgegeben wird
3. Alle anderen Ausgaben sollten nach stderr gehen
#### C) DEBUG-Modus aktiviert
1. Prüfen Sie ob `DEBUG=1` gesetzt ist
2. Für Produktion: `DEBUG=0` verwenden
3. Im Workflow: Command ohne `--debug` ausführen
---
## 🚨 Problem 8: Workflow zu langsam / Timeout
### Symptome
- Frontend zeigt Timeout nach 30 Sekunden
- Workflow läuft noch, aber Frontend gibt auf
### Lösung
#### A) Timeout im Frontend erhöhen
```javascript
// In customer-frontend/js/main.js
const response = await fetch(CONFIG.WEBHOOK_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(formData),
signal: AbortSignal.timeout(300000), // 5 Minuten
});
```
#### B) Asynchrone Verarbeitung
Ändern Sie den Workflow:
1. Webhook gibt sofort Response zurück
2. Instanz-Erstellung läuft im Hintergrund
3. E-Mail wird gesendet wenn fertig
**Workflow-Änderung:**
- Nach "Create Customer in DB" → Sofort Response
- Rest des Workflows läuft asynchron weiter
---
## 🚨 Problem 9: Doppelte Registrierungen
### Symptome
- Kunde registriert sich mehrmals
- Mehrere Einträge in `customers` Tabelle
- Mehrere LXC-Container
### Lösung
#### A) E-Mail-Unique-Constraint prüfen
```sql
-- Prüfen ob Constraint existiert
SELECT conname, contype
FROM pg_constraint
WHERE conrelid = 'customers'::regclass;
-- Falls nicht, hinzufügen
ALTER TABLE customers ADD CONSTRAINT customers_email_unique UNIQUE (email);
```
#### B) Workflow anpassen
Fügen Sie einen Check-Node hinzu:
```javascript
// Vor "Create Customer in DB"
const email = $json.body.email;
const existing = await $('Postgres').execute({
query: 'SELECT id FROM customers WHERE email = $1',
values: [email]
});
if (existing.length > 0) {
throw new Error('E-Mail bereits registriert');
}
```
---
## 🚨 Problem 10: Trial-Management läuft nicht
### Symptome
- Keine E-Mails an Tag 3, 5, 7
- Cron-Workflow wird nicht ausgeführt
### Diagnose
```bash
# In n8n: Executions filtern nach "Trial Management"
# Prüfen ob täglich um 9:00 Uhr ausgeführt wird
```
### Lösungen
#### A) Workflow nicht aktiviert
1. Öffnen Sie "BotKonzept - Trial Management"
2. Aktivieren Sie den Workflow (Toggle oben rechts)
#### B) Cron-Expression falsch
1. Öffnen Sie den Node "Daily at 9 AM"
2. Prüfen Sie die Expression: `0 9 * * *`
3. Testen Sie mit: https://crontab.guru/#0_9_*_*_*
#### C) Keine Trial-Kunden vorhanden
```sql
-- Prüfen
SELECT * FROM customers WHERE status = 'trial';
-- Test-Kunde erstellen
INSERT INTO customers (email, first_name, last_name, status, created_at)
VALUES ('test@example.com', 'Test', 'User', 'trial', NOW() - INTERVAL '3 days');
```
---
## 📊 Debugging-Checkliste
Wenn ein Problem auftritt, gehen Sie diese Checkliste durch:
### 1. Frontend
- [ ] Browser-Konsole prüfen (F12)
- [ ] Network-Tab prüfen (Request/Response)
- [ ] Webhook-URL korrekt?
### 2. n8n
- [ ] Workflow aktiviert?
- [ ] Execution History prüfen
- [ ] Jeden Node einzeln testen
- [ ] Credentials korrekt?
### 3. Datenbank
- [ ] Verbindung OK?
- [ ] Tabellen existieren?
- [ ] Berechtigungen OK?
- [ ] Daten werden gespeichert?
### 4. PVE20
- [ ] SSH-Verbindung OK?
- [ ] install.sh existiert?
- [ ] install.sh ausführbar?
- [ ] Manueller Test OK?
### 5. E-Mail
- [ ] SMTP-Verbindung OK?
- [ ] Absender verifiziert?
- [ ] Spam-Ordner prüfen?
- [ ] DNS-Records korrekt?
---
## 🔍 Logs & Debugging
### n8n Logs
```bash
# Container Logs
docker logs -f n8n
# Execution Logs
# In n8n UI: Sidebar → Executions → Click on execution
```
### install.sh Logs
```bash
# Auf PVE20
ls -lh /root/customer-installer/logs/
tail -f /root/customer-installer/logs/install_*.log
```
### PostgreSQL Logs
```bash
# Auf DB Server
tail -f /var/log/postgresql/postgresql-*.log
# Oder in Supabase Dashboard: Logs
```
### E-Mail Logs
```bash
# Postfix
journalctl -u postfix -f
# Amazon SES
# AWS Console → SES → Sending Statistics
```
---
## 🆘 Wenn nichts hilft
### Schritt-für-Schritt-Debugging
1. **Workflow deaktivieren**
2. **Jeden Node einzeln testen:**
```
- Webhook → Test mit curl
- Validate Input → Manuell ausführen
- Generate Password → Output prüfen
- Create Customer → DB prüfen
- SSH → Manuell auf PVE20 testen
- Parse Output → JSON validieren
- Save Instance → DB prüfen
- Send Email → Test-E-Mail
```
3. **Logs sammeln:**
- n8n Execution
- install.sh Log
- PostgreSQL Log
- E-Mail Log
4. **Support kontaktieren** mit allen Logs
---
## 📞 Support-Kontakt
**E-Mail:** support@botkonzept.de
**Bitte inkludieren:**
- Fehlermeldung (vollständig)
- n8n Execution ID
- Logs (n8n, install.sh, DB)
- Was Sie bereits versucht haben
---
**Version:** 1.0.0
**Letzte Aktualisierung:** 26.01.2025