Add explicit SSH pull and migration verification flow
This commit is contained in:
@@ -21,3 +21,21 @@ git push origin --all
|
||||
echo "✅ Done! On the production server run:"
|
||||
echo " git pull"
|
||||
echo " (and if websocket server changed: php backend/websocket/server.php restart -d)"
|
||||
|
||||
# Optional remote continuation. Never guesses a host and never applies DDL
|
||||
# unless the operator explicitly opts in after seeing status and dry-run.
|
||||
if [ -n "${DEPLOY_SSH_TARGET:-}" ]; then
|
||||
APP_DIR="${DEPLOY_APP_DIR:-/var/www/saqel}"
|
||||
echo "🔐 Updating remote work tree: ${DEPLOY_SSH_TARGET}:${APP_DIR}"
|
||||
ssh "$DEPLOY_SSH_TARGET" "cd $(printf '%q' "$APP_DIR") && git pull --ff-only origin main"
|
||||
echo "🔎 Remote migration status"
|
||||
ssh "$DEPLOY_SSH_TARGET" "cd $(printf '%q' "$APP_DIR") && php backend/scripts/run_migrations.php --status"
|
||||
echo "🧪 Remote migration dry-run"
|
||||
ssh "$DEPLOY_SSH_TARGET" "cd $(printf '%q' "$APP_DIR") && php backend/scripts/run_migrations.php --dry-run"
|
||||
if [ "${DEPLOY_RUN_MIGRATIONS:-0}" = "1" ]; then
|
||||
echo "🚧 Applying remote migrations by explicit opt-in"
|
||||
ssh "$DEPLOY_SSH_TARGET" "cd $(printf '%q' "$APP_DIR") && php backend/scripts/run_migrations.php"
|
||||
else
|
||||
echo "⏸️ Migrations were not applied. Set DEPLOY_RUN_MIGRATIONS=1 after reviewing dry-run."
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user