377 lines
9.3 KiB
Markdown
377 lines
9.3 KiB
Markdown
# MYP Reservation Platform
|
|
|
|
Mercedes-Benz Werk 040 Berlin - 3D-Drucker Reservierungsplattform
|
|
|
|
## 🚀 Schnellstart
|
|
|
|
### MYP Control Center (Empfohlen)
|
|
|
|
Das zentrale Installationssystem für alle Komponenten:
|
|
|
|
```bash
|
|
# Repository klonen
|
|
git clone <repository-url>
|
|
cd Projektarbeit-MYP
|
|
|
|
# MYP Control Center starten
|
|
./myp_installer.sh
|
|
```
|
|
|
|
Das MYP Control Center bietet:
|
|
- **Schnellstart-Installationen** (Vollständig, Backend-Only, Entwicklung)
|
|
- **Produktions-Installer** (Integration der v3.2 install.sh Funktionalität)
|
|
- **Granulare Installation** (Einzelne Komponenten)
|
|
- **System & Wartung** (Tests, Status, Informationen)
|
|
|
|
### Direkter Produktions-Installer
|
|
|
|
Für schnelle Produktions-Deployments direkt im MYP Control Center → Option 4:
|
|
|
|
```bash
|
|
./myp_installer.sh
|
|
# → Wähle Option 4: Produktions-Installer
|
|
# → Backend installieren (Raspberry Pi)
|
|
# → Frontend installieren (Docker)
|
|
```
|
|
|
|
### Voraussetzungen
|
|
|
|
- **Backend (Raspberry Pi)**: Python 3.11, systemd
|
|
- **Frontend (m040tbaraspi001)**: Docker, Docker Compose
|
|
|
|
## 🌐 Zugriff
|
|
|
|
- **Frontend**: https://m040tbaraspi001.de040.corpintra.net
|
|
- **Backend API**: https://raspberrypi/api
|
|
|
|
## 🔧 Konfiguration
|
|
|
|
### Netzwerk
|
|
|
|
| Komponente | Hostname | IP | Port |
|
|
|------------|----------|----|----- |
|
|
| Frontend | m040tbaraspi001.de040.corpintra.net | 192.168.0.109 | 443 |
|
|
| Backend | raspberrypi | 192.168.0.105 | 443 |
|
|
|
|
### TLS-Zertifikate
|
|
|
|
Selbstsignierte Zertifikate werden automatisch generiert:
|
|
- Backend: `backend/app/certs/`
|
|
- Frontend: `frontend/certs/`
|
|
|
|
## 📊 Health Checks
|
|
|
|
```bash
|
|
# Backend
|
|
curl -k https://raspberrypi/api/test
|
|
|
|
# Frontend
|
|
curl -k https://m040tbaraspi001.de040.corpintra.net/health
|
|
```
|
|
|
|
## 🛠️ Entwicklung
|
|
|
|
### MYP Control Center (Entwicklungs-Setup)
|
|
```bash
|
|
./myp_installer.sh
|
|
# → Option 3: Entwicklungs-Setup
|
|
```
|
|
|
|
### MYP Kiosk-Modus (Produktions-bereit)
|
|
|
|
Das Backend bietet parallel zur API auch ein **vollständiges Web-Interface** für Kiosk-Betrieb:
|
|
|
|
```bash
|
|
./myp_installer.sh
|
|
# → Option 2: Backend-Only Installation (mit Kiosk Web Interface)
|
|
# oder
|
|
# → Option 5: Granulare Installation → Kiosk-Modus installieren
|
|
```
|
|
|
|
**Kiosk-Features:**
|
|
- ✅ **Web-Interface parallel zur API** - Kein separates Frontend nötig
|
|
- ✅ **Touch-optimierte Bedienung** - Ideal für Raspberry Pi Touchscreens
|
|
- ✅ **Automatischer Browser-Start** - Vollbild-Modus beim Boot
|
|
- ✅ **systemd Integration** - Service-basierte Kiosk-Verwaltung
|
|
- ✅ **Produktions-bereit** - SSL, Logging, Monitoring
|
|
|
|
**Kiosk URLs:**
|
|
- Hauptinterface: `https://raspberrypi/`
|
|
- Dashboard: `https://raspberrypi/dashboard`
|
|
- Drucker-Verwaltung: `https://raspberrypi/printers`
|
|
- Job-Verwaltung: `https://raspberrypi/jobs`
|
|
- Admin-Panel: `https://raspberrypi/admin`
|
|
|
|
### Manuelle Installation
|
|
|
|
#### Backend Debug-Modus
|
|
```bash
|
|
cd backend/app
|
|
python3.11 app.py --debug
|
|
```
|
|
|
|
#### Frontend Development
|
|
```bash
|
|
cd frontend
|
|
npm run dev
|
|
```
|
|
|
|
#### Kiosk-Modus manuell starten
|
|
```bash
|
|
# Backend starten
|
|
cd backend/app && python app.py
|
|
|
|
# Kiosk-Browser starten (separates Terminal)
|
|
./backend/app/start_kiosk.sh
|
|
```
|
|
|
|
## 📁 Projektstruktur
|
|
|
|
```
|
|
Projektarbeit-MYP/
|
|
├── myp_installer.sh # 🎯 HAUPT-INSTALLER (Control Center)
|
|
├── backend/
|
|
│ ├── app/
|
|
│ │ ├── certs/ # TLS-Zertifikate
|
|
│ │ ├── database/ # SQLite-Datenbank
|
|
│ │ ├── logs/ # Anwendungslogs
|
|
│ │ └── app.py # Hauptanwendung
|
|
│ ├── myp.service # systemd Service
|
|
│ ├── requirements.txt # Python-Abhängigkeiten
|
|
│ └── legacy_setup_raspberry_pi.sh # Legacy Skript
|
|
├── frontend/
|
|
│ ├── certs/ # TLS-Zertifikate
|
|
│ ├── docker/
|
|
│ │ ├── caddy/
|
|
│ │ │ └── Caddyfile # Reverse Proxy Konfiguration
|
|
│ │ └── legacy_deploy.sh # Legacy Skript
|
|
│ ├── src/ # Next.js Anwendung
|
|
│ └── docker-compose.yml
|
|
├── scripts/
|
|
│ └── legacy_generate_certs.sh # Legacy Skript
|
|
├── archiv/
|
|
│ └── myp_installer_legacy.sh # Archivierte Version
|
|
└── docs/ # Dokumentation
|
|
```
|
|
|
|
### Script-Status
|
|
|
|
| Skript | Status | Verwendung |
|
|
|--------|--------|------------|
|
|
| `myp_installer.sh` | ✅ **AKTIV** | Haupt-Control-Center |
|
|
| `*legacy_*.sh` | 📦 Legacy | Historische Versionen |
|
|
| `archiv/myp_installer_legacy.sh` | 📦 Archiv | Alte Version 4.0 |
|
|
|
|
## 🔒 Sicherheit
|
|
|
|
- HTTPS-only (Port 443)
|
|
- Selbstsignierte TLS-Zertifikate
|
|
- HTTP → HTTPS Redirect
|
|
- Security Headers (HSTS, CSP, etc.)
|
|
|
|
## 📝 Logs
|
|
|
|
### Backend
|
|
```bash
|
|
# systemd Journal
|
|
sudo journalctl -u myp.service -f
|
|
|
|
# Anwendungslogs
|
|
tail -f backend/app/logs/app/app.log
|
|
```
|
|
|
|
### Frontend
|
|
```bash
|
|
# Docker Logs
|
|
docker-compose logs -f
|
|
|
|
# Caddy Logs
|
|
docker-compose logs caddy
|
|
```
|
|
|
|
### Kiosk-Modus
|
|
```bash
|
|
# Backend Service
|
|
sudo systemctl status myp.service
|
|
|
|
# Kiosk-Browser Service
|
|
sudo systemctl status myp-kiosk-browser.service
|
|
|
|
# Kiosk-Browser Logs
|
|
sudo journalctl -u myp-kiosk-browser.service -f
|
|
```
|
|
|
|
## 🔧 Services
|
|
|
|
### Backend Services
|
|
```bash
|
|
# Backend starten/stoppen
|
|
sudo systemctl start myp.service
|
|
sudo systemctl stop myp.service
|
|
sudo systemctl restart myp.service
|
|
|
|
# Kiosk-Browser starten/stoppen (falls installiert)
|
|
sudo systemctl start myp-kiosk-browser.service
|
|
sudo systemctl stop myp-kiosk-browser.service
|
|
|
|
# Automatischen Start aktivieren/deaktivieren
|
|
sudo systemctl enable myp.service
|
|
sudo systemctl enable myp-kiosk-browser.service
|
|
```
|
|
|
|
## 🆘 Troubleshooting
|
|
|
|
### MYP Control Center verwenden
|
|
```bash
|
|
./myp_installer.sh
|
|
# → Option 6: Systemvoraussetzungen prüfen
|
|
# → Option 7: Anwendung starten
|
|
```
|
|
|
|
### Backend startet nicht
|
|
```bash
|
|
# Service Status prüfen
|
|
sudo systemctl status myp.service
|
|
|
|
# Logs prüfen
|
|
sudo journalctl -u myp.service --no-pager
|
|
|
|
# Zertifikate prüfen
|
|
ls -la backend/app/certs/
|
|
```
|
|
|
|
### Frontend nicht erreichbar
|
|
```bash
|
|
# Container Status prüfen
|
|
docker-compose ps
|
|
|
|
# Netzwerk prüfen
|
|
docker network ls
|
|
|
|
# Zertifikate prüfen
|
|
ls -la frontend/certs/
|
|
```
|
|
|
|
### Verbindungsprobleme
|
|
```bash
|
|
# DNS auflösen
|
|
nslookup raspberrypi
|
|
nslookup m040tbaraspi001.de040.corpintra.net
|
|
|
|
# Ports prüfen
|
|
netstat -tlnp | grep :443
|
|
```
|
|
|
|
## 📋 Version
|
|
|
|
- **Version**: 3.2-final
|
|
- **Control Center**: v4.0 mit v3.2 Integration
|
|
- **Build**: Production
|
|
- **Installer**: MYP Control Center
|
|
|
|
## 👥 Support
|
|
|
|
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
|
|
```
|
|
|