spawner/.env.example
XPS\Micro 10b28179fc feat: implement dynamic template system with auto-detection
**Backend (config.py):**
- Add dynamic template loading from USER_TEMPLATE_IMAGES (.env)
- Add template metadata loading from templates.json
- Implement automatic type extraction from image names
- Remove hardcoded template definitions (dev/prod)
- Maintain legacy USER_TEMPLATE_IMAGE for backward compatibility

**Configuration:**
- Add templates.json with metadata for template-01, template-02, template-next
- Update .env.example with new USER_TEMPLATE_IMAGES variable (semicolon-separated)
- Document automatic template type extraction

**Installation (install.sh):**
- Implement auto-detection for all user-template-* directories
- Replace hardcoded template builds with dynamic loop
- Calculate TOTAL_BUILDS dynamically
- Add special handling for Next.js templates

**Documentation:**
- Move MVP_DEPLOYMENT_GUIDE.md to docs/install/DEPLOYMENT_GUIDE.md
- Add "Dynamic Template System" section to CLAUDE.md
- Update docs/install/README.md with Quick Links and dynamic system info
- Add references to deployment guide in CLAUDE.md

**Templates:**
- Reorganize user-template/ → user-template-01/ (Nginx Basic)
- Add user-template-02/ (Nginx Advanced)
- Keep user-template-next/ unchanged

**Benefits:**
- Unlimited number of templates (no longer hardcoded to 2)
- Metadata-driven display in dashboard
- Automatic image discovery and building
- Extensible without code changes

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-01 09:04:59 +01:00

136 lines
4.8 KiB
Plaintext

# Container Spawner Konfiguration
# Kopiere diese Datei nach .env und passe die Werte an
# cp .env.example .env
# ============================================================
# PFLICHT - Diese Werte MUESSEN angepasst werden
# ============================================================
# Flask Session Secret - Generiere mit:
# python3 -c "import secrets; print(secrets.token_hex(32))"
SECRET_KEY=HIER_DEINEN_GEHEIMEN_SCHLUESSEL_EINTRAGEN
# Deine Domain (z.B. example.com, wieland.org)
BASE_DOMAIN=example.com
# Subdomain fuer den Spawner (z.B. coder -> coder.example.com)
SPAWNER_SUBDOMAIN=coder
# Name des Traefik-Netzwerks (muss existieren oder wird erstellt)
TRAEFIK_NETWORK=web
# ============================================================
# TRAEFIK - Anpassen an deine Traefik-Konfiguration
# ============================================================
# Name des Traefik Certificate Resolvers (aus deiner traefik.yml)
# Typische Namen: lets-encrypt, letsencrypt, hetzner, cloudflare, default
TRAEFIK_CERTRESOLVER=lets-encrypt
# Traefik Entrypoint fuer HTTPS (Standard: websecure)
TRAEFIK_ENTRYPOINT=websecure
# ============================================================
# DOCKER - Template-Konfiguration (Dynamisches System)
# ============================================================
# Docker Socket Pfad (Standard fuer Linux)
# Fuer Windows: npipe:////./pipe/docker_engine
# Fuer TCP: tcp://localhost:2375
DOCKER_HOST=unix:///var/run/docker.sock
# LEGACY Variable (wird noch für alte spawn_container() verwendet)
# Nutze diese nur für Fallback, nutze stattdessen USER_TEMPLATE_IMAGES
USER_TEMPLATE_IMAGE=user-template-01:latest
# Dynamische Template-Liste (Semikolon-getrennt)
# Format: image1:tag;image2:tag;image3:tag
# Die Template-Metadaten (Namen, Beschreibungen) werden aus templates.json geladen
#
# Beispiele:
# - user-template-01:latest (Nginx Basic)
# - user-template-02:latest (Nginx Advanced)
# - user-template-next:latest (Next.js Production)
#
# WICHTIG:
# - Alle Images müssen gebaut sein (siehe install.sh)
# - Für Metadaten (Display-Namen, Beschreibungen) siehe templates.json
# - Container-Typen werden automatisch aus Image-Namen extrahiert
# Beispiel: user-template-01:latest → Typ: template-01
USER_TEMPLATE_IMAGES=user-template-01:latest;user-template-02:latest;user-template-next:latest
# ============================================================
# RESSOURCEN - Container-Limits
# ============================================================
# RAM-Limit pro User-Container
DEFAULT_MEMORY_LIMIT=512m
# CPU-Quota (50000 = 0.5 CPU, 100000 = 1 CPU)
DEFAULT_CPU_QUOTA=50000
# ============================================================
# JWT - Authentifizierung
# ============================================================
# JWT Secret (verwendet SECRET_KEY wenn nicht gesetzt)
# JWT_SECRET_KEY=
# JWT Token Gueltigkeitsdauer in Sekunden (Standard: 1 Stunde)
JWT_ACCESS_TOKEN_EXPIRES=3600
# ============================================================
# CORS - Cross-Origin Resource Sharing
# ============================================================
# CORS erlaubte Origins (kommasepariert)
# WICHTIG: Wird automatisch aus SPAWNER_SUBDOMAIN und BASE_DOMAIN generiert
# Nur setzen wenn du zusaetzliche Origins brauchst
# CORS_ORIGINS=https://coder.example.com,http://localhost:3000
# ============================================================
# OPTIONAL - Logging und Debugging
# ============================================================
# Spawner-Port (intern, nur fuer direkten Zugriff)
SPAWNER_PORT=5000
# Log-Level (DEBUG, INFO, WARNING, ERROR)
LOG_LEVEL=INFO
# Container-Timeout in Sekunden (fuer Auto-Shutdown, noch nicht implementiert)
CONTAINER_IDLE_TIMEOUT=3600
# ============================================================
# PASSWORDLESS AUTH - Magic Links
# ============================================================
# Gueltigkeitsdauer von Magic Link Tokens in Sekunden (Standard: 15 Minuten)
MAGIC_LINK_TOKEN_EXPIRY=900
# Max. Anzahl Magic Links pro Email-Adresse pro Stunde (Rate Limiting)
MAGIC_LINK_RATE_LIMIT=3
# ============================================================
# EMAIL - Magic Links und Benachrichtigungen
# ============================================================
# SMTP-Server Konfiguration
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=noreply@example.com
SMTP_PASSWORD=your-smtp-password
SMTP_FROM=noreply@example.com
SMTP_USE_TLS=true
# Frontend-URL fuer Email-Links (Magic Links, etc.)
# WICHTIG: Muss die URL sein, unter der das Frontend erreichbar ist
FRONTEND_URL=https://coder.example.com
# ============================================================
# PRODUKTION - Erweiterte Einstellungen
# ============================================================
# PostgreSQL statt SQLite (empfohlen fuer Produktion)
# DATABASE_URL=postgresql://spawner:password@postgres:5432/spawner