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:
42
deploy.sh
42
deploy.sh
@@ -171,11 +171,22 @@ copy_project_files() {
|
||||
|
||||
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..."
|
||||
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..."
|
||||
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!"
|
||||
}
|
||||
@@ -423,11 +434,36 @@ setup_firewall() {
|
||||
do_update() {
|
||||
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
|
||||
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
|
||||
print_info "Aktualisiere Backend..."
|
||||
print_info "Aktualisiere Backend Dependencies..."
|
||||
cd $BACKEND_DIR
|
||||
npm install --production
|
||||
|
||||
|
||||
Reference in New Issue
Block a user