From f9851e3b4ca4d224faec8c27969321626f3252e2 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Wed, 9 Sep 2026 17:04:52 +0300 Subject: [PATCH] Add explicit SSH pull and migration verification flow --- deploy.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/deploy.sh b/deploy.sh index 9fd41e3..a724be2 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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