README: Zwei-Server-Setup Dokumentation - Frontend (m040tbaraspi001) + Backend (Raspberry Pi) Architektur

This commit is contained in:
Till Tomczak 2025-05-26 22:38:46 +02:00
parent 966a3fb22d
commit 3867540cf4

View File

@ -273,3 +273,104 @@ netstat -tlnp | grep :443
Bei Problemen verwenden Sie das MYP Control Center oder wenden Sie sich an das IT-Team des Mercedes-Benz Werk 040 Berlin.
## 🖥️ Zwei-Server-Setup (Produktions-Architektur)
Das MYP-System ist für eine **Zwei-Server-Architektur** optimiert:
### Server-Architektur
| Server | Hostname | Komponenten | URL |
|--------|----------|-------------|-----|
| **Frontend-Server** | `m040tbaraspi001.de040.corpintra.net` | Next.js + Docker + Caddy | `https://m040tbaraspi001.de040.corpintra.net` |
| **Backend-Server** | `raspberrypi` | Flask API + Web Interface + Kiosk | `https://raspberrypi` |
### 🚀 Server-spezifische Installation (Empfohlen)
Der `myp_installer.sh` erkennt automatisch den Server-Typ und bietet passende Installationsoptionen:
```bash
./myp_installer.sh
# Wählen Sie: "1. Server-spezifische Installation (Empfohlen)"
```
#### Frontend-Server (m040tbaraspi001)
```bash
# Automatische Erkennung: m040tbaraspi001.de040.corpintra.net
# Verfügbare Optionen:
# 1. Frontend installieren (Next.js + Docker)
# 2. Frontend Produktions-Deployment (Port 443 mit SSL)
# 3. Nur Docker & Dependencies installieren
```
#### Backend-Server (Raspberry Pi)
```bash
# Automatische Erkennung: raspberrypi
# Verfügbare Optionen:
# 1. Backend installieren (Flask API + Web Interface)
# 2. Kiosk-Modus installieren (Touch-Interface)
# 3. Produktions-Setup (Backend + Kiosk + Services)
# 4. Nur Python & Dependencies installieren
```
### 🔧 Manuelle Installation
#### Frontend-Server Setup
```bash
# Auf m040tbaraspi001.de040.corpintra.net
cd frontend/
npm install
docker-compose up -d
```
#### Backend-Server Setup
```bash
# Auf raspberrypi
cd backend/app/
python3.11 -m pip install -r requirements.txt
sudo systemctl start myp.service
sudo systemctl start myp-kiosk-browser.service # Optional: Kiosk-Modus
```
### 🌐 URLs & Zugriff
#### Frontend (m040tbaraspi001)
- **Haupt-URL**: `https://m040tbaraspi001.de040.corpintra.net`
- **Entwicklung**: `http://localhost:3000` (npm run dev)
- **Produktion**: `https://localhost:443` (Docker)
#### Backend (Raspberry Pi)
- **API**: `https://raspberrypi/api`
- **Web Interface**: `https://raspberrypi`
- **Kiosk-Modus**: `https://raspberrypi` (Vollbild-Touch-Interface)
### 🔗 Server-Kommunikation
Die Server kommunizieren über HTTPS:
- **Frontend → Backend**: `https://raspberrypi/api`
- **OAuth Callbacks**: `https://m040tbaraspi001.de040.corpintra.net/auth/login/callback`
- **Cross-Origin**: Automatisch konfiguriert für beide Domains
### 🛠️ Konfiguration
#### Frontend (.env.local)
```bash
# Backend-Verbindung
NEXT_PUBLIC_API_URL=https://raspberrypi
NEXT_PUBLIC_BACKEND_HOST=raspberrypi
# Frontend-URLs
NEXT_PUBLIC_FRONTEND_URL=https://m040tbaraspi001.de040.corpintra.net
NEXTAUTH_URL=https://m040tbaraspi001.de040.corpintra.net
```
#### Backend (config/settings.py)
```python
# Frontend-Verbindung
FRONTEND_URL = "https://m040tbaraspi001.de040.corpintra.net"
CORS_ORIGINS = ["https://m040tbaraspi001.de040.corpintra.net"]
# Kiosk-Konfiguration
KIOSK_MODE = True
KIOSK_AUTO_LOGIN = True
```