Files
aza/AzA march 2026/deploy/PRODUCTION_CONFIG.md
2026-03-30 07:59:11 +02:00

74 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AZA Produktionskonfiguration (aza-medwork.ch)
Alle ENV-Variablen, die fuer einen funktionierenden Live-Betrieb gesetzt sein muessen.
## Pflicht-Variablen
| Variable | Beispiel | Wo setzen |
|---|---|---|
| `OPENAI_API_KEY` | `sk-proj-...` | deploy/.env (Variante B: NUR serverseitig!) |
| `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 Basic: `aza_basic_monthly` CHF 59/Monat, `aza_basic_yearly` CHF 590/Jahr, 1 Benutzer, 2 Geraete
- AZA Team: `aza_team_monthly` CHF 89/Monat, `aza_team_yearly` CHF 890/Jahr, 2 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
```
## Desktop-App Konfiguration (Variante B)
Die Desktop-App braucht KEINEN OpenAI-Key mehr. Alle KI-Anfragen laufen ueber das Backend.
| Variable | Quelle | Hinweis |
|---|---|---|
| `MEDWORK_API_TOKEN` | `_internal/backend_token.txt` | Auth gegen Backend |
| Backend-URL | `MEDWORK_BACKEND_URL` oder `backend_url.txt` | Zeigt auf Hetzner: `https://api.aza-medwork.ch` |
| OpenAI-Key | NICHT MEHR NOETIG | Backend haelt den Key serverseitig (Variante B) |