Files
MABEA/deploy/README.md
T
patrickandClaude Sonnet 5 446e4f912d
CI / backend-tests (push) Failing after 1s
Deployment-Setup (PostgreSQL+nginx-Installer) + Sprint-0-Fixes aus Subagenten-Reviews
Installer (deploy/):
- install_server.sh: PostgreSQL+nginx auf Debian 13, idempotente Rolle/DB-Anlage,
  pgcrypto-Extension, Speicher-Tuning für 4GB-VPS, Zugangsdaten in chmod-600-Datei
  statt stdout (postgres-expert/owasp-Review)
- nginx-Template mit Security-Headern + Rate-Limit auf /auth/login
- systemd-Unit-Template mit Sandboxing (NoNewPrivileges/ProtectSystem/PrivateTmp)

Backend-Fixes (fastapi-expert-Review):
- get_db: einheitliche commit/rollback-Konvention statt Endpunkt-Copy-Paste
- Test-Fixtures auf SQLAlchemy-2.0-Savepoint-Pattern umgestellt (join_transaction_mode),
  da get_db jetzt selbst committet
- Lifespan-Handler: Startup-Guard gegen JWT-Secret-Platzhalter, engine.dispose() beim Shutdown
- JWT-Payload ohne ungenutztes roles-Claim (Rollen kommen immer frisch aus der DB)

Zusätzlich: Subagenten-Definitionen (~/.claude/agents/) auf lauffähiges Modell fixiert.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L85hmKbvX7Cqkq47KnQhFt
2026-09-03 23:00:46 +02:00

28 lines
1.3 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.
# Deployment MABEA
Zielserver: siehe Projekt-Memory (Debian 13, kein Docker-Zwang, Prompt 19).
## Server-Grundausstattung (einmalig)
```bash
scp -i ~/.ssh/id_claude -r deploy root@<server>:/root/mabea-deploy
ssh -i ~/.ssh/id_claude root@<server>
cd /root/mabea-deploy
chmod +x install_server.sh
DB_PASSWORD='<sicheres-passwort>' APP_DOMAIN=<domain-oder-ip> ./install_server.sh
```
Installiert PostgreSQL + nginx, legt DB-Rolle/Datenbank an, richtet nginx als Reverse-Proxy vor `127.0.0.1:8000` ein. Ausgegebene `DATABASE_URL` sichern.
## Backend deployen (später, nach Sprint-Fortschritt)
1. `backend/` auf den Server kopieren (z. B. nach `/opt/mabea/backend`), `.venv` dort anlegen, `pip install -e ".[dev]"` bzw. ohne `dev`-Extra für Produktion.
2. `.env` aus `backend/example.env` ableiten, `DATABASE_URL` aus Schritt oben eintragen.
3. `alembic upgrade head` ausführen.
4. `mabea-backend.service.template` nach `/etc/systemd/system/mabea-backend.service` kopieren (Pfade/User anpassen), `systemctl daemon-reload && systemctl enable --now mabea-backend`.
## Dateien
- `install_server.sh` Server-Grundausstattung (PostgreSQL, nginx), idempotent
- `nginx_mabea.conf.template` Reverse-Proxy-Vorlage, von `install_server.sh` verwendet
- `mabea-backend.service.template` systemd-Unit-Vorlage für das Backend (noch nicht aktiviert, Pfade anpassen)