diff --git a/deploy b/deploy new file mode 120000 index 0000000..d71cfe5 --- /dev/null +++ b/deploy @@ -0,0 +1 @@ +/opt/yourpart \ No newline at end of file diff --git a/deploy-with-config.sh b/deploy-with-config.sh new file mode 100755 index 0000000..21f301a --- /dev/null +++ b/deploy-with-config.sh @@ -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" diff --git a/fix-api-urls.sh b/fix-api-urls.sh new file mode 100755 index 0000000..06fbfe7 --- /dev/null +++ b/fix-api-urls.sh @@ -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'" diff --git a/fix-cors.sh b/fix-cors.sh new file mode 100755 index 0000000..f437c92 --- /dev/null +++ b/fix-cors.sh @@ -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." diff --git a/quick-cors-fix.sh b/quick-cors-fix.sh new file mode 100755 index 0000000..b415a4c --- /dev/null +++ b/quick-cors-fix.sh @@ -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 '//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\ + \ + 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]\ + \ +' /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!" diff --git a/update.sh b/update.sh index a0a7388..d6e29ef 100755 --- a/update.sh +++ b/update.sh @@ -1,5 +1,8 @@ #!/bin/bash +git fetch +git pull + echo "=== YourPart Update Script ===" echo "Dieses Script aktualisiert die Anwendung OHNE .env-Dateien zu überschreiben" echo ""