Files
yourpart3/deploy-yourpart-bluegreen.sh
Torsten Schulz (local) b2591da428
Some checks failed
Deploy to production / deploy (push) Failing after 1m46s
refactor(update scripts): enhance directory handling and error management
- Updated update-backend.sh and update-frontend.sh to accept a target directory as a parameter, improving flexibility.
- Refactored paths to use the target directory for all operations, ensuring consistency and reducing hardcoded values.
- Added error handling with 'set -euo pipefail' for better script reliability.
- Improved user feedback by displaying the target directory during updates.
2026-03-30 13:19:11 +02:00

24 lines
748 B
Bash
Executable File

#!/usr/bin/env bash
# Blue-Green: Deploy in einen Slot (TARGET), ohne /opt/yourpart als echtes Verzeichnis anzulegen.
# Live-Umschaltung: ln -sfn <slot> /opt/yourpart
#
# Aufruf (auf dem Server, im Repo-Root nach git pull):
# ./deploy-yourpart-bluegreen.sh /opt/yourpart-green
#
# Voraussetzung: /opt/yourpart ist ein Symlink auf den aktiven Slot.
set -euo pipefail
CURRENT_LINK="${CURRENT_LINK:-/opt/yourpart}"
TARGET="${1:?Ziel-Slot-Verzeichnis fehlt (z. B. /opt/yourpart-green)}"
if [ ! -L "$CURRENT_LINK" ]; then
echo "❌ ERROR: $CURRENT_LINK ist kein Symlink! (Blue-Green erfordert Symlink auf den aktiven Slot.)" >&2
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
exec ./update.sh "$TARGET"