INSIGHT-MVP/docs/ACCESS.md
Thomas Reitz 5412ae137a feat: adapt codebase for IP-based HTTP deployment on 172.20.10.59
Switch from hostname+HTTPS (insight-dev.xinion.lan) to IP+HTTP
(172.20.10.59) for alpha/dev deployment without DNS.

Key changes:
- Cookie secure/sameSite flags environment-conditional (fixes HTTP auth)
- docker-compose.yml: remove HTTPS, update host rules, reduce PG memory
- Traefik: disable TLS, update CORS/CSP for HTTP
- Add Prisma init migration (7 tables) and admin seed script
- Generate package-lock.json for npm ci in Docker builds
- Update all documentation for IP-based access

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:21:45 +01:00

264 lines
8.8 KiB
Markdown

# INSIGHT MVP - Zugangsdaten & Server-Zugriff
> **Dieses Dokument wird laufend aktualisiert und enthaelt alle relevanten
> Zugangsinformationen fuer das Projekt.**
---
## 1. Git Repository
| Parameter | Wert |
|------------------|-----------------------------------------------------|
| Git-Server | Forgejo (self-hosted) |
| URL | `git.xinion.lan` |
| Repository (SSH) | `ssh://git@git.xinion.lan/gitadmin/INSIGHT-MVP.git` |
| Repository (HTTP)| `https://git.xinion.lan/gitadmin/INSIGHT-MVP` |
| Organisation | `gitadmin` |
| Zugriff | SSH Key-basiert |
| CI/CD | Forgejo Actions (GitHub Actions kompatibel) |
| Container Registry | `git.xinion.lan` (Forgejo built-in) |
---
## 2. SSH Keys
Alle Keys liegen im Repository unter `.keys/` (Repo ist nur intern verfuegbar).
### 2.1 Deploy Key (Server-Zugriff)
Fuer den SSH-Zugriff auf den Entwicklungsserver `insight-dev-01`.
| Datei | Beschreibung |
|------------------------------|---------------------------------|
| `.keys/deploy_ed25519` | Private Key (Server-Zugriff) |
| `.keys/deploy_ed25519.pub` | Public Key |
**Public Key:**
```
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMuTpqzLyjqTIDMJ4bwEE4o2JeHH3imL+NeipeuBfiTo insight-deploy@xinion.lan
```
**Hinterlegen auf:** Server `insight-dev-01` in `/home/deploy/.ssh/authorized_keys`
### 2.2 CI/CD Key (Forgejo Actions)
Fuer automatisierte Deployments durch die Forgejo Actions CI/CD-Pipeline.
Die Pipeline nutzt diesen Key, um sich per SSH auf den Server zu verbinden
und Docker-Container zu aktualisieren.
| Datei | Beschreibung |
|------------------------------|---------------------------------|
| `.keys/cicd_ed25519` | Private Key (CI/CD Pipeline) |
| `.keys/cicd_ed25519.pub` | Public Key |
**Public Key:**
```
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINlPo+AvDMTMZC0G49o+kuU98/aC85N90QU3a+FaTjoG insight-cicd@xinion.lan
```
**Hinterlegen auf:**
1. Server `insight-dev-01` in `/home/deploy/.ssh/authorized_keys`
2. Forgejo: Repository Settings > Secrets (als `SSH_DEPLOY_KEY` fuer Actions)
### 2.3 SSH-Verbindung zum Server
```bash
# Verbindung zum Entwicklungsserver:
ssh -i .keys/deploy_ed25519 deploy@172.20.10.59
# Mit SSH-Config (empfohlen):
# Eintrag in ~/.ssh/config:
Host insight-dev
HostName 172.20.10.59
User deploy
IdentityFile ~/git.xinion.lan/INSIGHT-MVP/.keys/deploy_ed25519
StrictHostKeyChecking accept-new
```
### 2.4 Wo welcher Key hinterlegt werden muss
| Key | Server `authorized_keys` | Forgejo Secrets |
|--------------|--------------------------|------------------------|
| deploy | Ja | Nein |
| cicd | Ja | Ja (`SSH_DEPLOY_KEY`) |
---
## 3. Entwicklungsserver (ProxmoxVE VM)
| Parameter | Wert |
|------------------|-----------------------------------------|
| **Hostname** | `insight-dev-01` |
| **OS** | Ubuntu 24.04 LTS |
| **IP** | `172.20.10.59` |
| **SSH-Port** | 22 |
| **SSH-User** | `deploy` |
| **SSH-Key** | `.keys/deploy_ed25519` |
| **Docker** | Docker Engine + Compose Plugin |
| **Projekt-Pfad** | `/home/deploy/insight/` |
### Schnellzugriff nach VM-Setup
```bash
# SSH auf den Server
ssh -i .keys/deploy_ed25519 deploy@172.20.10.59
# Status aller Container pruefen
docker compose ps
# Logs eines Services
docker compose logs -f core
# Neustart aller Services
docker compose restart
# Nur Backend neustarten
docker compose restart core
```
---
## 4. Service-Ports (auf der VM)
> **Alpha/Dev:** Kein HTTPS, kein DNS. Zugriff via `http://172.20.10.59`
| Service | Interner Port | Externer Port | URL |
|-----------------|---------------|---------------|----------------------------------|
| Traefik (HTTP) | 80 | 80 | http://172.20.10.59 |
| Traefik Dashboard | 8080 | - | Nur intern |
| Core-Service | 3000 | - | Via Traefik: /api/v1/* |
| Frontend | 8080 | - | Via Traefik: /* |
| PostgreSQL | 5432 | - | Nur intern (Docker-Netzwerk) |
| PgBouncer | 6432 | - | Nur intern (Docker-Netzwerk) |
| Redis | 6379 | - | Nur intern (Docker-Netzwerk) |
| step-ca | 9000 | - | Nur intern (Docker-Netzwerk) |
### Observability (nur intern, kein oeffentlicher Zugriff)
| Service | Port | Zugriff |
|-----------------|-------|----------------------------------|
| Grafana | 3001 | SSH-Tunnel: `ssh -L 3001:localhost:3001 deploy@172.20.10.59` |
| Prometheus | 9090 | Nur intern |
| Loki | 3100 | Nur intern |
| Tempo | 3200 | Nur intern |
---
## 5. Datenbank-Zugangsdaten
> **Echte Passwoerter stehen in der `.env`-Datei auf dem Server.
> Niemals in Git committen!**
| Parameter | Wert (Platzhalter) |
|-------------------|---------------------------------|
| DB-Host | `pgbouncer` (via Docker-Netzwerk) |
| DB-Port | `6432` |
| Core-DB-Name | `platform_core` |
| Tenant-DB-Schema | `tenant_{slug}` |
| DB-User | Siehe `.env` -> `DB_USER` |
| DB-Passwort | Siehe `.env` -> `DB_PASSWORD` |
---
## 6. Container Registry
| Parameter | Wert |
|------------------|-----------------------------------------------------|
| Registry-URL | `git.xinion.lan` |
| Image-Prefix | `git.xinion.lan/gitadmin/insight-{service}` |
| Authentifizierung| Forgejo Login-Credentials |
### Image-Namen
```
git.xinion.lan/gitadmin/insight-core:latest
git.xinion.lan/gitadmin/insight-core:develop
git.xinion.lan/gitadmin/insight-core:v0.1.0
git.xinion.lan/gitadmin/insight-frontend:latest
```
---
## 7. Deployment-Pfad
```
MacBook (Entwicklung)
|
| git push
v
Forgejo (git.xinion.lan)
|
| Forgejo Actions CI/CD
| - Lint, Type-Check, Tests, Build
| - Docker Image bauen & pushen
v
Server (insight-dev-01)
|
| docker compose pull && docker compose up -d
v
Laufende Anwendung
```
---
## 8. Git-Server (Forgejo)
| Parameter | Wert |
|------------------|-----------------------------------------|
| **Hostname** | `git.xinion.lan` |
| **IP** | `172.20.10.11` |
| **SSH-User** | `sysadmin` |
| **SSH-Port** | 22 |
| **Web-UI** | `https://git.xinion.lan` |
| **Forgejo-User** | `gitadmin` |
---
## 9. Default-Zugangsdaten (Alpha/Dev)
> **WICHTIG:** Diese Zugangsdaten gelten nur fuer die Ersteinrichtung!
> Passwoerter muessen nach dem ersten Login geaendert werden.
| Service | User / E-Mail | Passwort |
|-------------------|------------------------|--------------------|
| Plattform-Admin | `admin@xinion.de` | `ChangeMe123!` |
| Grafana | `admin` | Siehe `.env` |
| Traefik Dashboard | `admin` | Siehe `.env` |
---
## 10. Wichtige Befehle
### Vom MacBook aus
```bash
# Code pushen
git push origin develop
# SSH auf Server
ssh -i .keys/deploy_ed25519 deploy@172.20.10.59
# Plattform oeffnen
open http://172.20.10.59
# Grafana oeffnen (SSH-Tunnel)
ssh -L 3001:localhost:3001 -i .keys/deploy_ed25519 deploy@172.20.10.59
# Dann im Browser: http://localhost:3001
```
### Auf dem Server
```bash
# Alle Services starten
docker compose up -d
# Mit Observability
docker compose -f docker-compose.yml -f docker-compose.observability.yml up -d
# Health-Check
curl http://172.20.10.59/health
# Datenbank-Migration
docker compose run --rm core npx prisma migrate deploy --schema=./prisma/core.schema.prisma
# Admin-User seeden
docker compose run --rm core npx ts-node prisma/seed.ts
# Logs folgen
docker compose logs -f --tail=100
```