fix(ops): send apikey with push drain, read the web push public key from release/, record 2026-11-17 backlog evidence
The scheduled push drain got HTTP 401 because modern Supabase service keys need the apikey header next to Bearer. NAS deploy scripts fall back to release/webpush-vapid-public.key (public key only). Map, mobile SSOT and deployment runbooks are synced with the verified operations run in docs/evidence/2026-11-17-backlog-operations.md.
This commit is contained in:
parent
8d8aaf5794
commit
6791e29f27
16 changed files with 254 additions and 96 deletions
|
|
@ -9,7 +9,10 @@ param (
|
|||
[int]$NasSshPort = 0,
|
||||
[string]$NasPath = "",
|
||||
[int]$Port = 0,
|
||||
[ValidateSet("api", "admin", "web")]
|
||||
[string[]]$Services = @("api", "admin", "web"),
|
||||
[switch]$SkipBuild = $false,
|
||||
[switch]$BuildOnly = $false,
|
||||
[switch]$DeploySsh = $false
|
||||
)
|
||||
|
||||
|
|
@ -58,56 +61,71 @@ if (-not (Test-Path $nasPkgDir)) {
|
|||
|
||||
# 2. Build Docker Image
|
||||
if (-not $SkipBuild) {
|
||||
Write-Host "`n[1/4] Building D3RO Voice API Image..." -ForegroundColor Yellow
|
||||
docker build -t d3ro-voice-api:latest ./apps/api-server
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "API Docker image build failed!"
|
||||
exit 1
|
||||
if ($Services -contains "api") {
|
||||
Write-Host "`n[1/4] Building D3RO Voice API Image..." -ForegroundColor Yellow
|
||||
docker build -t d3ro-voice-api:latest ./apps/api-server
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "API Docker image build failed!"
|
||||
exit 1
|
||||
}
|
||||
Write-Host " Docker image built: d3ro-voice-api:latest" -ForegroundColor Green
|
||||
}
|
||||
Write-Host " Docker image built: d3ro-voice-api:latest" -ForegroundColor Green
|
||||
|
||||
Write-Host "`n[1.5/4] Building D3RO Voice Next.js Admin CRM Image..." -ForegroundColor Yellow
|
||||
docker build -t d3ro-voice-admin:latest -f apps/admin/Dockerfile .
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Admin Docker image build failed!"
|
||||
exit 1
|
||||
if ($Services -contains "admin") {
|
||||
Write-Host "`n[1.5/4] Building D3RO Voice Next.js Admin CRM Image..." -ForegroundColor Yellow
|
||||
docker build -t d3ro-voice-admin:latest -f apps/admin/Dockerfile .
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Admin Docker image build failed!"
|
||||
exit 1
|
||||
}
|
||||
Write-Host " Docker image built: d3ro-voice-admin:latest" -ForegroundColor Green
|
||||
}
|
||||
Write-Host " Docker image built: d3ro-voice-admin:latest" -ForegroundColor Green
|
||||
|
||||
# Web app (@d3ro/web, served at /app). NEXT_PUBLIC_* values are baked in at build time.
|
||||
Write-Host "`n[1.6/4] Building D3RO Voice Next.js Web App Image..." -ForegroundColor Yellow
|
||||
$webBuildArgs = @()
|
||||
foreach ($name in @("NEXT_PUBLIC_SUPABASE_URL", "NEXT_PUBLIC_SUPABASE_ANON_KEY", "NEXT_PUBLIC_PAYPLE_CLIENT_KEY", "NEXT_PUBLIC_VAPID_PUBLIC_KEY")) {
|
||||
$value = if ($envDict.ContainsKey($name)) { $envDict[$name] } else { [Environment]::GetEnvironmentVariable($name) }
|
||||
if ($name -eq "NEXT_PUBLIC_VAPID_PUBLIC_KEY" -and [string]::IsNullOrWhiteSpace($value)) {
|
||||
$value = if ($envDict.ContainsKey("WEBPUSH_VAPID_PUBLIC_KEY")) { $envDict["WEBPUSH_VAPID_PUBLIC_KEY"] } else { [Environment]::GetEnvironmentVariable("WEBPUSH_VAPID_PUBLIC_KEY") }
|
||||
}
|
||||
if ([string]::IsNullOrWhiteSpace($value)) {
|
||||
if ($name -eq "NEXT_PUBLIC_PAYPLE_CLIENT_KEY") {
|
||||
Write-Warning "$name is empty: the web app will build with Payple checkout disabled."
|
||||
continue
|
||||
if ($Services -contains "web") {
|
||||
# Web app (@d3ro/web, served at /app). NEXT_PUBLIC_* values are baked in at build time.
|
||||
Write-Host "`n[1.6/4] Building D3RO Voice Next.js Web App Image..." -ForegroundColor Yellow
|
||||
$webBuildArgs = @()
|
||||
foreach ($name in @("NEXT_PUBLIC_SUPABASE_URL", "NEXT_PUBLIC_SUPABASE_ANON_KEY", "NEXT_PUBLIC_PAYPLE_CLIENT_KEY", "NEXT_PUBLIC_VAPID_PUBLIC_KEY")) {
|
||||
$value = if ($envDict.ContainsKey($name)) { $envDict[$name] } else { [Environment]::GetEnvironmentVariable($name) }
|
||||
if ($name -eq "NEXT_PUBLIC_VAPID_PUBLIC_KEY" -and [string]::IsNullOrWhiteSpace($value)) {
|
||||
$value = if ($envDict.ContainsKey("WEBPUSH_VAPID_PUBLIC_KEY")) { $envDict["WEBPUSH_VAPID_PUBLIC_KEY"] } else { [Environment]::GetEnvironmentVariable("WEBPUSH_VAPID_PUBLIC_KEY") }
|
||||
}
|
||||
if ($name -eq "NEXT_PUBLIC_VAPID_PUBLIC_KEY") {
|
||||
Write-Warning "$name is empty: browser notifications will stay unavailable and fail closed."
|
||||
continue
|
||||
if ($name -eq "NEXT_PUBLIC_VAPID_PUBLIC_KEY" -and [string]::IsNullOrWhiteSpace($value)) {
|
||||
$publicKeyPath = Join-Path $PSScriptRoot "..\release\webpush-vapid-public.key"
|
||||
if (Test-Path -LiteralPath $publicKeyPath) { $value = (Get-Content -LiteralPath $publicKeyPath -Raw).Trim() }
|
||||
}
|
||||
throw "$name is required to build the web app image."
|
||||
if ([string]::IsNullOrWhiteSpace($value)) {
|
||||
if ($name -eq "NEXT_PUBLIC_PAYPLE_CLIENT_KEY") {
|
||||
Write-Warning "$name is empty: the web app will build with Payple checkout disabled."
|
||||
continue
|
||||
}
|
||||
if ($name -eq "NEXT_PUBLIC_VAPID_PUBLIC_KEY") {
|
||||
Write-Warning "$name is empty: browser notifications will stay unavailable and fail closed."
|
||||
continue
|
||||
}
|
||||
throw "$name is required to build the web app image."
|
||||
}
|
||||
if ($value.Contains("`r") -or $value.Contains("`n")) {
|
||||
throw "$name must be a single-line value."
|
||||
}
|
||||
$webBuildArgs += @("--build-arg", "$name=$value")
|
||||
}
|
||||
if ($value.Contains("`r") -or $value.Contains("`n")) {
|
||||
throw "$name must be a single-line value."
|
||||
docker build -t d3ro-voice-web:latest -f apps/web/Dockerfile @webBuildArgs .
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Web Docker image build failed!"
|
||||
exit 1
|
||||
}
|
||||
$webBuildArgs += @("--build-arg", "$name=$value")
|
||||
Write-Host " Docker image built: d3ro-voice-web:latest" -ForegroundColor Green
|
||||
}
|
||||
docker build -t d3ro-voice-web:latest -f apps/web/Dockerfile @webBuildArgs .
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Web Docker image build failed!"
|
||||
exit 1
|
||||
}
|
||||
Write-Host " Docker image built: d3ro-voice-web:latest" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "`n[1/4] Skipping Docker build (-SkipBuild specified)" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
if ($BuildOnly) {
|
||||
Write-Host "Remote/local Docker image build completed (-BuildOnly)." -ForegroundColor Green
|
||||
return
|
||||
}
|
||||
|
||||
# 3. Export Docker Image Archives
|
||||
$tarPath = Join-Path $nasPkgDir "d3ro-voice-api.tar"
|
||||
$adminTarPath = Join-Path $nasPkgDir "d3ro-voice-admin.tar"
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ if [ -z "${NEXT_PUBLIC_PAYPLE_CLIENT_KEY:-}" ]; then
|
|||
echo -e "${YELLOW}NEXT_PUBLIC_PAYPLE_CLIENT_KEY is empty: Payple checkout will be disabled in the web app.${NC}"
|
||||
fi
|
||||
WEB_VAPID_PUBLIC_KEY="${NEXT_PUBLIC_VAPID_PUBLIC_KEY:-${WEBPUSH_VAPID_PUBLIC_KEY:-}}"
|
||||
if [ -z "$WEB_VAPID_PUBLIC_KEY" ] && [ -f "$ROOT_DIR/release/webpush-vapid-public.key" ]; then
|
||||
IFS= read -r WEB_VAPID_PUBLIC_KEY < "$ROOT_DIR/release/webpush-vapid-public.key"
|
||||
fi
|
||||
if [ -z "$WEB_VAPID_PUBLIC_KEY" ]; then
|
||||
echo -e "${YELLOW}NEXT_PUBLIC_VAPID_PUBLIC_KEY is empty: browser notifications will stay unavailable and fail closed.${NC}"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue