Add full support for 2 container types (development and production):
Backend Changes:
- New UserContainer model with unique constraint on (user_id, container_type)
- Removed single-container fields from User model (container_id, container_port)
- Added CONTAINER_TEMPLATES config with dev and prod templates
- Implemented spawn_multi_container() method in ContainerManager
- Added 2 new API endpoints:
* GET /api/user/containers - list all containers with status
* POST /api/container/launch/<type> - on-demand container creation
- Multi-container container names and Traefik routing with type suffix
Frontend Changes:
- New Container, ContainersResponse, LaunchResponse types
- Implemented getUserContainers() and launchContainer() API functions
- Completely redesigned dashboard with 2 container cards
- Status display with icons for each container type
- "Create & Open" and "Open Service" buttons based on container status
- Responsive grid layout
Templates:
- user-template-next already configured with Tailwind CSS and Shadcn/UI
Documentation:
- Added IMPLEMENTATION_SUMMARY.md with complete feature list
- Added TEST_VERIFICATION.md with detailed testing guide
- Updated .env.example with USER_TEMPLATE_IMAGE_DEV/PROD variables
This MVP allows each user to manage 2 distinct containers with:
- On-demand lazy creation
- Status tracking per container
- Unique URLs: /{slug}-dev and /{slug}-prod
- Proper Traefik routing with StripPrefix middleware
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
129 lines
4.4 KiB
Plaintext
129 lines
4.4 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 - Normalerweise keine Aenderung noetig
|
|
# ============================================================
|
|
|
|
# Docker Socket Pfad (Standard fuer Linux)
|
|
# Fuer Windows: npipe:////./pipe/docker_engine
|
|
# Fuer TCP: tcp://localhost:2375
|
|
DOCKER_HOST=unix:///var/run/docker.sock
|
|
|
|
# Docker-Image fuer User-Container (LEGACY - wird noch verwendet)
|
|
# Verfuegbare Templates:
|
|
# - user-service-template:latest (nginx, einfache Willkommensseite)
|
|
# - user-template-next:latest (Next.js, moderne React-App)
|
|
USER_TEMPLATE_IMAGE=user-service-template:latest
|
|
|
|
# Multi-Container Templates (MVP)
|
|
# Development Container Image
|
|
USER_TEMPLATE_IMAGE_DEV=user-service-template:latest
|
|
|
|
# Production Container Image (Next.js mit Shadcn/UI)
|
|
USER_TEMPLATE_IMAGE_PROD=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
|