Deployment-Übersicht¶
TCM365 unterstützt mehrere Deployment-Strategien, von lokalen Docker Compose Umgebungen bis hin zu vollständig verwalteten Azure Cloud Services.
Unterstützte Plattformen¶
| Plattform | Einsatzzweck | Infrastruktur |
|---|---|---|
| Docker Compose | Entwicklung und Staging | Container auf beliebigem Host |
| Azure App Service | Produktion | Managed PaaS auf Azure |
| Coolify | Self-hosted PaaS | Docker-basiertes Self-Hosting |
Architektur-Übersicht¶
Ein typisches TCM365 Deployment besteht aus folgenden Komponenten:
+-------------------+
| Load Balancer |
| (Nginx / CDN) |
+--------+----------+
|
+--------------+--------------+
| |
+---------v----------+ +-----------v---------+
| Frontend (Vue) | | Backend (NestJS) |
| Statische Assets | | Port 8000 |
| Nginx Serving | | API Endpoints |
+--------------------+ +---------+-----------+
|
+--------------+--------------+
| | |
+---------v---+ +-------v-----+ +----v--------+
| PostgreSQL | | Redis | | Azure Blob |
| (RLS + | | (Optional) | | / Lokales |
| Schemas) | | | | Dateisystem|
+-------------+ +-------------+ +-------------+
Deployment-Komponenten¶
Pflichtkomponenten¶
| Komponente | Version | Zweck |
|---|---|---|
| PostgreSQL | 15+ | Primäre Datenbank mit RLS und Schema-Isolation |
| Node.js | 18+ | Backend Runtime |
Optionale Komponenten¶
| Komponente | Version | Zweck | Fallback |
|---|---|---|---|
| Redis | 7+ | Rate Limiting, Capture Locks | In-Memory |
| Azure Key Vault | -- | Secret Management | LocalAES Encryption |
| Azure Blob Storage | -- | Dateispeicherung | Lokales Dateisystem |
Deployment-Strategien¶
Docker Compose (empfohlen für Staging)¶
Docker Compose bietet den einfachsten Weg, den gesamten Stack zu deployen. Drei Konfigurationen stehen zur Verfügung:
| Datei | Zweck |
|---|---|
docker-compose.yml |
Vollständiger Produktions-Stack |
docker-compose.local.yml |
Entwicklung (nur PostgreSQL + Redis) |
docker-compose.coolify.yml |
Coolify Self-hosted Deployment |
Details im Docker Deployment Guide.
Azure App Service (empfohlen für Produktion)¶
Azure App Service bietet Managed Hosting mit automatischer Skalierung, SSL und Integration mit weiteren Azure-Diensten:
- Azure App Service für Backend- und Frontend-Hosting
- Azure Database for PostgreSQL als verwaltete Datenbank
- Azure Key Vault für Secret Management
- Azure Blob Storage für Snapshot- und Report-Speicherung
- Azure Pipelines für CI/CD Automatisierung
Details im Azure Deployment Guide.
Infrastructure as Code¶
TCM365 beinhaltet Azure Bicep Templates für die Infrastruktur-Provisionierung:
infrastructure/azure/bicep/
├── main.bicep # Orchestrator Template
├── webapp.bicep # App Service Konfiguration
├── database.bicep # PostgreSQL Konfiguration
├── keyvault.bicep # Key Vault Konfiguration
└── storage.bicep # Blob Storage Konfiguration
Umgebungskonfiguration¶
Kritische Umgebungsvariablen¶
Diese Umgebungsvariablen müssen für jedes Deployment konfiguriert werden:
| Variable | Beschreibung | Beispiel |
|---|---|---|
APP_SECRET_KEY |
JWT Signing Secret (min. 32 Zeichen) | your-production-secret-key-here |
DATABASE_HOST |
PostgreSQL Hostname | db.example.com |
DATABASE_PORT |
PostgreSQL Port | 5432 |
DATABASE_USERNAME |
PostgreSQL Benutzername | tcm_user |
DATABASE_PASSWORD |
PostgreSQL Passwort | secure-password |
DATABASE_NAME |
PostgreSQL Datenbankname | tcm_db |
PORT |
Backend Server Port | 8000 |
CORS_ORIGINS |
Erlaubte CORS Origins | https://tcm.example.com |
Storage Backend¶
| Umgebung | Einstellung | Details |
|---|---|---|
| Entwicklung | STORAGE_BACKEND=local |
Dateien in LOCAL_STORAGE_PATH |
| Produktion | STORAGE_BACKEND=azure |
Dateien in Azure Blob Storage |
Sicherheits-Checkliste¶
Produktions-Checkliste
Vor dem Deployment in Produktion sicherstellen:
-
APP_SECRET_KEYist ein einzigartiger, kryptographisch zufaelliger String (min. 32 Zeichen) -
APP_DEBUGist auffalsegesetzt - Datenbank-Credentials sind keine Standardwerte
-
CORS_ORIGINSenthält nur Produktions-Domains - HTTPS ist erzwungen (HTTP zu HTTPS Redirect)
- Azure AD Credentials sind sicher gespeichert (Key Vault)
- Rate Limiting ist aktiviert (Redis oder In-Memory)
- Datenbank-Backups sind konfiguriert
CI/CD Pipeline¶
TCM365 beinhaltet eine Azure Pipelines Konfiguration unter infrastructure/azure-pipelines.yml, die folgende Schritte automatisiert:
- Install --
npm cifür Backend und Frontend - Lint -- ESLint Code Quality Checks
- Test -- Jest Unit Tests (780+ Tests)
- Build -- TypeScript Kompilierung und Vite Production Build
- Deploy -- Push auf Azure App Service (Staging, dann Produktion)
# Vereinfachte Pipeline-Übersicht
trigger:
branches:
include:
- main
stages:
- stage: Build
jobs:
- job: Backend
steps:
- script: npm ci && npm run lint && npm test && npm run build
- job: Frontend
steps:
- script: npm ci && npm run build
- stage: Deploy
jobs:
- deployment: Production
environment: production
Datenbank-Initialisierung¶
Nach dem Deployment der Applikation muss die Datenbank initialisiert werden:
-
Migrationen ausführen:
-
Admin-Benutzer erstellen:
-
Health Check verifizieren:
Automatisiertes Setup
Für neue Deployments automatisieren die Setup-Skripte (scripts/setup.sh oder scripts/setup.ps1) den gesamten Initialisierungsprozess einschliesslich Datenbank-Setup, Migrationen und Admin-Benutzer-Erstellung.
Monitoring¶
Health Check Endpoint¶
Konfigurieren Sie Ihren Load Balancer oder Monitoring Service zum Polling von:
Dieser Endpoint gibt den Datenbank-Verbindungsstatus und die Latenz zurück, ohne Authentifizierung zu erfordern.
Structured Logging¶
Alle Backend-Requests erzeugen strukturierte Log-Einträge mit:
- Timestamp -- ISO 8601 Format
- Log Level -- INFO, WARN, ERROR
- Modul -- Quell-Modulname
- X-Request-ID -- Korrelations-ID
- User -- Authentifizierter Benutzer (falls zutreffend)
2026-03-05T14:30:00Z | INFO | SnapshotsController [req=abc123 op=create user=admin] | Snapshot created
Diagnostics¶
Authentifizierte Administratoren können die vollständige Systemdiagnose abrufen:
Dies liefert den Health Status für Datenbank, Redis, Storage und Azure AD Verbindungen.
Weitergehende Informationen¶
- Docker Deployment -- Detaillierter Docker Deployment Guide
- Azure Deployment -- Azure App Service und IaC Guide