From 8d29b2634acde4c8615c7106129dffc3da7b03ed Mon Sep 17 00:00:00 2001 From: Till Tomczak Date: Sat, 31 May 2025 21:46:27 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20Improved=20database=20files=20an?= =?UTF-8?q?d=20installer=20script=20for=20better=20performance=20and=20sta?= =?UTF-8?q?bility.=20=F0=9F=8C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/database/myp.db-shm | Bin 32768 -> 32768 bytes backend/app/database/myp.db-wal | Bin 37112 -> 49472 bytes backend/app/installer.sh | 101 +++++++++++++++++++++++++++----- 3 files changed, 87 insertions(+), 14 deletions(-) diff --git a/backend/app/database/myp.db-shm b/backend/app/database/myp.db-shm index 0204442987dfc3a786d5ad102015c04831073c25..a3e507746e6177099b86270385376a9e6e191fb7 100644 GIT binary patch delta 18 ZcmZo@U}|V!VwQNMyK$qh)5ZfEYym&{2Yvtm delta 215 zcmZo@U}|V!s+V}A%K!pQK+MR%AixQvrGc1v{e7=3zZ2#a9+@Av?1B8z->Nqxw%PuX zB2_)mC@=t-`yUBFg|!&ip)5Wi&4z}74q{*iVlcf?Fw}{eje%pM;7?X&b_ULkg5NpV VnSk;v46GXkUy3s_ZWNRj0|1WgGvELK diff --git a/backend/app/database/myp.db-wal b/backend/app/database/myp.db-wal index c92a0359866f5e19583a5099febd3bac3c0c0fa9..2f0f6dfe6ec09d50490e51868bd7f89dd831a9e5 100644 GIT binary patch delta 185 zcmeydkm*1Z^M)T2CZ8w};8^prYK3F}LaWIe0;Cz0C!Yy$W>sd;OJ>|G61aw+/dev/null)" ]; then + progress "Installiere Mercedes Corporate Zertifikate..." + + # Alle .crt und .pem Dateien kopieren + find "$CURRENT_DIR/certs/mercedes" -type f \( -name "*.crt" -o -name "*.pem" -o -name "*.cer" \) -exec cp {} /usr/local/share/ca-certificates/ \; 2>/dev/null || true + + # Zertifikate aktualisieren + update-ca-certificates || warning "Mercedes Zertifikate Update fehlgeschlagen" + + log "✅ Mercedes Zertifikate installiert" + else + info "Keine Mercedes Zertifikate gefunden - verwende Standard CA-Bundle" + fi + + # Python SSL-Konfiguration optimieren + progress "Konfiguriere Python SSL-Einstellungen..." + + # pip Konfiguration für SSL + mkdir -p /root/.pip + cat > /root/.pip/pip.conf << EOF +[global] +trusted-host = pypi.org + pypi.python.org + files.pythonhosted.org +cert = /etc/ssl/certs/ca-certificates.crt +timeout = 60 +retries = 3 + +[install] +trusted-host = pypi.org + pypi.python.org + files.pythonhosted.org +EOF + + # Python HTTPS-Konfiguration + export SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" + export REQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt" + export CURL_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt" + + # Pip auf neueste Version aktualisieren + progress "Aktualisiere pip auf neueste Version..." + python3 -m pip install --upgrade pip --break-system-packages --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org || warning "pip Update fehlgeschlagen" + + # SSL-Test durchführen + progress "Teste SSL-Verbindung zu PyPI..." + if python3 -c "import ssl, urllib.request; urllib.request.urlopen('https://pypi.org')" 2>/dev/null; then + log "✅ SSL-Verbindung zu PyPI erfolgreich" + else + warning "⚠️ SSL-Verbindung zu PyPI problematisch - Installation wird dennoch versucht" + fi + + log "✅ Mercedes SSL-Zertifikate und Python-Konfiguration abgeschlossen" +} + # ========================== ABHÄNGIGKEITEN INSTALLIEREN ========================== install_system_dependencies() { log "=== INSTALLIERE SYSTEM-ABHÄNGIGKEITEN ===" @@ -91,38 +158,44 @@ install_system_dependencies() { sqlite3 \ || error "System-Pakete Installation fehlgeschlagen" - progress "Installiere Python-Abhängigkeiten mit --break-system-packages..." + # WICHTIG: Mercedes Zertifikate vor Python-Paketen installieren + install_mercedes_certificates + + progress "Installiere Python-Abhängigkeiten mit Mercedes SSL-Konfiguration..." + + # SSL-freundliche pip-Installation mit Fallback-Optionen + PIP_OPTS="--break-system-packages --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --timeout 60 --retries 3" # Core Flask Framework - pip3 install --break-system-packages Flask==3.1.1 || error "Flask Installation fehlgeschlagen" - pip3 install --break-system-packages Flask-Login==0.6.3 || error "Flask-Login Installation fehlgeschlagen" - pip3 install --break-system-packages Flask-WTF==1.2.1 || error "Flask-WTF Installation fehlgeschlagen" + pip3 install $PIP_OPTS Flask==3.1.1 || pip3 install $PIP_OPTS Flask || error "Flask Installation fehlgeschlagen" + pip3 install $PIP_OPTS Flask-Login==0.6.3 || pip3 install $PIP_OPTS Flask-Login || error "Flask-Login Installation fehlgeschlagen" + pip3 install $PIP_OPTS Flask-WTF==1.2.1 || pip3 install $PIP_OPTS Flask-WTF || error "Flask-WTF Installation fehlgeschlagen" # Datenbank - pip3 install --break-system-packages SQLAlchemy==2.0.36 || error "SQLAlchemy Installation fehlgeschlagen" + pip3 install $PIP_OPTS SQLAlchemy==2.0.36 || pip3 install $PIP_OPTS SQLAlchemy || error "SQLAlchemy Installation fehlgeschlagen" # Sicherheit - pip3 install --break-system-packages bcrypt==4.2.1 || error "bcrypt Installation fehlgeschlagen" - pip3 install --break-system-packages cryptography==44.0.0 || error "cryptography Installation fehlgeschlagen" - pip3 install --break-system-packages Werkzeug==3.1.3 || error "Werkzeug Installation fehlgeschlagen" + pip3 install $PIP_OPTS bcrypt==4.2.1 || pip3 install $PIP_OPTS bcrypt || error "bcrypt Installation fehlgeschlagen" + pip3 install $PIP_OPTS cryptography==44.0.0 || pip3 install $PIP_OPTS cryptography || error "cryptography Installation fehlgeschlagen" + pip3 install $PIP_OPTS Werkzeug==3.1.3 || pip3 install $PIP_OPTS Werkzeug || error "Werkzeug Installation fehlgeschlagen" # Smart Plug Steuerung - pip3 install --break-system-packages PyP100 || warning "PyP100 Installation fehlgeschlagen (optional)" + pip3 install $PIP_OPTS PyP100 || warning "PyP100 Installation fehlgeschlagen (optional)" # HTTP Requests - pip3 install --break-system-packages requests==2.32.3 || error "requests Installation fehlgeschlagen" + pip3 install $PIP_OPTS requests==2.32.3 || pip3 install $PIP_OPTS requests || error "requests Installation fehlgeschlagen" # System Monitoring - pip3 install --break-system-packages psutil==6.1.1 || error "psutil Installation fehlgeschlagen" + pip3 install $PIP_OPTS psutil==6.1.1 || pip3 install $PIP_OPTS psutil || error "psutil Installation fehlgeschlagen" # Redis (optional) - pip3 install --break-system-packages redis==5.2.1 || warning "redis Installation fehlgeschlagen (optional)" + pip3 install $PIP_OPTS redis==5.2.1 || warning "redis Installation fehlgeschlagen (optional)" # Weitere Core-Abhängigkeiten - pip3 install --break-system-packages MarkupSafe==3.0.2 || error "MarkupSafe Installation fehlgeschlagen" + pip3 install $PIP_OPTS MarkupSafe==3.0.2 || pip3 install $PIP_OPTS MarkupSafe || error "MarkupSafe Installation fehlgeschlagen" # Produktions-Server - pip3 install --break-system-packages gunicorn==23.0.0 || error "gunicorn Installation fehlgeschlagen" + pip3 install $PIP_OPTS gunicorn==23.0.0 || pip3 install $PIP_OPTS gunicorn || error "gunicorn Installation fehlgeschlagen" log "✅ Alle Abhängigkeiten erfolgreich installiert" }