Files
mtusi2026lab4/scripts/make_secrets.ps1
T
daniil_sobolev 747ca222e5 Implement lab4 attachments on RustFS for grade 4.
Carry over lab3 HA stack and add private S3 storage, Attachment API, orphan compensation/reaper, own tests, and evidence for smoke/persistence/failover.
2026-11-12 20:41:02 +03:00

20 lines
1.1 KiB
PowerShell

# Creates local synthetic secrets for compose (never commit secrets/).
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$secrets = Join-Path $root "secrets"
New-Item -ItemType Directory -Force -Path $secrets | Out-Null
$password = "lab2-pg-pass-" + [guid]::NewGuid().ToString("N").Substring(0, 12)
Set-Content -Path (Join-Path $secrets "postgres_password") -Value $password -NoNewline
$dbUrl = "postgresql://messenger:${password}@postgres:5432/messenger"
Set-Content -Path (Join-Path $secrets "database_url") -Value $dbUrl -NoNewline
Set-Content -Path (Join-Path $secrets "cache_url") -Value "redis://redis:6379/0" -NoNewline
# Dedicated non-default S3 credentials for API (not built-in rustfs defaults).
$apiKey = "messengerapi" + [guid]::NewGuid().ToString("N").Substring(0, 8)
$apiSecret = "s3-api-" + [guid]::NewGuid().ToString("N")
Set-Content -Path (Join-Path $secrets "s3_access_key_id") -Value $apiKey -NoNewline
Set-Content -Path (Join-Path $secrets "s3_secret_access_key") -Value $apiSecret -NoNewline
Write-Host "Wrote secrets/postgres_password, secrets/database_url, secrets/cache_url, secrets/s3_*"