Update proxy

This commit is contained in:
romanskijdev 2026-09-23 12:25:32 +03:00
parent 4096895f7d
commit 87675d0f88
1 changed files with 10 additions and 33 deletions

View File

@ -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 "════════════════════════════════════════"