update-funktion verbessert
This commit is contained in:
142
deploy-with-config.sh
Executable file
142
deploy-with-config.sh
Executable file
@@ -0,0 +1,142 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== YourPart Deployment mit vorhandener Konfiguration ==="
|
||||
|
||||
# Prüfen ob wir im richtigen Verzeichnis sind
|
||||
if [ ! -f "package.json" ]; then
|
||||
echo "Error: Bitte führen Sie dieses Skript aus dem YourPart3-Root-Verzeichnis aus"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Frontend bauen
|
||||
echo "Building frontend..."
|
||||
cd frontend
|
||||
npm ci
|
||||
npm run build
|
||||
cd ..
|
||||
|
||||
# Verzeichnisse erstellen
|
||||
echo "Creating directories..."
|
||||
sudo mkdir -p /opt/yourpart/{frontend,backend,images/{tmp,userimages,screenshots}}
|
||||
|
||||
# Frontend kopieren
|
||||
echo "Deploying frontend..."
|
||||
sudo cp -r frontend/dist /opt/yourpart/frontend/
|
||||
sudo chown -R www-data:www-data /opt/yourpart/frontend
|
||||
sudo chmod -R 755 /opt/yourpart/frontend
|
||||
|
||||
# Backend kopieren
|
||||
echo "Deploying backend..."
|
||||
sudo cp -r backend/* /opt/yourpart/backend/
|
||||
sudo chown -R www-data:www-data /opt/yourpart/backend
|
||||
sudo chmod -R 755 /opt/yourpart/backend
|
||||
|
||||
# .env-Datei erstellen
|
||||
echo "Creating .env file..."
|
||||
cat > /opt/yourpart/backend/.env << 'ENVEOF'
|
||||
# Datenbank-Konfiguration (aus alter App)
|
||||
DB_HOST=localhost
|
||||
DB_USER=yourpart
|
||||
DB_PASS=hitomisan
|
||||
DB_NAME=yp2
|
||||
DB_PORT=60000
|
||||
|
||||
# Anwendungskonfiguration
|
||||
NODE_ENV=production
|
||||
PORT=2020
|
||||
STAGE=production
|
||||
|
||||
# Redis-Konfiguration
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASS=your_redis_password
|
||||
|
||||
# Session-Konfiguration (aus alter App)
|
||||
SECRET_KEY=k7e0CCw75PcmEGa
|
||||
SESSION_SECRET=k7e0CCw75PcmEGa
|
||||
|
||||
# E-Mail-Konfiguration (aus alter App)
|
||||
SMTP_HOST=smtp.1blu.de
|
||||
SMTP_PORT=465
|
||||
SMTP_USER=e226079_0-tsschulz
|
||||
SMTP_PASS=hitomisan
|
||||
SMTP_SECURE=true
|
||||
|
||||
# E-Mail-Einstellungen (aus alter App)
|
||||
SENDER_NAME=YourPart
|
||||
SENDER_EMAIL=kontakt@your-part.de
|
||||
|
||||
# AMQP-Konfiguration (aus alter App)
|
||||
AMQP_HOST=tsschulz.de
|
||||
AMQP_PORT=5672
|
||||
AMQP_EXCHANGE=yourpart
|
||||
AMQP_USERNAME=yourpart
|
||||
AMQP_PASSWORD=yourpart
|
||||
|
||||
# API-Keys (aus alter App)
|
||||
WEATHER_API_KEY=d0ddfcbc915f50263274211648a5dab0
|
||||
NEWS_API_KEY=pub_212733602779de7708a7374d67e363bd06af4
|
||||
|
||||
# Pfad-Konfiguration (aus alter App)
|
||||
ROOT_PATH=/opt/yourpart
|
||||
IMAGES_PATH=/images
|
||||
TMP_IMAGES_PATH=/images/tmp
|
||||
USER_IMAGES_PATH=/images/userimages
|
||||
SCREENSHOT_IMAGES_PATH=/images/screenshots
|
||||
|
||||
# URL-Konfiguration
|
||||
BASE_URL=https://www.your-part.de
|
||||
IMAGES_URL=https://www.your-part.de/images/
|
||||
ACTIVATION_URL=https://www.your-part.de/activate?code=
|
||||
PASSWORD_RESET_URL=https://www.your-part.de/setnewpassword?username=
|
||||
|
||||
# Spiel-Konfiguration (aus alter App)
|
||||
START_BUDGET=10
|
||||
TEST_MODE=false
|
||||
PAY_PER_DAY=100
|
||||
|
||||
# Debug-Einstellungen
|
||||
DEBUG_SQL=false
|
||||
DEBUG_MESSAGES=false
|
||||
DEBUG_RECREATE_DB=false
|
||||
ENVEOF
|
||||
|
||||
sudo chown www-data:www-data /opt/yourpart/backend/.env
|
||||
sudo chmod 600 /opt/yourpart/backend/.env
|
||||
|
||||
# Service installieren
|
||||
echo "Installing service..."
|
||||
sudo cp yourpart.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable yourpart.service
|
||||
|
||||
# Apache-Konfiguration
|
||||
echo "Configuring Apache..."
|
||||
sudo cp yourpart-http.conf /etc/apache2/sites-available/
|
||||
sudo cp yourpart-https.conf /etc/apache2/sites-available/
|
||||
|
||||
# Alte Konfiguration deaktivieren
|
||||
sudo a2dissite yourpart 2>/dev/null || true
|
||||
|
||||
# Neue Konfigurationen aktivieren
|
||||
sudo a2ensite yourpart-http
|
||||
sudo a2ensite yourpart-https
|
||||
|
||||
# Apache-Module aktivieren
|
||||
sudo a2enmod proxy proxy_http proxy_wstunnel rewrite ssl
|
||||
sudo systemctl reload apache2
|
||||
|
||||
# Service starten
|
||||
echo "Starting service..."
|
||||
sudo systemctl start yourpart.service
|
||||
|
||||
echo ""
|
||||
echo "=== Deployment abgeschlossen! ==="
|
||||
echo "Frontend: /opt/yourpart/frontend/dist/"
|
||||
echo "Backend: /opt/yourpart/backend/"
|
||||
echo "Service: yourpart.service"
|
||||
echo ""
|
||||
echo "Status prüfen:"
|
||||
echo " sudo systemctl status yourpart.service"
|
||||
echo " sudo systemctl status apache2"
|
||||
echo " sudo journalctl -u yourpart.service -f"
|
||||
26
fix-api-urls.sh
Executable file
26
fix-api-urls.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== YourPart API-URL Fix ==="
|
||||
|
||||
cd ~/yourpart3/frontend
|
||||
|
||||
# 1. Alle localhost:3001 Referenzen finden
|
||||
echo "Suche nach localhost:3001 Referenzen..."
|
||||
grep -r "localhost:3001" src/ || echo "Keine localhost:3001 Referenzen gefunden"
|
||||
|
||||
# 2. Alle localhost Referenzen finden
|
||||
echo ""
|
||||
echo "Suche nach localhost Referenzen..."
|
||||
grep -r "localhost" src/ || echo "Keine localhost Referenzen gefunden"
|
||||
|
||||
# 3. API-Konfigurationsdateien finden
|
||||
echo ""
|
||||
echo "Suche nach API-Konfigurationsdateien..."
|
||||
find src/ -name "*.js" -exec grep -l "axios\|baseURL\|localhost" {} \;
|
||||
|
||||
echo ""
|
||||
echo "=== API-URL Fix abgeschlossen ==="
|
||||
echo "Bitte überprüfen Sie die gefundenen Dateien und ersetzen Sie:"
|
||||
echo " localhost:3001 → /api"
|
||||
echo " http://localhost:3001 → /api"
|
||||
echo " baseURL: 'http://localhost:3001' → baseURL: '/api'"
|
||||
22
fix-cors.sh
Executable file
22
fix-cors.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== YourPart CORS-Fix ==="
|
||||
|
||||
# Backup der ursprünglichen app.js erstellen
|
||||
sudo cp /opt/yourpart/backend/app.js /opt/yourpart/backend/app.js.backup
|
||||
|
||||
# CORS-Konfiguration aktualisieren
|
||||
sudo sed -i 's|origin: \[.*\]|origin: [\n "http://localhost:3000", \n "http://localhost:5173", \n "http://127.0.0.1:3000", \n "http://127.0.0.1:5173",\n "https://your-part.de",\n "https://www.your-part.de",\n "http://your-part.de",\n "http://www.your-part.de"\n ]|' /opt/yourpart/backend/app.js
|
||||
|
||||
echo "CORS-Konfiguration aktualisiert!"
|
||||
|
||||
# Service neu starten
|
||||
echo "Starte Backend-Service neu..."
|
||||
sudo systemctl restart yourpart.service
|
||||
|
||||
# Status prüfen
|
||||
echo "Service-Status:"
|
||||
sudo systemctl status yourpart.service
|
||||
|
||||
echo ""
|
||||
echo "CORS-Fix abgeschlossen! Testen Sie jetzt die Anwendung."
|
||||
56
quick-cors-fix.sh
Executable file
56
quick-cors-fix.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== YourPart Quick CORS Fix ==="
|
||||
|
||||
# 1. Apache headers-Modul aktivieren
|
||||
echo "Aktiviere Apache headers-Modul..."
|
||||
sudo a2enmod headers
|
||||
|
||||
# 2. Port in HTTP-Konfiguration korrigieren
|
||||
echo "Korrigiere Port in HTTP-Konfiguration..."
|
||||
sudo sed -i 's/2020/3001/g' /etc/apache2/sites-available/yourpart-http.conf
|
||||
|
||||
# 3. Port in HTTPS-Konfiguration korrigieren
|
||||
echo "Korrigiere Port in HTTPS-Konfiguration..."
|
||||
sudo sed -i 's/2020/3001/g' /etc/apache2/sites-available/yourpart-https.conf
|
||||
|
||||
# 4. CORS-Header zu HTTPS-Konfiguration hinzufügen
|
||||
echo "Füge CORS-Header hinzu..."
|
||||
sudo sed -i '/<Directory "\/opt\/yourpart\/frontend\/dist">/a\
|
||||
\
|
||||
# CORS-Header für alle Requests\
|
||||
Header always set Access-Control-Allow-Origin "*"\
|
||||
Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"\
|
||||
Header always set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization, userId, authCode"\
|
||||
Header always set Access-Control-Allow-Credentials "true"\
|
||||
' /etc/apache2/sites-available/yourpart-https.conf
|
||||
|
||||
# 5. CORS-Header für API-Requests hinzufügen
|
||||
echo "Füge API CORS-Header hinzu..."
|
||||
sudo sed -i '/ProxyPassReverse "\/socket.io\/"/a\
|
||||
\
|
||||
# CORS-Header für API-Requests\
|
||||
<Location "\/api\/">\
|
||||
Header always set Access-Control-Allow-Origin "*"\
|
||||
Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"\
|
||||
Header always set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization, userId, authCode"\
|
||||
Header always set Access-Control-Allow-Credentials "true"\
|
||||
\
|
||||
# OPTIONS-Requests behandeln\
|
||||
RewriteEngine On\
|
||||
RewriteCond %{REQUEST_METHOD} OPTIONS\
|
||||
RewriteRule ^(.*)$ $1 [R=200,L]\
|
||||
</Location>\
|
||||
' /etc/apache2/sites-available/yourpart-https.conf
|
||||
|
||||
# 6. Apache neu laden
|
||||
echo "Lade Apache neu..."
|
||||
sudo systemctl reload apache2
|
||||
|
||||
echo ""
|
||||
echo "=== Quick CORS Fix abgeschlossen! ==="
|
||||
echo "✅ Port korrigiert (3001)"
|
||||
echo "✅ CORS-Header hinzugefügt"
|
||||
echo "✅ Apache neu geladen"
|
||||
echo ""
|
||||
echo "Testen Sie jetzt die Anwendung!"
|
||||
Reference in New Issue
Block a user