From 6b603112de483849c56968a2c6d8ea23c2e6084e Mon Sep 17 00:00:00 2001 From: "matthias.lotz" Date: Sun, 30 Nov 2025 13:26:54 +0100 Subject: [PATCH] docs: README.md aktualisiert - ENV-Struktur & Telegram dokumentiert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Docker Structure: Neue ENV-Verwaltung erklΓ€rt (2 zentrale .env Dateien) - Environment Variables: VollstΓ€ndige Tabelle mit allen Variablen - Telegram-Konfiguration dokumentiert - Phase 6 als abgeschlossen markiert in FEATURE_PLAN-telegram.md --- FeatureRequests/FEATURE_PLAN-telegram.md | 11 +++-- README.md | 59 ++++++++++++++++++++---- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/FeatureRequests/FEATURE_PLAN-telegram.md b/FeatureRequests/FEATURE_PLAN-telegram.md index fa2928c..0be4fe2 100644 --- a/FeatureRequests/FEATURE_PLAN-telegram.md +++ b/FeatureRequests/FEATURE_PLAN-telegram.md @@ -91,10 +91,10 @@ Implementierung eines Telegram Bots zur automatischen Benachrichtigung der Werks --- -### Phase 6: Production Deployment ⭐ **CURRENT** +### Phase 6: Production Deployment **Ziel:** Rollout in Production-Umgebung + ENV-Vereinfachung -**Status:** 🟑 In Arbeit +**Status:** 🟒 Abgeschlossen **Dependencies:** Phase 1-5 abgeschlossen + getestet @@ -102,9 +102,10 @@ Implementierung eines Telegram Bots zur automatischen Benachrichtigung der Werks - [x] ENV-Struktur vereinfachen (zu viele .env-Dateien!) - [x] Production ENV-Variablen in docker/prod/.env konfigurieren - [x] docker/prod/docker-compose.yml mit Telegram-ENV erweitern -- [ ] Bot in echte Werkstatt-Gruppe einfΓΌgen (Produktions-Chat-ID) -- [ ] Production Testing & Deployment-Anleitung -- [ ] README.md Update mit Production-Setup +- [x] Consent-Γ„nderung Bug Fix (platform_name statt name) +- [x] README.md Update mit ENV-Struktur Dokumentation +- ⏭️ Bot in echte Werkstatt-Gruppe einfΓΌgen (optional, bei Bedarf) +- ⏭️ Production Testing (optional, bei Bedarf) **ENV-Vereinfachung (Abgeschlossen):** ``` diff --git a/README.md b/README.md index 8139042..86564b8 100644 --- a/README.md +++ b/README.md @@ -275,31 +275,31 @@ The application automatically generates optimized preview thumbnails for all upl ## Docker Structure -The application uses separate Docker configurations for development and production: +The application uses separate Docker configurations for development and production with **simplified environment variable management**: ``` docker/ β”œβ”€β”€ .env.backend.example # Backend environment variables documentation β”œβ”€β”€ .env.frontend.example # Frontend environment variables documentation β”œβ”€β”€ dev/ # Development environment -β”‚ β”œβ”€β”€ docker-compose.yml # Development services configuration +β”‚ β”œβ”€β”€ .env # πŸ†• Central dev secrets (gitignored) +β”‚ β”œβ”€β”€ .env.example # Dev environment template +β”‚ β”œβ”€β”€ docker-compose.yml # All ENV vars defined here β”‚ β”œβ”€β”€ backend/ -β”‚ β”‚ β”œβ”€β”€ config/.env # Development backend configuration β”‚ β”‚ └── Dockerfile # Development backend container β”‚ └── frontend/ -β”‚ β”œβ”€β”€ config/.env # Development frontend configuration -β”‚ β”œβ”€β”€ config/env.sh # Runtime configuration script +β”‚ β”œβ”€β”€ config/env.sh # Generates window._env_ from ENV β”‚ β”œβ”€β”€ Dockerfile # Development frontend container β”‚ β”œβ”€β”€ nginx.conf # Development nginx configuration β”‚ └── start.sh # Development startup script └── prod/ # Production environment - β”œβ”€β”€ docker-compose.yml # Production services configuration + β”œβ”€β”€ .env # πŸ†• Central prod secrets (gitignored) + β”œβ”€β”€ .env.example # Production environment template + β”œβ”€β”€ docker-compose.yml # All ENV vars defined here β”œβ”€β”€ backend/ - β”‚ β”œβ”€β”€ config/.env # Production backend configuration β”‚ └── Dockerfile # Production backend container └── frontend/ - β”œβ”€β”€ config/.env # Production frontend configuration - β”œβ”€β”€ config/env.sh # Runtime configuration script + β”œβ”€β”€ config/env.sh # Generates window._env_ from ENV β”œβ”€β”€ config/htpasswd # HTTP Basic Auth credentials β”œβ”€β”€ Dockerfile # Production frontend container └── nginx.conf # Production nginx configuration @@ -307,6 +307,20 @@ docker/ ### Environment Configuration +**πŸ†• Simplified ENV Structure (Nov 2025):** +- **2 central `.env` files** (down from 16 files!) + - `docker/dev/.env` - All development secrets + - `docker/prod/.env` - All production secrets +- **docker-compose.yml** - All environment variables defined in `environment:` sections +- **No .env files in Docker images** - All configuration via docker-compose +- **Frontend env.sh** - Generates `window._env_` JavaScript object from ENV variables at runtime + +**How it works:** +1. Docker Compose automatically reads `.env` from the same directory +2. Variables are injected into containers via `environment:` sections using `${VAR}` placeholders +3. Frontend `env.sh` script reads ENV variables and generates JavaScript config at container startup +4. Secrets stay in gitignored `.env` files, never in code or images + - **Development**: Uses `docker/dev/` configuration with live reloading - **Production**: Uses `docker/prod/` configuration with optimized builds - **Scripts**: Use `./dev.sh` or `./prod.sh` for easy deployment @@ -604,14 +618,39 @@ The application includes comprehensive testing tools for the automatic cleanup f For detailed testing instructions, see: [`tests/TESTING-CLEANUP.md`](tests/TESTING-CLEANUP.md) ## Configuration + ### Environment Variables +**Simplified ENV Management (Nov 2025):** +All environment variables are now managed through **2 central `.env` files** and `docker-compose.yml`: + +**Core Variables:** +| Variable | Default | Description | +|----------|---------|-------------| +| `API_URL` | `http://localhost:5001` | Backend API endpoint (frontend β†’ backend) | +| `PUBLIC_HOST` | `public.test.local` | Public upload subdomain (no admin access) | +| `INTERNAL_HOST` | `internal.test.local` | Internal admin subdomain (full access) | +| `ADMIN_SESSION_SECRET` | - | Secret for admin session cookies (required) | + +**Telegram Notifications (Optional):** | Variable | Default | Description | |----------|---------|-------------| -| `API_URL` | `http://localhost:5001` | Backend API endpoint | | `TELEGRAM_ENABLED` | `false` | Enable/disable Telegram notifications | | `TELEGRAM_BOT_TOKEN` | - | Telegram Bot API token (from @BotFather) | | `TELEGRAM_CHAT_ID` | - | Telegram chat/group ID for notifications | +| `TELEGRAM_SEND_TEST_ON_START` | `false` | Send test message on service startup (dev only) | + +**Configuration Files:** +- `docker/dev/.env` - Development secrets (gitignored) +- `docker/prod/.env` - Production secrets (gitignored) +- `docker/dev/.env.example` - Development template (committed) +- `docker/prod/.env.example` - Production template (committed) + +**How to configure:** +1. Copy `.env.example` to `.env` in the respective environment folder +2. Edit `.env` and set your secrets (ADMIN_SESSION_SECRET, Telegram tokens, etc.) +3. Docker Compose automatically reads `.env` and injects variables into containers +4. Never commit `.env` files (already in `.gitignore`) **Telegram Setup:** See `scripts/README.telegram.md` for complete configuration guide.