22 lines
1.4 KiB
PowerShell
22 lines
1.4 KiB
PowerShell
# Windows PowerShell 5.1+ version of scripts/reset.sh: INTENTIONAL deletion of lab7 data (asks for confirmation).
|
|
# Removes all project volumes (PostgreSQL, S3, NATS, OpenBao raft+audit, Prometheus/Loki/Tempo/Grafana), the OpenBao
|
|
# operator material (it belongs to the deleted storage) and issued role_id/SecretID (secrets\bao). PKI and passwords in
|
|
# secrets\ are kept; the next scripts\up.ps1 initializes OpenBao again. Normal stop without data loss:
|
|
# docker compose --env-file .env --profile ttl --profile fault --profile tools --profile tests down --remove-orphans
|
|
# powershell -NoProfile -ExecutionPolicy Bypass -File scripts\reset.ps1 [-Force]
|
|
param([switch]$Force)
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
Set-Location $root
|
|
$op = $env:MTUSI_OPERATOR_DIR
|
|
if (-not $op) { $op = Join-Path $env:USERPROFILE '.mtusi-lab7-operator' }
|
|
if (-not $Force) {
|
|
$ans = Read-Host "Delete ALL lab7 data (volumes, $op\openbao-init.json, secrets\bao)? Type yes"
|
|
if ($ans -ne 'yes') { Write-Output 'cancelled'; exit 1 }
|
|
}
|
|
& docker compose --env-file .env --profile ttl --profile fault --profile tools --profile tests down -v --remove-orphans
|
|
if ($LASTEXITCODE -ne 0) { throw 'docker compose down -v failed' }
|
|
Remove-Item -Force -ErrorAction SilentlyContinue (Join-Path $op 'openbao-init.json')
|
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue 'secrets\bao'
|
|
Write-Output 'data deleted; start again: scripts\up.ps1'
|