8.6 KiB
8.6 KiB
🤖 JARVIS - KI-Assistent + Business Automation
Vollständiges Docker-Stack für JARVIS: KI-Backend + Datenbanken + Workflow-Automation
Architektur-Übersicht
┌─────────────────────────────────────────────────────────┐
│ JARVIS CORE (VPS) │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ TRAEFIK (Reverse Proxy / Load Balancer) │ │
│ │ Ports: 80, 443, 8080 │ │
│ └─────────────────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────┬──────────────────┬──────────────┐ │
│ │ WEB │ API │ n8n │ │
│ │ (Frontend) │ (FastAPI) │ (Automation) │ │
│ │ Port: 3000 │ Port: 8000 │ Port: 5678 │ │
│ └──────────────────┴──────────────────┴──────────────┘ │
│ ▼ │
│ ┌──────────────────┬──────────────────┬──────────────┐ │
│ │ PostgreSQL │ Redis │ Milvus │ │
│ │ Port: 5432 │ Port: 6379 │ Port: 19530 │ │
│ │ (Structured) │ (Cache) │ (Vector DB) │ │
│ └──────────────────┴──────────────────┴──────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ OLLAMA (Local LLM - Optional) │ │
│ │ Port: 11434 │ │
│ │ Alternative: Claude API (via Python) │ │
│ └─────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────┘
Schnelstart
1️⃣ SSH-Zugriff einrichten
# Speichern der Private Key
# Putty: key → jarvis_ed25519.ppk
# SSH: ssh -i jarvis_ed25519 jarvis-core@72.61.186.98
2️⃣ Setup-Script ausführen
ssh -i jarvis_ed25519 jarvis-core@72.61.186.98
# Download setup script
curl -o setup-jarvis-complete.sh https://path/to/setup-jarvis-complete.sh
chmod +x setup-jarvis-complete.sh
# Run with domain
./setup-jarvis-complete.sh jarvis.mbo-tech-it.de
3️⃣ Konfigurieren
cd /home/jarvis-core/jarvis
# Edit .env - WICHTIG: API-Keys eintragen!
nano .env
# Erforderlich:
# - CLAUDE_API_KEY (für Claude API)
# - DB_PASSWORD (wird generiert, aber prüfe es)
# - Alle anderen Keys werden auto-generiert
4️⃣ Docker-Stack starten
# Starten
docker-compose up -d
# Logs prüfen
docker-compose logs -f
# Status
docker-compose ps
Services & Ports
| Service | URL | Port | Beschreibung |
|---|---|---|---|
| Web Dashboard | http://localhost:3000 | 3000 | Frontend UI |
| API Backend | http://localhost:8000 | 8000 | FastAPI Server |
| n8n Workflows | http://localhost:5678 | 5678 | Automatisierung |
| Traefik Dashboard | http://localhost:8080 | 8080 | Proxy Management |
| PostgreSQL | localhost | 5432 | Hauptdatenbank |
| Redis | localhost | 6379 | Cache/Sessions |
| Milvus | localhost | 19530 | Vector Search |
| Ollama | http://localhost:11434 | 11434 | Local LLM (opt.) |
Datenbankstruktur
PostgreSQL (jarvis)
- users - Benutzer & Authentifizierung
- conversations - Chat-Verlauf
- messages - Einzelne Nachrichten
- tasks - Automatisierungsaufgaben
- documents - Knowledge Base
- audit_logs - Audit Trail
Milvus (Vector DB)
- Semantic Search in Dokumenten
- Embeddings für RAG (Retrieval-Augmented Generation)
Redis
- Session Management
- Caching
- Job Queue (für n8n)
API Endpoints
Chat
POST /api/v1/chat
{
"conversation_id": 1,
"message": "Deine Frage",
"context": {}
}
GET /api/v1/conversations/{id}
Tasks
POST /api/v1/tasks
{
"title": "Task Name",
"description": "Beschreibung",
"task_type": "automation",
"priority": 1
}
GET /api/v1/tasks?status=pending
Documents (Knowledge Base)
POST /api/v1/documents
{
"title": "Dokument",
"content": "...",
"document_type": "manual"
}
GET /api/v1/documents?query=search+term
Workflows (n8n)
POST /api/v1/workflows/trigger
{
"workflow_id": "workflow_name",
"data": {}
}
Umgebungsvariablen (.env)
# Domain
DOMAIN=jarvis.mbo-tech-it.de
# Database
DB_PASSWORD=SecurePassword123!
# KI / LLM
CLAUDE_API_KEY=sk-ant-...
OLLAMA_MODEL=mistral
# Security
JWT_SECRET=random-secret-key
API_KEY_ADMIN=admin-api-key
# Logging
LOG_LEVEL=info
Häufige Befehle
cd /home/jarvis-core/jarvis
# Alle Container starten
docker-compose up -d
# Spezifischen Service neu starten
docker-compose restart jarvis-api
# Logs ansehen
docker-compose logs -f jarvis-api
# In Container gehen
docker-compose exec jarvis-api bash
# Database mit psql verbinden
docker-compose exec postgres psql -U jarvis -d jarvis
# Alle Container stoppen
docker-compose down
# Mit Daten löschen (Vorsicht!)
docker-compose down -v
Integration mit Claude API
Python-Client Beispiel
import os
import anthropic
client = anthropic.Anthropic(api_key=os.getenv("CLAUDE_API_KEY"))
message = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[
{"role": "user", "content": "Deine Frage"}
]
)
print(message.content[0].text)
n8n Workflows
Beispiel-Automation: Kundenbericht generieren
- Trigger: Zeitplan (täglich)
- Node: PostgreSQL - Daten abrufen
- Node: Claude API - Bericht generieren
- Node: PDF generieren
- Node: Email versenden
Security Best Practices
✅ Production Ready:
- HTTPS/SSL konfigurieren (Let's Encrypt)
- Firewall-Regeln (nur erlaubte IPs)
- Secrets in .env nicht in Git
- Regelmäßige DB-Backups
- Monitoring & Alerts einrichten
- Rate Limiting aktivieren
- API-Keys rotieren
⚠️ Aktuell (Test):
- HTTP nur lokal/intern
- Standard-Passwörter (ÄNDERN!)
- Keine Authentifizierung erzwungen
Troubleshooting
Container startet nicht
docker-compose logs jarvis-api
# → Fehlerlog prüfen
Datenbank nicht erreichbar
docker-compose exec postgres psql -U jarvis -d jarvis -c "SELECT 1"
Redis Cache Fehler
docker-compose exec redis redis-cli ping
# → PONG = OK
Milvus Vector DB Fehler
docker-compose exec milvus curl http://localhost:9091/healthz
Monitoring
# System-Stats
docker stats
# Container Logs (real-time)
docker-compose logs -f
# Health Check
curl http://localhost:8000/health
curl http://localhost:8000/api/v1/admin/health/detailed
Nächste Schritte
- ✅ Docker-Stack deployed
- ⏳ Claude API Integration (Python)
- ⏳ Web-Frontend (React/Vue)
- ⏳ n8n Workflows konfigurieren
- ⏳ Knowledge Base aufbauen
- ⏳ Production Deployment (SSL, Backups, etc.)
Support & Dokumentation
- FastAPI Docs - Swagger UI
- n8n Docs
- PostgreSQL Docs
- Milvus Docs
- Claude API Docs
🚀 JARVIS ist bereit für die KI-Integration!