mirror of
https://codeberg.org/likwid/likwid.git
synced 2026-02-10 05:23:09 +00:00
60 lines
2 KiB
PowerShell
60 lines
2 KiB
PowerShell
|
|
# Demo Reset Script (Windows PowerShell)
|
||
|
|
# Resets the demo instance to a clean state with fresh seed data
|
||
|
|
|
||
|
|
param(
|
||
|
|
[switch]$Force
|
||
|
|
)
|
||
|
|
|
||
|
|
$ErrorActionPreference = "Stop"
|
||
|
|
|
||
|
|
Write-Host "=== Likwid Demo Reset ===" -ForegroundColor Cyan
|
||
|
|
|
||
|
|
if (-not $Force) {
|
||
|
|
$confirm = Read-Host "This will DELETE all demo data and reset to initial state. Continue? (y/N)"
|
||
|
|
if ($confirm -ne "y" -and $confirm -ne "Y") {
|
||
|
|
Write-Host "Aborted." -ForegroundColor Yellow
|
||
|
|
exit 0
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Set-Location "$PSScriptRoot\.."
|
||
|
|
|
||
|
|
Write-Host "`n[1/4] Stopping demo containers..." -ForegroundColor Yellow
|
||
|
|
podman-compose -f compose/demo.yml down
|
||
|
|
|
||
|
|
Write-Host "`n[2/4] Removing demo database volume..." -ForegroundColor Yellow
|
||
|
|
podman volume rm likwid_demo_data -f 2>$null
|
||
|
|
|
||
|
|
Write-Host "`n[3/4] Starting fresh demo instance..." -ForegroundColor Yellow
|
||
|
|
podman-compose -f compose/demo.yml up -d
|
||
|
|
|
||
|
|
Write-Host "`n[4/4] Waiting for services to be ready..." -ForegroundColor Yellow
|
||
|
|
Start-Sleep -Seconds 10
|
||
|
|
|
||
|
|
# Check if backend is responding
|
||
|
|
$maxRetries = 30
|
||
|
|
$retry = 0
|
||
|
|
while ($retry -lt $maxRetries) {
|
||
|
|
try {
|
||
|
|
$response = Invoke-WebRequest -Uri "http://localhost:3001/health" -UseBasicParsing -TimeoutSec 2
|
||
|
|
if ($response.StatusCode -eq 200) {
|
||
|
|
Write-Host "`n=== Demo Reset Complete ===" -ForegroundColor Green
|
||
|
|
Write-Host "`nDemo is ready at:"
|
||
|
|
Write-Host " Frontend: http://localhost:4322" -ForegroundColor Cyan
|
||
|
|
Write-Host " Backend: http://localhost:3001" -ForegroundColor Cyan
|
||
|
|
Write-Host "`nDemo accounts (password: demo123):"
|
||
|
|
Write-Host " - contributor (standard member)"
|
||
|
|
Write-Host " - moderator (can moderate)"
|
||
|
|
Write-Host " - observer (read-only)"
|
||
|
|
exit 0
|
||
|
|
}
|
||
|
|
} catch {
|
||
|
|
$retry++
|
||
|
|
Write-Host "." -NoNewline
|
||
|
|
Start-Sleep -Seconds 1
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host "`nWarning: Backend health check timed out. Check logs with:" -ForegroundColor Yellow
|
||
|
|
Write-Host " podman-compose -f compose/demo.yml logs backend"
|