Some checks failed
Deploy to production / deploy (push) Failing after 1m46s
- 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.
24 lines
748 B
Bash
Executable File
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"
|