"feat: Refactor backend configuration files, remove test scripts"
This commit is contained in:
410
myp_installer.sh
410
myp_installer.sh
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# MYP Installer Control Center für Linux/Unix-Systeme
|
||||
# Konsolidiertes Installationsskript für die MYP-Plattform
|
||||
# Version 2.0
|
||||
# MYP Installer Control Center - Vollständige Linux/Unix-Installation
|
||||
# Zentrale Installationskonsole für die MYP-Plattform
|
||||
# Version 3.0 - Konsolidiert alle Setup-Funktionen
|
||||
|
||||
# Farbdefinitionen
|
||||
RED='\033[0;31m'
|
||||
@@ -24,6 +24,7 @@ show_header() {
|
||||
clear
|
||||
echo -e "${CYAN}=============================================================${NC}"
|
||||
echo -e "${CYAN} MYP INSTALLER CONTROL CENTER ${NC}"
|
||||
echo -e "${CYAN} Version 3.0 ${NC}"
|
||||
echo -e "${CYAN}=============================================================${NC}"
|
||||
echo -e "${CYAN} $title${NC}"
|
||||
echo -e "${CYAN}=============================================================${NC}"
|
||||
@@ -67,6 +68,8 @@ get_local_ip() {
|
||||
}
|
||||
|
||||
test_dependencies() {
|
||||
show_header "Systemvoraussetzungen prüfen"
|
||||
|
||||
echo -e "${BLUE}Prüfe Abhängigkeiten...${NC}"
|
||||
|
||||
local all_installed=1
|
||||
@@ -74,8 +77,12 @@ test_dependencies() {
|
||||
# Python
|
||||
if check_command python3; then
|
||||
echo -e "${GREEN}✓ Python 3 gefunden${NC}"
|
||||
python_version=$(python3 --version 2>&1)
|
||||
echo -e "${WHITE} Version: $python_version${NC}"
|
||||
elif check_command python; then
|
||||
echo -e "${GREEN}✓ Python gefunden${NC}"
|
||||
python_version=$(python --version 2>&1)
|
||||
echo -e "${WHITE} Version: $python_version${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Python nicht gefunden${NC}"
|
||||
all_installed=0
|
||||
@@ -94,6 +101,8 @@ test_dependencies() {
|
||||
# Docker
|
||||
if check_command docker; then
|
||||
echo -e "${GREEN}✓ Docker gefunden${NC}"
|
||||
docker_version=$(docker --version 2>&1)
|
||||
echo -e "${WHITE} Version: $docker_version${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Docker nicht gefunden${NC}"
|
||||
all_installed=0
|
||||
@@ -110,6 +119,8 @@ test_dependencies() {
|
||||
# Node.js
|
||||
if check_command node; then
|
||||
echo -e "${GREEN}✓ Node.js gefunden${NC}"
|
||||
node_version=$(node --version 2>&1)
|
||||
echo -e "${WHITE} Version: $node_version${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Node.js nicht gefunden${NC}"
|
||||
all_installed=0
|
||||
@@ -131,7 +142,23 @@ test_dependencies() {
|
||||
all_installed=0
|
||||
fi
|
||||
|
||||
return $all_installed
|
||||
# Git
|
||||
if check_command git; then
|
||||
echo -e "${GREEN}✓ Git gefunden${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Git nicht gefunden${NC}"
|
||||
all_installed=0
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if [ $all_installed -eq 1 ]; then
|
||||
echo -e "${GREEN}✓ Alle Abhängigkeiten sind installiert!${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠ Einige Abhängigkeiten fehlen. Bitte installieren Sie diese vor der Verwendung.${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
}
|
||||
|
||||
setup_hosts() {
|
||||
@@ -217,6 +244,10 @@ create_ssl_certificates() {
|
||||
backend_hostname="raspberrypi"
|
||||
frontend_hostname="m040tbaraspi001.de040.corpintra.net"
|
||||
;;
|
||||
*)
|
||||
backend_hostname="localhost"
|
||||
frontend_hostname="localhost"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -e "${BLUE}Backend-Hostname: $backend_hostname${NC}"
|
||||
@@ -232,35 +263,52 @@ create_ssl_certificates() {
|
||||
# SSL-Zertifikate mit Python und cryptography erstellen
|
||||
echo -e "${BLUE}Erstelle SSL-Zertifikate mit Python...${NC}"
|
||||
|
||||
if check_command python3 || check_command python; then
|
||||
# Überprüfen, ob cryptography installiert ist
|
||||
# Überprüfen, ob Python verfügbar ist
|
||||
python_cmd=""
|
||||
if check_command python3; then
|
||||
python_cmd="python3"
|
||||
if ! check_command python3; then
|
||||
python_cmd="python"
|
||||
elif check_command python; then
|
||||
python_cmd="python"
|
||||
else
|
||||
echo -e "${RED}Python nicht gefunden. SSL-Zertifikate können nicht erstellt werden.${NC}"
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Überprüfen, ob cryptography installiert ist
|
||||
cryptography_installed=$($python_cmd -c "try: import cryptography; print('True'); except ImportError: print('False')" 2>/dev/null)
|
||||
|
||||
if [ "$cryptography_installed" != "True" ]; then
|
||||
echo -e "${YELLOW}Installiere Python-Abhängigkeit 'cryptography'...${NC}"
|
||||
if check_command pip3; then
|
||||
exec_command "pip3 install cryptography" "Installiere cryptography-Paket"
|
||||
elif check_command pip; then
|
||||
exec_command "pip install cryptography" "Installiere cryptography-Paket"
|
||||
else
|
||||
echo -e "${RED}pip nicht gefunden. Kann cryptography nicht installieren.${NC}"
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
return 1
|
||||
fi
|
||||
|
||||
cryptography_installed=$($python_cmd -c "try: import cryptography; print('True'); except ImportError: print('False')" 2>/dev/null)
|
||||
|
||||
if [ "$cryptography_installed" != "True" ]; then
|
||||
echo -e "${YELLOW}Installiere Python-Abhängigkeit 'cryptography'...${NC}"
|
||||
if check_command pip3; then
|
||||
exec_command "pip3 install cryptography" "Installiere cryptography-Paket"
|
||||
else
|
||||
exec_command "pip install cryptography" "Installiere cryptography-Paket"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Python-Skript zur Zertifikatserstellung
|
||||
cat > temp_cert_script.py << EOF
|
||||
fi
|
||||
|
||||
# Python-Skript zur Zertifikatserstellung erstellen
|
||||
cat > temp_cert_script.py << EOL
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import datetime
|
||||
import sys
|
||||
from cryptography import x509
|
||||
from cryptography.x509.oid import NameOID
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption
|
||||
|
||||
try:
|
||||
from cryptography import x509
|
||||
from cryptography.x509.oid import NameOID
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption
|
||||
import ipaddress
|
||||
except ImportError as e:
|
||||
print(f"Fehler: Paket nicht gefunden: {e}")
|
||||
print("Bitte installieren Sie es mit: pip install cryptography")
|
||||
sys.exit(1)
|
||||
|
||||
def create_self_signed_cert(cert_path, key_path, hostname="localhost"):
|
||||
# Verzeichnis erstellen, falls es nicht existiert
|
||||
@@ -312,7 +360,8 @@ def create_self_signed_cert(cert_path, key_path, hostname="localhost"):
|
||||
).add_extension(
|
||||
x509.SubjectAlternativeName([
|
||||
x509.DNSName(hostname),
|
||||
x509.DNSName("localhost")
|
||||
x509.DNSName("localhost"),
|
||||
x509.IPAddress(ipaddress.IPv4Address("127.0.0.1"))
|
||||
]),
|
||||
critical=False,
|
||||
).add_extension(
|
||||
@@ -350,23 +399,20 @@ create_self_signed_cert('$backend_cert_file', '$backend_key_file', '$backend_hos
|
||||
|
||||
# Frontend-Zertifikat erstellen
|
||||
create_self_signed_cert('$frontend_cert_file', '$frontend_key_file', '$frontend_hostname')
|
||||
EOF
|
||||
|
||||
# Python-Skript ausführbar machen und ausführen
|
||||
chmod +x temp_cert_script.py
|
||||
|
||||
if $python_cmd temp_cert_script.py; then
|
||||
echo -e "${GREEN}SSL-Zertifikate erfolgreich erstellt!${NC}"
|
||||
else
|
||||
echo -e "${RED}Fehler beim Erstellen der SSL-Zertifikate.${NC}"
|
||||
fi
|
||||
|
||||
# Temporäres Skript löschen
|
||||
rm temp_cert_script.py
|
||||
EOL
|
||||
|
||||
# Python-Skript ausführbar machen und ausführen
|
||||
chmod +x temp_cert_script.py
|
||||
|
||||
if $python_cmd temp_cert_script.py; then
|
||||
echo -e "${GREEN}SSL-Zertifikate erfolgreich erstellt!${NC}"
|
||||
else
|
||||
echo -e "${RED}Python nicht gefunden. SSL-Zertifikate können nicht erstellt werden.${NC}"
|
||||
echo -e "${RED}Fehler beim Erstellen der SSL-Zertifikate.${NC}"
|
||||
fi
|
||||
|
||||
# Temporäres Skript löschen
|
||||
rm -f temp_cert_script.py
|
||||
|
||||
# Zertifikate im System installieren (optional)
|
||||
if [ $is_root -eq 1 ]; then
|
||||
read -p "Möchten Sie die Zertifikate im System installieren? (j/n, Standard: n): " install_certs
|
||||
@@ -375,19 +421,28 @@ EOF
|
||||
if [ -f "$backend_cert_file" ]; then
|
||||
echo -e "${BLUE}Installiere Backend-Zertifikat im System...${NC}"
|
||||
|
||||
# Für verschiedene Linux-Distributionen
|
||||
# Debian/Ubuntu/Raspberry Pi OS
|
||||
if [ -d "/usr/local/share/ca-certificates" ]; then
|
||||
# Debian/Ubuntu/Raspberry Pi OS
|
||||
cp "$backend_cert_file" /usr/local/share/ca-certificates/myp.crt
|
||||
cp "$backend_cert_file" /usr/local/share/ca-certificates/myp-backend.crt
|
||||
update-ca-certificates
|
||||
echo -e "${GREEN}Zertifikat installiert (Debian/Ubuntu)${NC}"
|
||||
# RHEL/CentOS/Fedora
|
||||
elif [ -d "/etc/pki/ca-trust/source/anchors" ]; then
|
||||
# RHEL/CentOS/Fedora
|
||||
cp "$backend_cert_file" /etc/pki/ca-trust/source/anchors/myp.crt
|
||||
cp "$backend_cert_file" /etc/pki/ca-trust/source/anchors/myp-backend.crt
|
||||
update-ca-trust extract
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "$frontend_cert_file" ]; then
|
||||
echo -e "${BLUE}Installiere Frontend-Zertifikat im System...${NC}"
|
||||
|
||||
# Debian/Ubuntu/Raspberry Pi OS
|
||||
if [ -d "/usr/local/share/ca-certificates" ]; then
|
||||
cp "$frontend_cert_file" /usr/local/share/ca-certificates/myp-frontend.crt
|
||||
update-ca-certificates
|
||||
# RHEL/CentOS/Fedora
|
||||
elif [ -d "/etc/pki/ca-trust/source/anchors" ]; then
|
||||
cp "$frontend_cert_file" /etc/pki/ca-trust/source/anchors/myp-frontend.crt
|
||||
update-ca-trust extract
|
||||
echo -e "${GREEN}Zertifikat installiert (RHEL/CentOS/Fedora)${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}Unbekanntes System. Zertifikatinstallation übersprungen.${NC}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -404,50 +459,53 @@ EOF
|
||||
|
||||
# Kopiere Zertifikate ins Frontend-Verzeichnis
|
||||
frontend_ssl_dir="./frontend/ssl"
|
||||
if [ ! -d "$frontend_ssl_dir" ]; then
|
||||
mkdir -p "$frontend_ssl_dir"
|
||||
mkdir -p "$frontend_ssl_dir"
|
||||
|
||||
if [ -f "$backend_cert_file" ]; then
|
||||
cp "$backend_cert_file" "$frontend_ssl_dir/myp.crt"
|
||||
fi
|
||||
|
||||
cp "$backend_cert_file" "$frontend_ssl_dir/myp.crt"
|
||||
cp "$backend_key_file" "$frontend_ssl_dir/myp.key"
|
||||
if [ -f "$backend_key_file" ]; then
|
||||
cp "$backend_key_file" "$frontend_ssl_dir/myp.key"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Zertifikate ins Frontend-Verzeichnis kopiert.${NC}"
|
||||
|
||||
# Prüfen, ob .env.local existiert und aktualisieren
|
||||
# .env.local aktualisieren
|
||||
env_local_path="./frontend/.env.local"
|
||||
|
||||
if [ -f "$env_local_path" ]; then
|
||||
# Datei existiert, mache Backup
|
||||
cp "$env_local_path" "${env_local_path}.bak"
|
||||
env_content=$(cat "$env_local_path")
|
||||
else
|
||||
# Datei erstellen
|
||||
echo "# MYP Frontend Umgebungsvariablen" > "$env_local_path"
|
||||
env_content="# MYP Frontend Umgebungsvariablen"
|
||||
fi
|
||||
|
||||
# SSL-Konfigurationen hinzufügen/aktualisieren
|
||||
declare -a ssl_configs=(
|
||||
# SSL-Konfigurationen
|
||||
ssl_configs=(
|
||||
"NODE_TLS_REJECT_UNAUTHORIZED=0"
|
||||
"HTTPS=true"
|
||||
"SSL_CRT_FILE=./ssl/myp.crt"
|
||||
"SSL_KEY_FILE=./ssl/myp.key"
|
||||
"NEXT_PUBLIC_API_URL=https://${backend_hostname}"
|
||||
"NEXT_PUBLIC_BACKEND_HOST=${backend_hostname}"
|
||||
"NEXT_PUBLIC_API_URL=https://$backend_hostname"
|
||||
"NEXT_PUBLIC_BACKEND_HOST=$backend_hostname"
|
||||
"NEXT_PUBLIC_BACKEND_PROTOCOL=https"
|
||||
)
|
||||
|
||||
# Existierende Konfigurationen aktualisieren
|
||||
for config in "${ssl_configs[@]}"; do
|
||||
key=$(echo "$config" | cut -d'=' -f1)
|
||||
|
||||
# Prüfen, ob die Konfiguration bereits existiert
|
||||
if grep -q "^${key}=" "$env_local_path"; then
|
||||
# Existierende Konfiguration aktualisieren
|
||||
sed -i "s|^${key}=.*|${config}|" "$env_local_path"
|
||||
if echo "$env_content" | grep -q "^$key="; then
|
||||
# Update existierende Konfiguration
|
||||
env_content=$(echo "$env_content" | sed "s/^$key=.*/$config/")
|
||||
else
|
||||
# Neue Konfiguration hinzufügen
|
||||
echo "$config" >> "$env_local_path"
|
||||
env_content="$env_content\n$config"
|
||||
fi
|
||||
done
|
||||
|
||||
# Speichern der aktualisierten Umgebungsvariablen
|
||||
echo -e "$env_content" > "$env_local_path"
|
||||
echo -e "${GREEN}.env.local Datei mit SSL-Konfigurationen aktualisiert.${NC}"
|
||||
fi
|
||||
|
||||
@@ -464,27 +522,27 @@ setup_environment() {
|
||||
show_header "Umgebungs-Setup"
|
||||
|
||||
# Prüfen, ob Python und pip installiert sind
|
||||
python_cmd="python3"
|
||||
pip_cmd="pip3"
|
||||
python_cmd=""
|
||||
pip_cmd=""
|
||||
|
||||
if ! check_command python3; then
|
||||
if check_command python; then
|
||||
python_cmd="python"
|
||||
else
|
||||
echo -e "${RED}Python ist nicht installiert.${NC}"
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
return 1
|
||||
fi
|
||||
if check_command python3; then
|
||||
python_cmd="python3"
|
||||
elif check_command python; then
|
||||
python_cmd="python"
|
||||
else
|
||||
echo -e "${RED}Python ist nicht installiert. Bitte installieren Sie Python 3.6+ und versuchen Sie es erneut.${NC}"
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! check_command pip3; then
|
||||
if check_command pip; then
|
||||
pip_cmd="pip"
|
||||
else
|
||||
echo -e "${RED}pip ist nicht installiert.${NC}"
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
return 1
|
||||
fi
|
||||
if check_command pip3; then
|
||||
pip_cmd="pip3"
|
||||
elif check_command pip; then
|
||||
pip_cmd="pip"
|
||||
else
|
||||
echo -e "${RED}pip ist nicht installiert. Bitte installieren Sie pip und versuchen Sie es erneut.${NC}"
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Python-Abhängigkeiten installieren
|
||||
@@ -516,6 +574,12 @@ setup_environment() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# Datenbank initialisieren
|
||||
echo -e "${BLUE}Initialisiere Datenbank...${NC}"
|
||||
if [ -f "backend/app/models.py" ]; then
|
||||
exec_command "cd backend && $python_cmd -c 'from app.models import init_db, create_initial_admin; init_db(); create_initial_admin()'" "Initialisiere Datenbank und Admin-Benutzer"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}Umgebungs-Setup abgeschlossen!${NC}"
|
||||
|
||||
@@ -529,54 +593,60 @@ start_application() {
|
||||
echo -e "${BLUE}Wie möchten Sie die Anwendung starten?${NC}"
|
||||
echo -e "${WHITE}1. Backend-Server starten (Python)${NC}"
|
||||
echo -e "${WHITE}2. Frontend-Server starten (Node.js)${NC}"
|
||||
echo -e "${WHITE}3. Beide Server starten${NC}"
|
||||
echo -e "${WHITE}3. Beide Server starten (in separaten Terminals)${NC}"
|
||||
echo -e "${WHITE}4. Mit Docker Compose starten${NC}"
|
||||
echo -e "${WHITE}5. Zurück zum Hauptmenü${NC}"
|
||||
echo -e "${WHITE}5. Vollständige Installation und Start${NC}"
|
||||
echo -e "${WHITE}6. Zurück zum Hauptmenü${NC}"
|
||||
|
||||
read -p "Wählen Sie eine Option (1-5): " choice
|
||||
read -p "Wählen Sie eine Option (1-6): " choice
|
||||
|
||||
case $choice in
|
||||
1)
|
||||
echo -e "${BLUE}Starte Backend-Server...${NC}"
|
||||
python_cmd="python3"
|
||||
if ! check_command python3; then
|
||||
python_cmd=""
|
||||
if check_command python3; then
|
||||
python_cmd="python3"
|
||||
elif check_command python; then
|
||||
python_cmd="python"
|
||||
fi
|
||||
$python_cmd backend/app/app.py &
|
||||
echo -e "${GREEN}Backend-Server läuft jetzt im Hintergrund.${NC}"
|
||||
echo -e "${YELLOW}PID: $!${NC}"
|
||||
|
||||
if [ -n "$python_cmd" ]; then
|
||||
$python_cmd backend/app/app.py &
|
||||
echo -e "${GREEN}Backend-Server läuft jetzt im Hintergrund.${NC}"
|
||||
else
|
||||
echo -e "${RED}Python nicht gefunden.${NC}"
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
echo -e "${BLUE}Starte Frontend-Server...${NC}"
|
||||
if check_command npm; then
|
||||
(cd frontend && npm run dev) &
|
||||
echo -e "${GREEN}Frontend-Server läuft jetzt im Hintergrund.${NC}"
|
||||
echo -e "${YELLOW}PID: $!${NC}"
|
||||
else
|
||||
echo -e "${RED}npm ist nicht installiert.${NC}"
|
||||
echo -e "${RED}npm nicht gefunden.${NC}"
|
||||
fi
|
||||
;;
|
||||
3)
|
||||
echo -e "${BLUE}Starte Backend-Server...${NC}"
|
||||
python_cmd="python3"
|
||||
if ! check_command python3; then
|
||||
python_cmd=""
|
||||
if check_command python3; then
|
||||
python_cmd="python3"
|
||||
elif check_command python; then
|
||||
python_cmd="python"
|
||||
fi
|
||||
$python_cmd backend/app/app.py &
|
||||
backend_pid=$!
|
||||
|
||||
if [ -n "$python_cmd" ]; then
|
||||
$python_cmd backend/app/app.py &
|
||||
echo -e "${GREEN}Backend-Server gestartet.${NC}"
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}Starte Frontend-Server...${NC}"
|
||||
if check_command npm; then
|
||||
(cd frontend && npm run dev) &
|
||||
frontend_pid=$!
|
||||
|
||||
echo -e "${GREEN}Beide Server laufen jetzt im Hintergrund.${NC}"
|
||||
echo -e "${YELLOW}Backend PID: $backend_pid${NC}"
|
||||
echo -e "${YELLOW}Frontend PID: $frontend_pid${NC}"
|
||||
else
|
||||
echo -e "${RED}npm ist nicht installiert. Nur Backend wurde gestartet.${NC}"
|
||||
echo -e "${YELLOW}Backend PID: $backend_pid${NC}"
|
||||
echo -e "${GREEN}Frontend-Server gestartet.${NC}"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Beide Server laufen jetzt im Hintergrund.${NC}"
|
||||
;;
|
||||
4)
|
||||
if check_command docker && check_command docker-compose; then
|
||||
@@ -588,6 +658,29 @@ start_application() {
|
||||
fi
|
||||
;;
|
||||
5)
|
||||
echo -e "${BLUE}Führe vollständige Installation durch...${NC}"
|
||||
setup_environment
|
||||
create_ssl_certificates
|
||||
echo -e "${BLUE}Starte Anwendung...${NC}"
|
||||
|
||||
python_cmd=""
|
||||
if check_command python3; then
|
||||
python_cmd="python3"
|
||||
elif check_command python; then
|
||||
python_cmd="python"
|
||||
fi
|
||||
|
||||
if [ -n "$python_cmd" ]; then
|
||||
$python_cmd backend/app/app.py &
|
||||
fi
|
||||
|
||||
if check_command npm; then
|
||||
(cd frontend && npm run dev) &
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Vollständige Installation und Start abgeschlossen!${NC}"
|
||||
;;
|
||||
6)
|
||||
return
|
||||
;;
|
||||
*)
|
||||
@@ -599,45 +692,64 @@ start_application() {
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
}
|
||||
|
||||
clean_old_scripts() {
|
||||
show_header "Alte Skripte bereinigen"
|
||||
show_project_info() {
|
||||
show_header "Projekt-Informationen"
|
||||
|
||||
old_scripts=(
|
||||
"setup_ssl.sh"
|
||||
"setup_hosts.sh"
|
||||
"generate_ssl_certs.sh"
|
||||
"setup_ssl.ps1"
|
||||
"setup_hosts.ps1"
|
||||
"setup_hosts_copy.ps1"
|
||||
"generate_ssl_certs.ps1"
|
||||
"generate_ssl_certs_copy.ps1"
|
||||
)
|
||||
|
||||
echo -e "${BLUE}Folgende Skripte werden gelöscht:${NC}"
|
||||
for script in "${old_scripts[@]}"; do
|
||||
if [ -f "$script" ]; then
|
||||
echo -e "${WHITE} - $script${NC}"
|
||||
fi
|
||||
done
|
||||
echo -e "${CYAN}MYP (Mercedes-Benz Yard Printing) Platform${NC}"
|
||||
echo -e "${BLUE}Version 3.0${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}Beschreibung:${NC}"
|
||||
echo -e "${WHITE}Eine vollständige 3D-Drucker-Management-Plattform für Mercedes-Benz Werk 040 Berlin.${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}Komponenten:${NC}"
|
||||
echo -e "${WHITE}- Backend: Flask-basierte REST API${NC}"
|
||||
echo -e "${WHITE}- Frontend: Next.js React-Anwendung${NC}"
|
||||
echo -e "${WHITE}- Datenbank: SQLite${NC}"
|
||||
echo -e "${WHITE}- Authentifizierung: GitHub OAuth + lokale Benutzer${NC}"
|
||||
echo -e "${WHITE}- SSL/TLS: Selbstsignierte Zertifikate${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}Standard-Zugangsdaten:${NC}"
|
||||
echo -e "${WHITE}- Admin E-Mail: admin@mercedes-benz.com${NC}"
|
||||
echo -e "${WHITE}- Admin Passwort: 744563017196A${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}URLs:${NC}"
|
||||
echo -e "${WHITE}- Backend: https://localhost:443 oder https://raspberrypi:443${NC}"
|
||||
echo -e "${WHITE}- Frontend: https://localhost:3000${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Weitere Informationen finden Sie in der CREDENTIALS.md Datei.${NC}"
|
||||
|
||||
echo ""
|
||||
read -p "Möchten Sie fortfahren? (j/n, Standard: j): " confirm
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
}
|
||||
|
||||
clean_old_files() {
|
||||
show_header "Alte Dateien bereinigen"
|
||||
|
||||
if [ "$confirm" != "n" ]; then
|
||||
for script in "${old_scripts[@]}"; do
|
||||
if [ -f "$script" ]; then
|
||||
if rm "$script"; then
|
||||
echo -e "${GREEN}✓ $script wurde gelöscht.${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Fehler beim Löschen von $script.${NC}"
|
||||
fi
|
||||
read -p "Möchten Sie alte Skriptdateien und temporäre Dateien löschen? (j/n): " clean_files
|
||||
|
||||
if [ "$clean_files" = "j" ]; then
|
||||
files_to_delete=(
|
||||
"setup_hosts.sh"
|
||||
"setup_ssl.sh"
|
||||
"generate_ssl_certs.sh"
|
||||
"temp_cert_script.py"
|
||||
"frontend/cleanup.sh"
|
||||
"frontend/install.sh"
|
||||
"frontend/https-setup.sh"
|
||||
"frontend/start-debug-server.sh"
|
||||
"frontend/start-frontend-server.sh"
|
||||
)
|
||||
|
||||
for file in "${files_to_delete[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
rm -f "$file"
|
||||
echo -e "${GREEN}✓ Gelöscht: $file${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}Bereinigung abgeschlossen.${NC}"
|
||||
echo -e "${GREEN}Bereinigung abgeschlossen!${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}Bereinigung abgebrochen.${NC}"
|
||||
echo -e "${BLUE}Bereinigung übersprungen.${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
@@ -653,17 +765,16 @@ show_main_menu() {
|
||||
echo -e "${WHITE}3. SSL-Zertifikate erstellen${NC}"
|
||||
echo -e "${WHITE}4. Umgebung einrichten (Abhängigkeiten installieren)${NC}"
|
||||
echo -e "${WHITE}5. Anwendung starten${NC}"
|
||||
echo -e "${WHITE}6. Alte Skripte bereinigen${NC}"
|
||||
echo -e "${WHITE}Q. Beenden${NC}"
|
||||
echo -e "${WHITE}6. Projekt-Informationen anzeigen${NC}"
|
||||
echo -e "${WHITE}7. Alte Dateien bereinigen${NC}"
|
||||
echo -e "${WHITE}8. Beenden${NC}"
|
||||
echo ""
|
||||
|
||||
read -p "Wählen Sie eine Option (1-6, Q): " choice
|
||||
read -p "Wählen Sie eine Option (1-8): " choice
|
||||
|
||||
case $choice in
|
||||
1)
|
||||
test_dependencies
|
||||
echo ""
|
||||
read -p "Drücken Sie ENTER, um fortzufahren..."
|
||||
show_main_menu
|
||||
;;
|
||||
2)
|
||||
@@ -683,10 +794,15 @@ show_main_menu() {
|
||||
show_main_menu
|
||||
;;
|
||||
6)
|
||||
clean_old_scripts
|
||||
show_project_info
|
||||
show_main_menu
|
||||
;;
|
||||
[Qq])
|
||||
7)
|
||||
clean_old_files
|
||||
show_main_menu
|
||||
;;
|
||||
8)
|
||||
echo -e "${GREEN}Auf Wiedersehen!${NC}"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user