MYP Control Center Integration: install.sh integriert, legacy Skripte markiert, README aktualisiert
This commit is contained in:
parent
f719f74195
commit
1b829b2ed2
1756
archiv/myp_installer_legacy.sh
Normal file
1756
archiv/myp_installer_legacy.sh
Normal file
File diff suppressed because it is too large
Load Diff
132
docs/README.md
132
docs/README.md
@ -4,50 +4,41 @@ Mercedes-Benz Werk 040 Berlin - 3D-Drucker Reservierungsplattform
|
|||||||
|
|
||||||
## 🚀 Schnellstart
|
## 🚀 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
|
### Voraussetzungen
|
||||||
|
|
||||||
- **Backend (Raspberry Pi)**: Python 3.11, systemd
|
- **Backend (Raspberry Pi)**: Python 3.11, systemd
|
||||||
- **Frontend (m040tbaraspi001)**: Docker, Docker Compose
|
- **Frontend (m040tbaraspi001)**: Docker, Docker Compose
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
#### Backend Installation (Raspberry Pi)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Repository klonen
|
|
||||||
git clone <repository-url>
|
|
||||||
cd Projektarbeit-MYP
|
|
||||||
|
|
||||||
# Backend installieren
|
|
||||||
./install.sh backend
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Frontend Installation (m040tbaraspi001)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Repository klonen
|
|
||||||
git clone <repository-url>
|
|
||||||
cd Projektarbeit-MYP
|
|
||||||
|
|
||||||
# Frontend installieren
|
|
||||||
./install.sh frontend
|
|
||||||
```
|
|
||||||
|
|
||||||
### Services starten
|
|
||||||
|
|
||||||
#### Backend
|
|
||||||
```bash
|
|
||||||
sudo systemctl start myp.service
|
|
||||||
sudo systemctl status myp.service
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Frontend
|
|
||||||
```bash
|
|
||||||
cd frontend
|
|
||||||
docker-compose up -d
|
|
||||||
docker-compose logs -f
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🌐 Zugriff
|
## 🌐 Zugriff
|
||||||
|
|
||||||
- **Frontend**: https://m040tbaraspi001.de040.corpintra.net
|
- **Frontend**: https://m040tbaraspi001.de040.corpintra.net
|
||||||
@ -80,13 +71,21 @@ curl -k https://m040tbaraspi001.de040.corpintra.net/health
|
|||||||
|
|
||||||
## 🛠️ Entwicklung
|
## 🛠️ Entwicklung
|
||||||
|
|
||||||
### Backend Debug-Modus
|
### MYP Control Center (Entwicklungs-Setup)
|
||||||
|
```bash
|
||||||
|
./myp_installer.sh
|
||||||
|
# → Option 3: Entwicklungs-Setup
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manuelle Installation
|
||||||
|
|
||||||
|
#### Backend Debug-Modus
|
||||||
```bash
|
```bash
|
||||||
cd backend/app
|
cd backend/app
|
||||||
python3.11 app.py --debug
|
python3.11 app.py --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
### Frontend Development
|
#### Frontend Development
|
||||||
```bash
|
```bash
|
||||||
cd frontend
|
cd frontend
|
||||||
npm run dev
|
npm run dev
|
||||||
@ -96,26 +95,39 @@ npm run dev
|
|||||||
|
|
||||||
```
|
```
|
||||||
Projektarbeit-MYP/
|
Projektarbeit-MYP/
|
||||||
|
├── myp_installer.sh # 🎯 HAUPT-INSTALLER (Control Center)
|
||||||
├── backend/
|
├── backend/
|
||||||
│ ├── app/
|
│ ├── app/
|
||||||
│ │ ├── certs/ # TLS-Zertifikate
|
│ │ ├── certs/ # TLS-Zertifikate
|
||||||
│ │ ├── database/ # SQLite-Datenbank
|
│ │ ├── database/ # SQLite-Datenbank
|
||||||
│ │ ├── logs/ # Anwendungslogs
|
│ │ ├── logs/ # Anwendungslogs
|
||||||
│ │ └── app.py # Hauptanwendung
|
│ │ └── app.py # Hauptanwendung
|
||||||
│ ├── myp.service # systemd Service
|
│ ├── myp.service # systemd Service
|
||||||
│ └── requirements.txt # Python-Abhängigkeiten
|
│ ├── requirements.txt # Python-Abhängigkeiten
|
||||||
|
│ └── legacy_setup_raspberry_pi.sh # Legacy Skript
|
||||||
├── frontend/
|
├── frontend/
|
||||||
│ ├── certs/ # TLS-Zertifikate
|
│ ├── certs/ # TLS-Zertifikate
|
||||||
│ ├── docker/
|
│ ├── docker/
|
||||||
│ │ └── caddy/
|
│ │ ├── caddy/
|
||||||
│ │ └── Caddyfile # Reverse Proxy Konfiguration
|
│ │ │ └── Caddyfile # Reverse Proxy Konfiguration
|
||||||
│ ├── src/ # Next.js Anwendung
|
│ │ └── legacy_deploy.sh # Legacy Skript
|
||||||
|
│ ├── src/ # Next.js Anwendung
|
||||||
│ └── docker-compose.yml
|
│ └── docker-compose.yml
|
||||||
├── docs/ # Dokumentation
|
├── scripts/
|
||||||
├── scripts/ # Hilfsskripte
|
│ └── legacy_generate_certs.sh # Legacy Skript
|
||||||
└── install.sh # Zentraler Installer
|
├── 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
|
## 🔒 Sicherheit
|
||||||
|
|
||||||
- HTTPS-only (Port 443)
|
- HTTPS-only (Port 443)
|
||||||
@ -145,6 +157,13 @@ docker-compose logs caddy
|
|||||||
|
|
||||||
## 🆘 Troubleshooting
|
## 🆘 Troubleshooting
|
||||||
|
|
||||||
|
### MYP Control Center verwenden
|
||||||
|
```bash
|
||||||
|
./myp_installer.sh
|
||||||
|
# → Option 6: Systemvoraussetzungen prüfen
|
||||||
|
# → Option 7: Anwendung starten
|
||||||
|
```
|
||||||
|
|
||||||
### Backend startet nicht
|
### Backend startet nicht
|
||||||
```bash
|
```bash
|
||||||
# Service Status prüfen
|
# Service Status prüfen
|
||||||
@ -182,10 +201,11 @@ netstat -tlnp | grep :443
|
|||||||
## 📋 Version
|
## 📋 Version
|
||||||
|
|
||||||
- **Version**: 3.2-final
|
- **Version**: 3.2-final
|
||||||
|
- **Control Center**: v4.0 mit v3.2 Integration
|
||||||
- **Build**: Production
|
- **Build**: Production
|
||||||
- **Datum**: $(date)
|
- **Installer**: MYP Control Center
|
||||||
|
|
||||||
## 👥 Support
|
## 👥 Support
|
||||||
|
|
||||||
Bei Problemen wenden Sie sich an das IT-Team des Mercedes-Benz Werk 040 Berlin.
|
Bei Problemen verwenden Sie das MYP Control Center oder wenden Sie sich an das IT-Team des Mercedes-Benz Werk 040 Berlin.
|
||||||
|
|
||||||
|
218
install.sh
218
install.sh
@ -1,218 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# MYP Reservation Platform - Zentraler Installer
|
|
||||||
# Unterstützt Backend und Frontend Installation
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
PROJECT_ROOT="$SCRIPT_DIR"
|
|
||||||
|
|
||||||
# Farben für Output
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
YELLOW='\033[1;33m'
|
|
||||||
BLUE='\033[0;34m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
# Logging
|
|
||||||
log_info() {
|
|
||||||
echo -e "${BLUE}[INFO]${NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
log_success() {
|
|
||||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
log_warning() {
|
|
||||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
log_error() {
|
|
||||||
echo -e "${RED}[ERROR]${NC} $1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Hilfsfunktionen
|
|
||||||
check_root() {
|
|
||||||
if [[ $EUID -eq 0 ]]; then
|
|
||||||
log_error "Dieses Skript sollte nicht als root ausgeführt werden!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_dependencies() {
|
|
||||||
local deps=("python3.11" "curl" "openssl")
|
|
||||||
|
|
||||||
for dep in "${deps[@]}"; do
|
|
||||||
if ! command -v "$dep" &> /dev/null; then
|
|
||||||
log_error "Abhängigkeit '$dep' nicht gefunden!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
install_backend() {
|
|
||||||
log_info "=== Backend Installation ==="
|
|
||||||
|
|
||||||
cd "$PROJECT_ROOT/backend"
|
|
||||||
|
|
||||||
# Python Virtual Environment erstellen
|
|
||||||
log_info "Erstelle Python Virtual Environment..."
|
|
||||||
python3.11 -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
# Requirements installieren
|
|
||||||
log_info "Installiere Python-Abhängigkeiten..."
|
|
||||||
pip install --upgrade pip
|
|
||||||
pip install -r requirements.txt
|
|
||||||
|
|
||||||
# Zertifikate kopieren
|
|
||||||
log_info "Kopiere TLS-Zertifikate..."
|
|
||||||
mkdir -p app/certs
|
|
||||||
cp "$PROJECT_ROOT/backend/app/certs/backend.crt" app/certs/
|
|
||||||
cp "$PROJECT_ROOT/backend/app/certs/backend.key" app/certs/
|
|
||||||
chmod 600 app/certs/backend.key
|
|
||||||
chmod 644 app/certs/backend.crt
|
|
||||||
|
|
||||||
# Systemd Service installieren
|
|
||||||
log_info "Installiere systemd Service..."
|
|
||||||
sudo cp myp.service /etc/systemd/system/
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable myp.service
|
|
||||||
|
|
||||||
# Datenbank initialisieren
|
|
||||||
log_info "Initialisiere Datenbank..."
|
|
||||||
cd app
|
|
||||||
python3.11 init_db.py
|
|
||||||
|
|
||||||
log_success "Backend Installation abgeschlossen!"
|
|
||||||
log_info "Service starten mit: sudo systemctl start myp.service"
|
|
||||||
}
|
|
||||||
|
|
||||||
install_frontend() {
|
|
||||||
log_info "=== Frontend Installation ==="
|
|
||||||
|
|
||||||
cd "$PROJECT_ROOT/frontend"
|
|
||||||
|
|
||||||
# Docker prüfen
|
|
||||||
if ! command -v docker &> /dev/null; then
|
|
||||||
log_error "Docker ist nicht installiert!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v docker-compose &> /dev/null; then
|
|
||||||
log_error "Docker Compose ist nicht installiert!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Zertifikate kopieren
|
|
||||||
log_info "Kopiere TLS-Zertifikate..."
|
|
||||||
mkdir -p certs
|
|
||||||
cp "$PROJECT_ROOT/frontend/certs/frontend.crt" certs/
|
|
||||||
cp "$PROJECT_ROOT/frontend/certs/frontend.key" certs/
|
|
||||||
chmod 600 certs/frontend.key
|
|
||||||
chmod 644 certs/frontend.crt
|
|
||||||
|
|
||||||
# Caddyfile Symlink erstellen
|
|
||||||
log_info "Erstelle Caddyfile Symlink..."
|
|
||||||
mkdir -p docker/caddy
|
|
||||||
if [[ ! -L docker/caddy/Caddyfile ]]; then
|
|
||||||
ln -sf "$PROJECT_ROOT/frontend/docker/caddy/Caddyfile" docker/caddy/Caddyfile
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Docker Images bauen
|
|
||||||
log_info "Baue Docker Images..."
|
|
||||||
docker-compose build
|
|
||||||
|
|
||||||
# Services starten
|
|
||||||
log_info "Starte Frontend Services..."
|
|
||||||
docker-compose up -d
|
|
||||||
|
|
||||||
log_success "Frontend Installation abgeschlossen!"
|
|
||||||
log_info "Frontend verfügbar unter: https://m040tbaraspi001.de040.corpintra.net"
|
|
||||||
}
|
|
||||||
|
|
||||||
health_check_backend() {
|
|
||||||
log_info "=== Backend Health Check ==="
|
|
||||||
|
|
||||||
local max_attempts=30
|
|
||||||
local attempt=1
|
|
||||||
|
|
||||||
while [[ $attempt -le $max_attempts ]]; do
|
|
||||||
log_info "Versuche Backend-Verbindung (Versuch $attempt/$max_attempts)..."
|
|
||||||
|
|
||||||
if curl -k -s --max-time 5 https://raspberrypi/api/test > /dev/null 2>&1; then
|
|
||||||
log_success "Backend ist erreichbar!"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 2
|
|
||||||
((attempt++))
|
|
||||||
done
|
|
||||||
|
|
||||||
log_error "Backend Health Check fehlgeschlagen!"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
health_check_frontend() {
|
|
||||||
log_info "=== Frontend Health Check ==="
|
|
||||||
|
|
||||||
local max_attempts=30
|
|
||||||
local attempt=1
|
|
||||||
|
|
||||||
while [[ $attempt -le $max_attempts ]]; do
|
|
||||||
log_info "Versuche Frontend-Verbindung (Versuch $attempt/$max_attempts)..."
|
|
||||||
|
|
||||||
if curl -k -s --max-time 5 https://m040tbaraspi001.de040.corpintra.net/ > /dev/null 2>&1; then
|
|
||||||
log_success "Frontend ist erreichbar!"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 2
|
|
||||||
((attempt++))
|
|
||||||
done
|
|
||||||
|
|
||||||
log_error "Frontend Health Check fehlgeschlagen!"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
show_usage() {
|
|
||||||
echo "Usage: $0 [backend|frontend]"
|
|
||||||
echo ""
|
|
||||||
echo "Optionen:"
|
|
||||||
echo " backend - Installiert das Backend (Python/Flask)"
|
|
||||||
echo " frontend - Installiert das Frontend (Docker/Next.js)"
|
|
||||||
echo ""
|
|
||||||
echo "Beispiele:"
|
|
||||||
echo " $0 backend # Backend installieren"
|
|
||||||
echo " $0 frontend # Frontend installieren"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Main
|
|
||||||
main() {
|
|
||||||
log_info "MYP Reservation Platform - Installer v3.2"
|
|
||||||
log_info "Projektpfad: $PROJECT_ROOT"
|
|
||||||
|
|
||||||
check_root
|
|
||||||
check_dependencies
|
|
||||||
|
|
||||||
case "${1:-}" in
|
|
||||||
"backend")
|
|
||||||
install_backend
|
|
||||||
health_check_backend
|
|
||||||
;;
|
|
||||||
"frontend")
|
|
||||||
install_frontend
|
|
||||||
health_check_frontend
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
show_usage
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
log_success "Installation erfolgreich abgeschlossen!"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Skript ausführen
|
|
||||||
main "$@"
|
|
280
myp_installer.sh
280
myp_installer.sh
@ -81,6 +81,260 @@ get_local_ip() {
|
|||||||
echo "$ip"
|
echo "$ip"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# PRODUKTIONS-INSTALLER (Integration from install.sh)
|
||||||
|
# ========================================================
|
||||||
|
|
||||||
|
# Produktions-Log-Funktionen
|
||||||
|
prod_log_info() {
|
||||||
|
echo -e "${BLUE}[INFO]${NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
prod_log_success() {
|
||||||
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
prod_log_warning() {
|
||||||
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
prod_log_error() {
|
||||||
|
echo -e "${RED}[ERROR]${NC} $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prüfung für Produktions-Abhängigkeiten
|
||||||
|
check_production_dependencies() {
|
||||||
|
local deps=("python3.11" "curl" "openssl")
|
||||||
|
|
||||||
|
for dep in "${deps[@]}"; do
|
||||||
|
if ! command -v "$dep" &> /dev/null; then
|
||||||
|
prod_log_error "Abhängigkeit '$dep' nicht gefunden!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Produktions-Backend Installation
|
||||||
|
install_production_backend() {
|
||||||
|
prod_log_info "=== Produktions-Backend Installation ==="
|
||||||
|
|
||||||
|
cd "$PROJECT_DIR/backend"
|
||||||
|
|
||||||
|
# Python Virtual Environment erstellen
|
||||||
|
prod_log_info "Erstelle Python Virtual Environment..."
|
||||||
|
python3.11 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
|
|
||||||
|
# Requirements installieren
|
||||||
|
prod_log_info "Installiere Python-Abhängigkeiten..."
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Zertifikate kopieren
|
||||||
|
prod_log_info "Kopiere TLS-Zertifikate..."
|
||||||
|
mkdir -p app/certs
|
||||||
|
cp "$PROJECT_DIR/backend/app/certs/backend.crt" app/certs/
|
||||||
|
cp "$PROJECT_DIR/backend/app/certs/backend.key" app/certs/
|
||||||
|
chmod 600 app/certs/backend.key
|
||||||
|
chmod 644 app/certs/backend.crt
|
||||||
|
|
||||||
|
# Systemd Service installieren
|
||||||
|
if [ $is_root -eq 1 ]; then
|
||||||
|
prod_log_info "Installiere systemd Service..."
|
||||||
|
cp myp.service /etc/systemd/system/
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable myp.service
|
||||||
|
else
|
||||||
|
prod_log_warning "systemd Service-Installation übersprungen (keine Root-Rechte)"
|
||||||
|
prod_log_info "Manuell ausführen: sudo cp backend/myp.service /etc/systemd/system/ && sudo systemctl daemon-reload && sudo systemctl enable myp.service"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Datenbank initialisieren
|
||||||
|
prod_log_info "Initialisiere Datenbank..."
|
||||||
|
cd app
|
||||||
|
python3.11 init_db.py
|
||||||
|
|
||||||
|
prod_log_success "Produktions-Backend Installation abgeschlossen!"
|
||||||
|
if [ $is_root -eq 1 ]; then
|
||||||
|
prod_log_info "Service starten mit: sudo systemctl start myp.service"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Produktions-Frontend Installation
|
||||||
|
install_production_frontend() {
|
||||||
|
prod_log_info "=== Produktions-Frontend Installation ==="
|
||||||
|
|
||||||
|
cd "$PROJECT_DIR/frontend"
|
||||||
|
|
||||||
|
# Docker prüfen
|
||||||
|
if ! command -v docker &> /dev/null; then
|
||||||
|
prod_log_error "Docker ist nicht installiert!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v docker-compose &> /dev/null; then
|
||||||
|
prod_log_error "Docker Compose ist nicht installiert!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Zertifikate kopieren
|
||||||
|
prod_log_info "Kopiere TLS-Zertifikate..."
|
||||||
|
mkdir -p certs
|
||||||
|
cp "$PROJECT_DIR/frontend/certs/frontend.crt" certs/
|
||||||
|
cp "$PROJECT_DIR/frontend/certs/frontend.key" certs/
|
||||||
|
chmod 600 certs/frontend.key
|
||||||
|
chmod 644 certs/frontend.crt
|
||||||
|
|
||||||
|
# Caddyfile Symlink erstellen
|
||||||
|
prod_log_info "Erstelle Caddyfile Symlink..."
|
||||||
|
mkdir -p docker/caddy
|
||||||
|
if [[ ! -L docker/caddy/Caddyfile ]]; then
|
||||||
|
ln -sf "$PROJECT_DIR/frontend/docker/caddy/Caddyfile" docker/caddy/Caddyfile
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Docker Images bauen
|
||||||
|
prod_log_info "Baue Docker Images..."
|
||||||
|
docker-compose build
|
||||||
|
|
||||||
|
# Services starten
|
||||||
|
prod_log_info "Starte Frontend Services..."
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
prod_log_success "Produktions-Frontend Installation abgeschlossen!"
|
||||||
|
prod_log_info "Frontend verfügbar unter: https://m040tbaraspi001.de040.corpintra.net"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Backend Health Check
|
||||||
|
production_health_check_backend() {
|
||||||
|
prod_log_info "=== Backend Health Check ==="
|
||||||
|
|
||||||
|
local max_attempts=30
|
||||||
|
local attempt=1
|
||||||
|
|
||||||
|
while [[ $attempt -le $max_attempts ]]; do
|
||||||
|
prod_log_info "Versuche Backend-Verbindung (Versuch $attempt/$max_attempts)..."
|
||||||
|
|
||||||
|
if curl -k -s --max-time 5 https://raspberrypi/api/test > /dev/null 2>&1; then
|
||||||
|
prod_log_success "Backend ist erreichbar!"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
((attempt++))
|
||||||
|
done
|
||||||
|
|
||||||
|
prod_log_error "Backend Health Check fehlgeschlagen!"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Frontend Health Check
|
||||||
|
production_health_check_frontend() {
|
||||||
|
prod_log_info "=== Frontend Health Check ==="
|
||||||
|
|
||||||
|
local max_attempts=30
|
||||||
|
local attempt=1
|
||||||
|
|
||||||
|
while [[ $attempt -le $max_attempts ]]; do
|
||||||
|
prod_log_info "Versuche Frontend-Verbindung (Versuch $attempt/$max_attempts)..."
|
||||||
|
|
||||||
|
if curl -k -s --max-time 5 https://m040tbaraspi001.de040.corpintra.net/ > /dev/null 2>&1; then
|
||||||
|
prod_log_success "Frontend ist erreichbar!"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
((attempt++))
|
||||||
|
done
|
||||||
|
|
||||||
|
prod_log_error "Frontend Health Check fehlgeschlagen!"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Produktions-Installer Menü
|
||||||
|
show_production_installer_menu() {
|
||||||
|
show_header "🚀 Produktions-Installer (v3.2 Integration)"
|
||||||
|
|
||||||
|
echo -e "${WHITE}Schnelle Produktions-Installation (von install.sh)${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${WHITE}1. Backend installieren (Raspberry Pi)${NC}"
|
||||||
|
echo -e "${WHITE}2. Frontend installieren (Docker)${NC}"
|
||||||
|
echo -e "${WHITE}3. Backend + Health Check${NC}"
|
||||||
|
echo -e "${WHITE}4. Frontend + Health Check${NC}"
|
||||||
|
echo -e "${WHITE}5. Beide Komponenten + Health Check${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${WHITE}9. Zurück zum Hauptmenü${NC}"
|
||||||
|
echo -e "${WHITE}0. Beenden${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
read -p "Wählen Sie eine Option (0-5, 9): " choice
|
||||||
|
|
||||||
|
case $choice in
|
||||||
|
1)
|
||||||
|
if check_production_dependencies; then
|
||||||
|
install_production_backend
|
||||||
|
else
|
||||||
|
prod_log_error "Abhängigkeiten fehlen!"
|
||||||
|
fi
|
||||||
|
show_production_installer_menu
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
if check_production_dependencies; then
|
||||||
|
install_production_frontend
|
||||||
|
else
|
||||||
|
prod_log_error "Abhängigkeiten fehlen!"
|
||||||
|
fi
|
||||||
|
show_production_installer_menu
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
if check_production_dependencies; then
|
||||||
|
install_production_backend
|
||||||
|
production_health_check_backend
|
||||||
|
else
|
||||||
|
prod_log_error "Abhängigkeiten fehlen!"
|
||||||
|
fi
|
||||||
|
show_production_installer_menu
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
if check_production_dependencies; then
|
||||||
|
install_production_frontend
|
||||||
|
production_health_check_frontend
|
||||||
|
else
|
||||||
|
prod_log_error "Abhängigkeiten fehlen!"
|
||||||
|
fi
|
||||||
|
show_production_installer_menu
|
||||||
|
;;
|
||||||
|
5)
|
||||||
|
if check_production_dependencies; then
|
||||||
|
install_production_backend
|
||||||
|
production_health_check_backend
|
||||||
|
install_production_frontend
|
||||||
|
production_health_check_frontend
|
||||||
|
prod_log_success "Vollständige Produktions-Installation abgeschlossen!"
|
||||||
|
else
|
||||||
|
prod_log_error "Abhängigkeiten fehlen!"
|
||||||
|
fi
|
||||||
|
show_production_installer_menu
|
||||||
|
;;
|
||||||
|
9)
|
||||||
|
show_main_menu
|
||||||
|
;;
|
||||||
|
0)
|
||||||
|
echo -e "${GREEN}Auf Wiedersehen!${NC}"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${RED}Ungültige Option. Bitte versuchen Sie es erneut.${NC}"
|
||||||
|
sleep 2
|
||||||
|
show_production_installer_menu
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# ENDE PRODUKTIONS-INSTALLER
|
||||||
|
# ========================================================
|
||||||
|
|
||||||
# System-Abhängigkeiten installieren
|
# System-Abhängigkeiten installieren
|
||||||
install_system_dependencies() {
|
install_system_dependencies() {
|
||||||
show_header "System-Abhängigkeiten installieren"
|
show_header "System-Abhängigkeiten installieren"
|
||||||
@ -1069,7 +1323,7 @@ setup_backend_url() {
|
|||||||
# Backend API Konfiguration
|
# Backend API Konfiguration
|
||||||
NEXT_PUBLIC_API_URL=$backend_url
|
NEXT_PUBLIC_API_URL=$backend_url
|
||||||
|
|
||||||
# Frontend-URL für OAuth Callback
|
# Frontend-URL
|
||||||
NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
|
NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
|
||||||
|
|
||||||
# OAuth Konfiguration
|
# OAuth Konfiguration
|
||||||
@ -1178,7 +1432,7 @@ start_application() {
|
|||||||
start_debug_server
|
start_debug_server
|
||||||
;;
|
;;
|
||||||
7)
|
7)
|
||||||
return
|
show_main_menu
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "${RED}Ungültige Option.${NC}"
|
echo -e "${RED}Ungültige Option.${NC}"
|
||||||
@ -1699,18 +1953,21 @@ show_main_menu() {
|
|||||||
echo -e "${WHITE}2. Backend-Only Installation (Kiosk-ready)${NC}"
|
echo -e "${WHITE}2. Backend-Only Installation (Kiosk-ready)${NC}"
|
||||||
echo -e "${WHITE}3. Entwicklungs-Setup (Backend + Frontend)${NC}"
|
echo -e "${WHITE}3. Entwicklungs-Setup (Backend + Frontend)${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo -e "${WHITE}🎯 PRODUKTIONS-INSTALLER (v3.2):${NC}"
|
||||||
|
echo -e "${WHITE}4. Produktions-Installer (install.sh Integration)${NC}"
|
||||||
|
echo ""
|
||||||
echo -e "${WHITE}⚙️ GRANULARE INSTALLATION:${NC}"
|
echo -e "${WHITE}⚙️ GRANULARE INSTALLATION:${NC}"
|
||||||
echo -e "${WHITE}4. Granulare Installation & Konfiguration${NC}"
|
echo -e "${WHITE}5. Granulare Installation & Konfiguration${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${WHITE}🔧 SYSTEM & WARTUNG:${NC}"
|
echo -e "${WHITE}🔧 SYSTEM & WARTUNG:${NC}"
|
||||||
echo -e "${WHITE}5. Systemvoraussetzungen prüfen${NC}"
|
echo -e "${WHITE}6. Systemvoraussetzungen prüfen${NC}"
|
||||||
echo -e "${WHITE}6. Anwendung starten${NC}"
|
echo -e "${WHITE}7. Anwendung starten${NC}"
|
||||||
echo -e "${WHITE}7. Projekt-Informationen${NC}"
|
echo -e "${WHITE}8. Projekt-Informationen${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${WHITE}0. Beenden${NC}"
|
echo -e "${WHITE}0. Beenden${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
read -p "Wählen Sie eine Option (0-7): " choice
|
read -p "Wählen Sie eine Option (0-8): " choice
|
||||||
|
|
||||||
case $choice in
|
case $choice in
|
||||||
1)
|
1)
|
||||||
@ -1726,17 +1983,20 @@ show_main_menu() {
|
|||||||
show_main_menu
|
show_main_menu
|
||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
show_installation_menu
|
show_production_installer_menu
|
||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
|
show_installation_menu
|
||||||
|
;;
|
||||||
|
6)
|
||||||
test_dependencies
|
test_dependencies
|
||||||
show_main_menu
|
show_main_menu
|
||||||
;;
|
;;
|
||||||
6)
|
7)
|
||||||
start_application
|
start_application
|
||||||
show_main_menu
|
show_main_menu
|
||||||
;;
|
;;
|
||||||
7)
|
8)
|
||||||
show_project_info
|
show_project_info
|
||||||
show_main_menu
|
show_main_menu
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user