Enhance deploy script with improved logging and directory checks; update file copying logic to exclude sensitive files and ensure proper backup. Update nodemailer and sequelize versions in package.json and package-lock.json for backend compatibility.

This commit is contained in:
Torsten Schulz (local)
2025-10-19 13:21:21 +02:00
parent e0a4726adb
commit da2d913219
3 changed files with 49 additions and 13 deletions

View File

@@ -27,10 +27,10 @@
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"mysql2": "^3.6.5", "mysql2": "^3.6.5",
"nodemailer": "^6.9.7", "nodemailer": "^7.0.9",
"passport": "^0.7.0", "passport": "^0.7.0",
"passport-google-oauth20": "^2.0.0", "passport-google-oauth20": "^2.0.0",
"sequelize": "^6.35.2" "sequelize": "^6.37.7"
}, },
"devDependencies": { "devDependencies": {
"nodemon": "^3.0.2" "nodemon": "^3.0.2"

View File

@@ -171,11 +171,22 @@ copy_project_files() {
CURRENT_DIR=$(pwd) CURRENT_DIR=$(pwd)
print_info "Quell-Verzeichnis: $CURRENT_DIR"
print_info "Ziel-Verzeichnis: $PROJECT_DIR"
# Erstelle Ziel-Verzeichnisse falls nicht vorhanden
mkdir -p "$BACKEND_DIR"
mkdir -p "$FRONTEND_DIR"
print_info "Kopiere Backend..." print_info "Kopiere Backend..."
rsync -a --exclude 'node_modules' "$CURRENT_DIR/backend/" "$BACKEND_DIR/" rsync -av --exclude 'node_modules' --exclude '.env' --delete "$CURRENT_DIR/backend/" "$BACKEND_DIR/"
print_info "Kopiere Frontend..." print_info "Kopiere Frontend..."
rsync -a --exclude 'node_modules' --exclude 'dist' "$CURRENT_DIR/frontend/" "$FRONTEND_DIR/" rsync -av --exclude 'node_modules' --exclude 'dist' --exclude '.env*' --delete "$CURRENT_DIR/frontend/" "$FRONTEND_DIR/"
print_info "Kopiere Root-Dateien..."
rsync -av --exclude 'node_modules' --exclude '.git' --exclude 'frontend' --exclude 'backend' \
"$CURRENT_DIR"/*.{sh,conf,md,js,json,service} "$PROJECT_DIR/" 2>/dev/null || true
print_success "Projekt-Dateien kopiert!" print_success "Projekt-Dateien kopiert!"
} }
@@ -423,11 +434,36 @@ setup_firewall() {
do_update() { do_update() {
print_header "Update $PROJECT_NAME" print_header "Update $PROJECT_NAME"
CURRENT_DIR=$(pwd)
# Prüfe ob wir im Quell-Verzeichnis sind
if [ ! -f "deploy.sh" ] || [ ! -d "backend" ] || [ ! -d "frontend" ]; then
print_error "Führe das Script aus dem Projekt-Verzeichnis aus!"
print_info "Aktuell in: $CURRENT_DIR"
print_info "Erwarte: backend/, frontend/ und deploy.sh im aktuellen Verzeichnis"
exit 1
fi
print_info "Quell-Verzeichnis: $CURRENT_DIR"
print_info "Ziel-Verzeichnis: $PROJECT_DIR"
# Backup erstellen # Backup erstellen
do_backup do_backup
# Kopiere aktualisierte Dateien
print_header "Kopiere aktualisierte Dateien"
print_info "Kopiere Backend..."
rsync -av --exclude 'node_modules' --exclude '.env' --delete "$CURRENT_DIR/backend/" "$BACKEND_DIR/"
print_info "Kopiere Frontend..."
rsync -av --exclude 'node_modules' --exclude 'dist' --exclude '.env*' --delete "$CURRENT_DIR/frontend/" "$FRONTEND_DIR/"
print_info "Kopiere Konfigurations-Dateien..."
rsync -av "$CURRENT_DIR"/*.{sh,conf,md,service} "$PROJECT_DIR/" 2>/dev/null || true
# Backend aktualisieren # Backend aktualisieren
print_info "Aktualisiere Backend..." print_info "Aktualisiere Backend Dependencies..."
cd $BACKEND_DIR cd $BACKEND_DIR
npm install --production npm install --production

16
package-lock.json generated
View File

@@ -32,10 +32,10 @@
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"mysql2": "^3.6.5", "mysql2": "^3.6.5",
"nodemailer": "^6.9.7", "nodemailer": "^7.0.9",
"passport": "^0.7.0", "passport": "^0.7.0",
"passport-google-oauth20": "^2.0.0", "passport-google-oauth20": "^2.0.0",
"sequelize": "^6.35.2" "sequelize": "^6.37.7"
}, },
"devDependencies": { "devDependencies": {
"nodemon": "^3.0.2" "nodemon": "^3.0.2"
@@ -943,9 +943,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "24.7.2", "version": "24.8.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.7.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.8.1.tgz",
"integrity": "sha512-/NbVmcGTP+lj5oa4yiYxxeBjRivKQ5Ns1eSZeB99ExsEQ6rX5XYU1Zy/gGxY/ilqtD4Etx9mKyrPxZRetiahhA==", "integrity": "sha512-alv65KGRadQVfVcG69MuB4IzdYVpRwMG/mq8KWOaoOdyY617P5ivaDiMCGOFDWD2sAn5Q0mR3mRtUOgm99hL9Q==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~7.14.0" "undici-types": "~7.14.0"
@@ -3391,9 +3391,9 @@
} }
}, },
"node_modules/nodemailer": { "node_modules/nodemailer": {
"version": "6.10.1", "version": "7.0.9",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.10.1.tgz", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.9.tgz",
"integrity": "sha512-Z+iLaBGVaSjbIzQ4pX6XV41HrooLsQ10ZWPUehGmuantvzWoDVBnmsdUcOIDM1t+yPor5pDhVlDESgOMEGxhHA==", "integrity": "sha512-9/Qm0qXIByEP8lEV2qOqcAW7bRpL8CR9jcTwk3NBnHJNmP9fIJ86g2fgmIXqHY+nj55ZEMwWqYAT2QTDpRUYiQ==",
"license": "MIT-0", "license": "MIT-0",
"engines": { "engines": {
"node": ">=6.0.0" "node": ">=6.0.0"