From 87675d0f88b78ddf69d8a1e085dcc340cbb78eb4 Mon Sep 17 00:00:00 2001 From: romanskijdev Date: Wed, 23 Sep 2026 12:25:32 +0300 Subject: [PATCH] Update proxy --- deploy.sh | 43 ++++++++++--------------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/deploy.sh b/deploy.sh index 9124938..644015f 100644 --- a/deploy.sh +++ b/deploy.sh @@ -279,40 +279,17 @@ EOF log_info "Running migrations..." - systemctl start "$SERVICE_NAME" --no-block + # Сбрасываем старые состояния юнита + systemctl reset-failed "$SERVICE_NAME" || true - TIMEOUT=300 - ELAPSED=0 - - log_info "Waiting for migrations to complete successfully..." - while true; do - if journalctl -u "$SERVICE_NAME" --since "2 minutes ago" --no-pager | grep -q "Database migration completed successfully"; then - echo "" - log_success "Migrations completed successfully (detected via logs)!" - systemctl stop "$SERVICE_NAME" --quiet || true - break - fi - - if systemctl show "$SERVICE_NAME" --property=ActiveState --value | grep -q "failed"; then - echo "" - RESULT=$(systemctl show "$SERVICE_NAME" --property=ExecMainStatus --value) - log_error "Migrations failed with exit code: $RESULT" - journalctl -u "$SERVICE_NAME" -n 50 --no-pager - exit 1 - fi - - sleep 5 - ELAPSED=$((ELAPSED + 5)) - printf "." - - if [ $ELAPSED -ge $TIMEOUT ]; then - echo "" - log_error "Migrations timed out after ${TIMEOUT}s" - journalctl -u "$SERVICE_NAME" -n 50 --no-pager - exit 1 - fi - done - echo "" + # Запускаем и ждем завершения (так как Type=oneshot, команда block вернет код выхода программы) + if systemctl start "$SERVICE_NAME"; then + log_success "Migrations completed successfully!" + else + log_error "Migrations failed!" + journalctl -u "$SERVICE_NAME" -n 50 --no-pager + exit 1 + fi fi echo "════════════════════════════════════════"