Files
aza/AzA march 2026 - Kopie/deploy/PRODUCTION_CONFIG.md

73 lines
2.8 KiB
Markdown
Raw Normal View History

2026-03-25 13:42:48 +01:00
# AZA Produktionskonfiguration (aza-medwork.ch)
Alle ENV-Variablen, die fuer einen funktionierenden Live-Betrieb gesetzt sein muessen.
## Pflicht-Variablen
| Variable | Beispiel | Wo setzen |
|---|---|---|
| `MEDWORK_API_TOKENS` | `TOKEN_NEU,TOKEN_ALT` | deploy/.env |
| `STRIPE_SECRET_KEY` | `sk_live_...` | deploy/.env |
| `STRIPE_WEBHOOK_SECRET` | `whsec_...` | deploy/.env |
| `STRIPE_SUCCESS_URL` | `https://aza-medwork.ch/billing/success?session_id={CHECKOUT_SESSION_ID}` | deploy/.env |
| `STRIPE_CANCEL_URL` | `https://aza-medwork.ch/billing/cancel` | deploy/.env |
| `STRIPE_PORTAL_RETURN_URL` | `https://aza-medwork.ch/` | deploy/.env |
| `AZA_DOMAIN` | `aza-medwork.ch` | deploy/.env |
| `ACME_EMAIL` | `info@aza-medwork.ch` | deploy/.env |
## Empfohlen
| Variable | Beispiel | Beschreibung |
|---|---|---|
| `AZA_ADMIN_TOKEN` | Starkes Zufallstoken | Admin-API-Zugang |
| `AZA_LOG_LEVEL` | `INFO` | Log-Detailgrad |
| `AZA_GRACE_DAYS` | `0` | Karenzzeit nach Abo-Ende |
| `AZA_CORS_ORIGINS` | `https://aza-medwork.ch,https://www.aza-medwork.ch` | CORS (Standard ist bereits gesetzt) |
## Stripe Dashboard
Vor Go-Live im Stripe Dashboard anlegen:
1. **Produkte / Preise:**
- AZA Praxis: Lookup-Key `aza_basic_monthly`, CHF 89/Monat, 1 Benutzer, 2 Geraete
- AZA Team: Lookup-Key `aza_team_monthly`, CHF 199/Monat, 3 Benutzer, 2 Geraete
2. **Webhook:**
- URL: `https://aza-medwork.ch/stripe/webhook`
- Events: `checkout.session.completed`, `customer.subscription.updated`, `customer.subscription.deleted`
## Infrastruktur
| Komponente | Konfiguration |
|---|---|
| Reverse Proxy | Caddy (deploy/Caddyfile), automatisches HTTPS |
| Backend | `backend_main:app` via uvicorn (deploy/Dockerfile) |
| Statische Dateien | Caddy liefert `/web/*`, `/release/*`, `/download/*` aus |
| Datenbank | SQLite unter `data/stripe_webhook.sqlite` (Lizenz + Devices) |
| Desktop-Update | `https://aza-medwork.ch/release/version.json` |
| Installer-Download | `https://aza-medwork.ch/download/aza_desktop_setup.exe` |
## Kauf-Flow (End-to-End)
```
Landing-Page (/web/index.html)
→ "Abonnement starten" Button
→ POST /stripe/create_checkout_session {lookup_key: "aza_basic_monthly"}
→ Stripe Checkout (gehostet von Stripe)
→ Webhook: checkout.session.completed → Lizenz in DB
→ Redirect: /billing/success?session_id=...
→ Success-Seite mit Download-Button
→ Installer herunterladen und installieren
→ Desktop-App prueft /license/status beim Start
```
## Nicht in deploy/.env (Desktop-seitig)
Diese Werte sind im Desktop-Installer gebundelt:
| Variable | Quelle |
|---|---|
| `MEDWORK_API_TOKEN` | `_internal/backend_token.txt` |
| Backend-URL | Hardcoded `http://127.0.0.1:8000` (lokal) |
| OpenAI-Key | Vom Nutzer beim ersten Start konfiguriert |