diff --git a/.env.development b/.env.development index 92535d6e6..cf77b28b5 100644 --- a/.env.development +++ b/.env.development @@ -57,6 +57,12 @@ STRIPE_SECRET_KEY=sk_test_YOUR_KEY STRIPE_PUBLISHABLE_KEY=pk_test_YOUR_KEY STRIPE_WEBHOOK_SECRET=whsec_YOUR_SECRET +# Email (Brevo/SendinBlue) - GDPR compliant EU provider +# Get your API key from https://app.brevo.com/settings/keys/api +BREVO_API_KEY=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 +BREVO_FROM_EMAIL=noreply@manacore.app +BREVO_FROM_NAME=Mana Core + # ============================================ # CHAT PROJECT # ============================================ diff --git a/CI_CD_IMPLEMENTATION_SUMMARY.md b/CI_CD_IMPLEMENTATION_SUMMARY.md index f325de822..6f2702af7 100644 --- a/CI_CD_IMPLEMENTATION_SUMMARY.md +++ b/CI_CD_IMPLEMENTATION_SUMMARY.md @@ -52,7 +52,7 @@ All scripts in `scripts/deploy/`: | Script | Purpose | Features | | ------------------- | ---------------------------- | -------------------------------------------------- | | `build-and-push.sh` | Build and push Docker images | Error handling, colored output, progress tracking | -| `deploy-hetzner.sh` | Deploy to Hetzner/Coolify | Zero-downtime, health checks, rollback on failure | +| `deploy-hetzner.sh` | Deploy to Hetzner VPS | Zero-downtime, health checks, rollback on failure | | `health-check.sh` | Verify service health | Multiple endpoints, timeout handling | | `rollback.sh` | Emergency rollback | Automated backup restoration, confirmation prompts | | `migrate-db.sh` | Run database migrations | Supabase + Drizzle support, safe execution | diff --git a/HIVE_MIND_FINAL_REPORT.md b/HIVE_MIND_FINAL_REPORT.md index 7657122bb..478a9b9d7 100644 --- a/HIVE_MIND_FINAL_REPORT.md +++ b/HIVE_MIND_FINAL_REPORT.md @@ -13,7 +13,7 @@ The Hive Mind collective has successfully analyzed, designed, and implemented a **complete production-ready deployment system** for the manacore-monorepo. Through coordinated effort across 4 specialized worker agents, we've delivered: -- **Comprehensive hosting platform analysis** (Hetzner + Coolify recommended) +- **Comprehensive hosting platform analysis** (Hetzner + Docker Compose recommended) - **Complete deployment architecture** for 39 services across 10 projects - **Fully automated CI/CD pipeline** with GitHub Actions - **Production-ready testing infrastructure** targeting 80% coverage @@ -29,7 +29,7 @@ The Hive Mind collective has successfully analyzed, designed, and implemented a ### 1️⃣ RESEARCHER AGENT - Infrastructure Analysis -**Mission**: Research and compare Hetzner vs Coolify hosting options +**Mission**: Research and compare Hetzner hosting options **Key Findings**: @@ -70,7 +70,7 @@ The Hive Mind collective has successfully analyzed, designed, and implemented a **Architecture Highlights**: -- **Environment Stages**: Development (local) → Staging (Coolify) → Production (Coolify/K8s) +- **Environment Stages**: Development (local) → Staging (Docker Compose) → Production (Docker Compose/K8s) - **Domain Strategy**: `{service}.manacore.app` (e.g., `api-chat.manacore.app`) - **Disaster Recovery**: RTO < 1 hour, RPO < 24 hours, automated daily backups - **Resource Requirements**: 15 vCPU, 15 GB RAM, 100 GB SSD (~$150-300/month single-server) @@ -169,7 +169,7 @@ The Hive Mind collective has successfully analyzed, designed, and implemented a - **Reasoning**: Instant rollback, minimal risk, production-proven - **Vote**: Unanimous approval -3. **Container Orchestration**: Start with Coolify, migrate to K8s when scale demands +3. **Container Orchestration**: Start with Docker Compose, migrate to K8s when scale demands - **Reasoning**: Simplicity now, scalability later - **Vote**: Unanimous approval @@ -256,7 +256,7 @@ The Hive Mind collective has successfully analyzed, designed, and implemented a **Week 3-4**: - [ ] Provision production server(s) -- [ ] Set up production environment in Coolify +- [ ] Set up production environment with Docker Compose - [ ] Deploy mana-core-auth service - [ ] Deploy first 2 projects (chat, picture) - [ ] Configure monitoring (Prometheus + Grafana) @@ -409,7 +409,7 @@ The Hive Mind collective has successfully analyzed, designed, and implemented a - ✅ ISO 27001 certified infrastructure (Hetzner) - ✅ SOC 2 Type II (Supabase) - ✅ Automated backup retention policies -- ✅ Audit logs (GitHub Actions, Coolify, Supabase) +- ✅ Audit logs (GitHub Actions, Supabase) --- @@ -489,7 +489,7 @@ The Hive Mind collective has successfully analyzed, designed, and implemented a **Session 2: Infrastructure Setup (2 hours)** - Hands-on: Set up Hetzner server -- Hands-on: Install and configure Coolify +- Hands-on: Set up Docker Compose - Practice: Deploy test service **Session 3: CI/CD Operations (2 hours)** @@ -572,7 +572,7 @@ The Hive Mind collective has successfully analyzed, designed, and implemented a ### Long-Term (6-12 Months) 1. **Kubernetes Migration** - - Migrate from Coolify to Hetzner Kubernetes + - Migrate from Docker Compose to Hetzner Kubernetes - Implement Helm charts for all services - Set up Istio service mesh @@ -829,7 +829,7 @@ pnpm test:e2e **Official Documentation**: - [Hetzner Cloud Docs](https://docs.hetzner.com/) -- [Coolify Documentation](https://coolify.io/docs) +- [Docker Compose Documentation](https://docs.docker.com/compose/) - [Turborepo Docs](https://turbo.build/repo/docs) - [pnpm Workspaces](https://pnpm.io/workspaces) - [GitHub Actions](https://docs.github.com/en/actions) diff --git a/apps-archived/memoro/apps/landing/docs/features/admin-tool-modularization-and-replicate-integration.md b/apps-archived/memoro/apps/landing/docs/features/admin-tool-modularization-and-replicate-integration.md deleted file mode 100644 index 39a90be56..000000000 --- a/apps-archived/memoro/apps/landing/docs/features/admin-tool-modularization-and-replicate-integration.md +++ /dev/null @@ -1,561 +0,0 @@ -# Admin-Tool Modularisierung & Replicate-Integration - -> **Dokument erstellt:** 28.01.2025 -> **Status:** Konzeptphase -> **Ziel:** Wiederverwendbares Admin-Tool mit KI-Bildgenerierung - -## 📋 Executive Summary - -Das Memoro Admin-Tool entwickelt sich zu einem eigenständigen, wertvollen Werkzeug. Dieses Dokument beschreibt Konzepte zur: -1. **Modularisierung** des Admin-Tools für Wiederverwendbarkeit in anderen Projekten -2. **Integration von Replicate** zur KI-basierten Bildgenerierung für Personas -3. **Backend-Architektur** auf Hetzner VPS mit Coolify - -## 🎯 Anforderungen - -### Funktionale Anforderungen -- Admin-Tool soll in anderen Websites wiederverwendbar sein -- Komplette Trennung von Code und Content -- KI-basierte Bildgenerierung für Personas via Replicate -- Zentrale Backend-Services auf Hetzner VPS -- Verwaltung via Coolify (Docker-basiert) - -### Nicht-funktionale Anforderungen -- Einfache Installation/Integration -- Minimale Dependencies -- Skalierbare Architektur -- Sichere API-Kommunikation -- Kosteneffiziente Bildgenerierung - -## 🏗️ Modularisierungskonzepte - -### Konzept 1: NPM Package + API Backend -**Architektur:** -``` -@memoro/admin-tool (NPM Package) -├── components/ # Wiederverwendbare UI-Komponenten -├── layouts/ # Admin-Layouts -├── hooks/ # React/Vue Hooks für API -├── types/ # TypeScript Definitionen -└── utils/ # Helper Functions - -@memoro/admin-api (Separates Backend) -├── /api/personas # Personas CRUD -├── /api/images # Bildgenerierung -├── /api/content # Content Management -└── /api/auth # Authentication -``` - -**Vorteile:** -- ✅ Maximale Wiederverwendbarkeit -- ✅ Framework-agnostisch (Adapter Pattern) -- ✅ Versionskontrolle via NPM -- ✅ Type-Safety durch TypeScript - -**Nachteile:** -- ❌ Komplexe Initial-Setup -- ❌ Wartung von zwei Packages -- ❌ Breaking Changes Management - -**Integration:** -```typescript -// In beliebiger Astro/Next/Vue App -import { AdminTool } from '@memoro/admin-tool'; -import { MemoroadminProvider } from '@memoro/admin-tool/providers'; - -// Konfiguration -const config = { - apiUrl: 'https://api.memoro-admin.com', - apiKey: process.env.MEMORO_API_KEY, - features: ['personas', 'content', 'images'] -}; - - - - -``` - -### Konzept 2: Monorepo mit Shared Packages -**Struktur:** -``` -memoro-workspace/ -├── apps/ -│ ├── memoro-website/ # Aktuelle Website -│ ├── admin-dashboard/ # Standalone Admin -│ └── api-backend/ # Zentrales Backend -├── packages/ -│ ├── admin-ui/ # UI Components -│ ├── admin-core/ # Business Logic -│ ├── content-types/ # Shared Types -│ └── api-client/ # API Client Library -└── services/ - ├── image-generator/ # Replicate Service - └── content-sync/ # Content Synchronization -``` - -**Vorteile:** -- ✅ Einheitliche Entwicklung -- ✅ Shared Dependencies -- ✅ Einfaches Testing -- ✅ Atomic Commits - -**Nachteile:** -- ❌ Größeres Repository -- ❌ Komplexere CI/CD -- ❌ Schwieriger für externe Nutzer - -**Tools:** -- Turborepo oder NX für Monorepo Management -- Changesets für Versionierung -- pnpm Workspaces für Dependencies - -### Konzept 3: Microservices + Web Components -**Architektur:** -``` -Frontend (Web Components) -├── -├── -├── -└── - -Microservices (Docker/Coolify) -├── persona-service/ # Node.js/Fastify -├── image-service/ # Python/FastAPI + Replicate -├── content-service/ # Node.js/Express -├── auth-service/ # Node.js/JWT -└── gateway/ # Kong/Traefik -``` - -**Vorteile:** -- ✅ Framework-unabhängig -- ✅ Isolierte Services -- ✅ Unabhängige Skalierung -- ✅ Native Browser-Support - -**Nachteile:** -- ❌ Komplexe Orchestrierung -- ❌ Network Latency -- ❌ Service Discovery - -**Integration:** -```html - - - - -``` - -### Konzept 4: Plugin-System (Empfohlen) ⭐ -**Architektur:** -``` -@memoro/admin-core -├── core/ -│ ├── plugin-system.ts # Plugin Registry -│ ├── api-client.ts # API Abstraction -│ └── auth.ts # Auth Management -├── plugins/ -│ ├── personas/ # Personas Plugin -│ ├── image-generator/ # Replicate Plugin -│ ├── content-manager/ # Content Plugin -│ └── analytics/ # Analytics Plugin -└── adapters/ - ├── astro/ # Astro Integration - ├── nextjs/ # Next.js Integration - └── vue/ # Vue Integration -``` - -**Plugin-Beispiel:** -```typescript -// personas-plugin.ts -export const personasPlugin: AdminPlugin = { - id: 'personas', - name: 'Personas Management', - version: '1.0.0', - routes: [ - { path: '/personas', component: PersonasList }, - { path: '/personas/:id', component: PersonaDetail } - ], - api: { - endpoints: [ - { method: 'GET', path: '/personas', handler: getPersonas }, - { method: 'POST', path: '/personas/:id/image', handler: generateImage } - ] - }, - permissions: ['personas.read', 'personas.write', 'personas.generate'], - config: { - replicateModel: 'stability-ai/sdxl', - imageStyles: ['portrait', 'professional', 'casual'] - } -}; -``` - -**Vorteile:** -- ✅ Maximale Flexibilität -- ✅ Einfache Erweiterung -- ✅ Selective Features -- ✅ Community Plugins möglich - -**Nachteile:** -- ❌ Initial-Komplexität -- ❌ Plugin-Kompatibilität -- ❌ Versioning-Challenges - -## 🖼️ Replicate Integration - -### Backend Service Architektur -```typescript -// services/image-generator/src/replicate-service.ts -import Replicate from 'replicate'; -import { Queue } from 'bullmq'; -import { S3 } from '@aws-sdk/client-s3'; - -export class ReplicateImageService { - private replicate: Replicate; - private queue: Queue; - private storage: S3; - - async generatePersonaImage(persona: Persona): Promise { - // 1. Prompt generieren basierend auf Persona-Daten - const prompt = this.buildPrompt(persona); - - // 2. Job in Queue einreihen - const job = await this.queue.add('generate-image', { - personaId: persona.id, - prompt, - model: 'stable-diffusion-xl', - parameters: { - width: 1024, - height: 1024, - num_outputs: 4, - guidance_scale: 7.5 - } - }); - - // 3. Auf Completion warten - const result = await job.waitUntilFinished(); - - // 4. Bilder in S3/Hetzner speichern - const imageUrls = await this.storeImages(result.images); - - return imageUrls; - } - - private buildPrompt(persona: Persona): string { - const { appearance, outfits, demographics } = persona; - - return ` - Professional portrait photo of a ${demographics.age} year old ${demographics.gender}, - ${appearance.description}, - ${appearance.hairColor} hair in ${appearance.hairStyle}, - ${appearance.eyeColor} eyes, - wearing ${outfits[0]?.items.top || 'business attire'}, - ${appearance.firstImpression}, - studio lighting, high quality, detailed, realistic - `; - } -} -``` - -### Admin UI Integration -```typescript -// components/PersonaImageGenerator.tsx -export function PersonaImageGenerator({ persona }: Props) { - const [generating, setGenerating] = useState(false); - const [images, setImages] = useState([]); - const [selectedImage, setSelectedImage] = useState(); - const [prompt, setPrompt] = useState(''); - - const generateImages = async () => { - setGenerating(true); - - const response = await fetch(`/api/personas/${persona.id}/generate-images`, { - method: 'POST', - body: JSON.stringify({ - prompt: prompt || buildDefaultPrompt(persona), - style: selectedStyle, - count: 4 - }) - }); - - const data = await response.json(); - setImages(data.images); - setGenerating(false); - }; - - return ( -
-

KI Bildgenerierung

- - {/* Prompt Editor */} -