"feat: Update dependencies in requirements.txt and installer script"

This commit is contained in:
Till Tomczak 2025-05-27 06:49:03 +02:00
parent 1d2580defd
commit 320f56f32a
3 changed files with 78 additions and 22 deletions

View File

@ -16,7 +16,7 @@ SQLAlchemy==2.0.41
# Smart Plug Steuerung (Tapo)
# HINWEIS: Version 0.1.2 ist die letzte stabile Version
# Version 0.1.4 hat bekannte Authentifizierungsprobleme mit neuerer Tapo-Firmware
PyP100==0.1.2
PyP100
# Passwort-Hashing
Werkzeug==3.0.1

View File

@ -20,7 +20,7 @@ requests==2.31.0
urllib3==2.0.4
# Smart Plug Control (Tapo)
PyP100==0.1.2
PyP100
# System Monitoring
psutil==5.9.5

View File

@ -139,15 +139,62 @@ install_production_backend() {
chmod 600 app/certs/backend.key
chmod 644 app/certs/backend.crt
# Systemd Service installieren
# Alte Services entfernen und neue systemd Services installieren
if [ $is_root -eq 1 ]; then
prod_log_info "Installiere systemd Service..."
cp myp.service /etc/systemd/system/
prod_log_info "Entferne alte Services..."
# Alte Services stoppen und deaktivieren
for old_service in "myp.service" "myp-platform.service" "myp-backend.service"; do
if systemctl is-enabled "$old_service" >/dev/null 2>&1; then
systemctl stop "$old_service" 2>/dev/null || true
systemctl disable "$old_service" 2>/dev/null || true
prod_log_info "Alter Service $old_service entfernt"
fi
done
prod_log_info "Installiere neuen systemd Service mit Python 3.11..."
# Neuen Service mit Python 3.11 erstellen
cat > "/etc/systemd/system/myp.service" << EOF
[Unit]
Description=MYP Reservation Platform Backend (Python 3.11)
After=network.target
Wants=network.target
[Service]
Type=simple
User=$USER
Group=$USER
WorkingDirectory=$PROJECT_DIR/backend/app
Environment=PYTHONPATH=$PROJECT_DIR/backend/app
Environment=FLASK_ENV=production
Environment=FLASK_APP=app.py
Environment=PYTHONUNBUFFERED=1
ExecStart=$PROJECT_DIR/backend/venv/bin/python3.11 app.py --host 0.0.0.0 --port 443 --cert certs/backend.crt --key certs/backend.key
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=myp-backend
# Security settings
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=$PROJECT_DIR/backend/app/logs
ReadWritePaths=$PROJECT_DIR/backend/app/database
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable myp.service
prod_log_success "Neuer systemd Service mit Python 3.11 installiert"
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"
prod_log_info "Manuell ausführen: sudo systemctl stop myp.service && sudo systemctl disable myp.service"
prod_log_info "Dann neuen Service erstellen mit Python 3.11 Pfad"
fi
# Datenbank initialisieren
@ -578,18 +625,22 @@ setup_python_node_environment() {
echo -e "${BLUE}1. Python-Umgebung prüfen...${NC}"
# Python prüfen
# Python 3.11 prüfen (erforderlich für MYP Backend)
python_cmd=""
if check_command python3; then
if check_command python3.11; then
python_cmd="python3.11"
python_version=$(python3.11 --version 2>&1)
echo -e "${GREEN}$python_version${NC}"
elif check_command python3; then
python_cmd="python3"
python_version=$(python3 --version 2>&1)
echo -e "${GREEN}$python_version${NC}"
echo -e "${YELLOW}$python_version gefunden, aber Python 3.11 wird empfohlen${NC}"
elif check_command python; then
python_cmd="python"
python_version=$(python --version 2>&1)
echo -e "${GREEN}$python_version${NC}"
echo -e "${YELLOW}$python_version gefunden, aber Python 3.11 wird empfohlen${NC}"
else
echo -e "${RED}✗ Python nicht gefunden${NC}"
echo -e "${RED}✗ Python nicht gefunden. Bitte installieren Sie Python 3.11${NC}"
return 1
fi
@ -639,16 +690,19 @@ install_backend() {
echo -e "${BLUE}MYP Backend (Flask API + Web Interface) installieren${NC}"
echo ""
# Python prüfen
# Python 3.11 prüfen (erforderlich für MYP Backend)
python_cmd=""
if check_command python3; then
if check_command python3.11; then
python_cmd="python3.11"
echo -e "${GREEN}✓ Python 3.11 gefunden${NC}"
elif check_command python3; then
python_cmd="python3"
echo -e "${GREEN}✓ Python 3 gefunden${NC}"
echo -e "${YELLOW}⚠ Python 3 gefunden, aber Python 3.11 wird empfohlen${NC}"
elif check_command python; then
python_cmd="python"
echo -e "${GREEN}✓ Python gefunden${NC}"
echo -e "${YELLOW}⚠ Python gefunden, aber Python 3.11 wird empfohlen${NC}"
else
echo -e "${RED}✗ Python nicht gefunden. Bitte installieren Sie Python 3.8+${NC}"
echo -e "${RED}✗ Python nicht gefunden. Bitte installieren Sie Python 3.11${NC}"
read -p "Drücken Sie ENTER, um fortzufahren..."
return 1
fi
@ -907,8 +961,8 @@ install_kiosk_mode() {
# Prüfen ob Backend läuft
if ! curl -k -s --max-time 5 https://localhost:443/ > /dev/null 2>&1; then
echo -e "${YELLOW}⚠ Backend scheint nicht zu laufen. Stellen Sie sicher, dass das Backend gestartet ist.${NC}"
echo -e "${BLUE}Backend starten mit: cd $APP_DIR && python app.py${NC}"
echo -e "${YELLOW}⚠ Backend scheint nicht zu laufen. Stellen Sie sicher, dass das Backend gestartet ist.${NC}"
echo -e "${BLUE}Backend starten mit: cd $APP_DIR && python3.11 app.py${NC}"
else
echo -e "${GREEN}✓ Backend ist verfügbar${NC}"
fi
@ -1599,7 +1653,7 @@ start_application() {
if [ -d "$VENV_DIR" ]; then
cd "$APP_DIR"
source "$VENV_DIR/bin/activate"
python app.py &
python3.11 app.py &
echo -e "${GREEN}Backend gestartet: https://localhost:443${NC}"
deactivate
cd "$PROJECT_DIR"
@ -1654,7 +1708,7 @@ start_debug_server() {
if [ -d "$VENV_DIR" ]; then
cd "$APP_DIR"
source "$VENV_DIR/bin/activate"
python app.py --debug
python3.11 app.py --debug
deactivate
cd "$PROJECT_DIR"
else
@ -1780,9 +1834,11 @@ create_ssl_certificates() {
# SSL-Zertifikate mit Python und cryptography erstellen
echo -e "${BLUE}Erstelle SSL-Zertifikate mit Python...${NC}"
# Überprüfen, ob Python verfügbar ist
# Überprüfen, ob Python verfügbar ist (bevorzugt Python 3.11)
python_cmd=""
if check_command python3; then
if check_command python3.11; then
python_cmd="python3.11"
elif check_command python3; then
python_cmd="python3"
elif check_command python; then
python_cmd="python"