15 lines
458 B
Bash
Executable file
15 lines
458 B
Bash
Executable file
#!/bin/bash
|
|
# Roll back the production deployment to the previous release.
|
|
set -euo pipefail
|
|
|
|
DEPLOY_HOST="prod.nexus.local"
|
|
PREVIOUS=$(ssh deploy@"$DEPLOY_HOST" "ls -1dt /opt/releases/*/ | sed -n '2p'")
|
|
|
|
if [ -z "$PREVIOUS" ]; then
|
|
echo "[rollback] No previous release found." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "[rollback] Rolling back to: $PREVIOUS"
|
|
ssh deploy@"$DEPLOY_HOST" "ln -sfn '$PREVIOUS' /opt/app && systemctl restart nexus-app"
|
|
echo "[rollback] Done."
|