diff --git a/deploy/scripts/check-native-vps-health.sh b/deploy/scripts/check-native-vps-health.sh index cc4dc51..24c2c6e 100644 --- a/deploy/scripts/check-native-vps-health.sh +++ b/deploy/scripts/check-native-vps-health.sh @@ -35,7 +35,15 @@ for protected_service in x-ui.service callsnif.service vpn-misa-bot.service; do fi done -if curl --fail --silent --show-error --max-time 15 "${PUBLIC_BASE_URL%/}/healthz" >/dev/null; then +health_ready=0 +for _attempt in {1..10}; do + if curl --fail --silent --max-time 15 "${PUBLIC_BASE_URL%/}/healthz" >/dev/null; then + health_ready=1 + break + fi + sleep 2 +done +if [ "${health_ready}" -eq 1 ]; then printf 'OK %s/healthz\n' "${PUBLIC_BASE_URL%/}" else printf 'FAIL %s/healthz\n' "${PUBLIC_BASE_URL%/}" >&2 diff --git a/docs/releases/v0.3.1.md b/docs/releases/v0.3.1.md new file mode 100644 index 0000000..4d2068f --- /dev/null +++ b/docs/releases/v0.3.1.md @@ -0,0 +1,9 @@ +# Borotalk v0.3.1 — исправление VPS bundle + +Патч исправляет переносы строк Linux-файлов в нативном VPS-установщике, +собранном на Windows. + +- shell entrypoints и конфигурация systemd/Nginx/coturn всегда упаковываются с + LF-переносами; +- сборка автоматически распаковывает и проверяет критичные entrypoints; +- функциональность v0.3.0 и формат установки не изменились. diff --git a/scripts/Build-NativeVpsBundle.ps1 b/scripts/Build-NativeVpsBundle.ps1 index 623071d..f2005a5 100644 --- a/scripts/Build-NativeVpsBundle.ps1 +++ b/scripts/Build-NativeVpsBundle.ps1 @@ -29,6 +29,17 @@ try { $targetPath = Join-Path $stagingRoot $relativePath New-Item -ItemType Directory -Path (Split-Path -Parent $targetPath) -Force | Out-Null Copy-Item -LiteralPath $sourcePath -Destination $targetPath + # Git may check files out with CRLF on Windows. Linux entrypoints and + # systemd/nginx/coturn configuration must be packaged with LF endings. + if ($relativePath -like "*.sh" -or $relativePath -like "deploy/native/*") { + $bytes = [System.IO.File]::ReadAllBytes($targetPath) + $text = [System.Text.Encoding]::UTF8.GetString($bytes).Replace("`r`n", "`n") + [System.IO.File]::WriteAllText( + $targetPath, + $text, + [System.Text.UTF8Encoding]::new($false) + ) + } } tar -czf $archivePath -C $stagingRoot . @@ -46,6 +57,19 @@ try { if ("./.env" -in $archiveListing -or "./.env.local-vps" -in $archiveListing) { throw "Refusing to include a local environment file in the VPS bundle." } + $validationRoot = Join-Path $temporaryRoot "validation" + New-Item -ItemType Directory -Path $validationRoot -Force | Out-Null + tar -xzf $archivePath -C $validationRoot ./INSTALL_VPS_NATIVE.sh ./deploy/scripts/backup-native-data.sh + if ($LASTEXITCODE -ne 0) { throw "Could not validate Linux entrypoints." } + foreach ($entrypoint in @( + (Join-Path $validationRoot "INSTALL_VPS_NATIVE.sh"), + (Join-Path $validationRoot "deploy/scripts/backup-native-data.sh") + )) { + $bytes = [System.IO.File]::ReadAllBytes($entrypoint) + if ($bytes -contains 13) { + throw "Linux entrypoint contains a carriage return: $entrypoint" + } + } $header = @' #!/usr/bin/env bash