Files
artcraft/script/bootstrap/windows/stop_dev_services.ps1
Tanish Manku 07e9a35044 Add portable local MySQL/Redis bootstrap scripts for backend dev
Brings up a fully local storyteller-web: portable MySQL 8.4 and Redis under a
gitignored .devstack/ (plain user processes -- no admin, no services, no WSL,
no Docker), all 281 migrations, role/badge seeds, and a demo login with
credits. Windows and Linux variants, plus a doctor that reports what is and
isn't healthy.

Scripts and docs only. Nothing here is compiled into any binary, and no
application behaviour changes: the backend it starts is the one that ships.

Integrations that cannot be provided locally -- object storage, generation
providers, email -- get placeholder credentials, so those endpoints fail when
exercised. Swap in a real dev credential for the one you are working on. The
doc records exactly which areas that leaves working.

An earlier revision closed those gaps with development-only behaviour inside
storyteller-web (DEV_FAKE_GENERATION, a filesystem bucket mode, a CDN_BASE_URL
override). That is deliberately not here: a switch that exists in the shipped
binary can be flipped. Frontend work that wants a populated, working stack
should use frontend/apps/fake-storyteller-web instead.
2026-08-03 14:41:14 -07:00

42 lines
1.4 KiB
PowerShell

# Stop the portable MySQL and Redis processes started by start_dev_services.ps1.
param()
. (Join-Path $PSScriptRoot "common.ps1")
# Graceful MySQL shutdown (flushes InnoDB) - root has no password in the
# portable install (initialized with --initialize-insecure).
if (Test-TcpPort 3306) {
$mysqladmin = Get-MySqlTool "mysqladmin"
if ($mysqladmin) {
Write-Log "Shutting down MySQL..."
try { & $mysqladmin -u root -h 127.0.0.1 shutdown 2>$null } catch {}
$deadline = (Get-Date).AddSeconds(30)
while ((Test-TcpPort 3306) -and ((Get-Date) -lt $deadline)) { Start-Sleep -Seconds 1 }
}
}
if (Test-TcpPort 6379) {
$cli = Get-RedisTool "redis-cli"
if ($cli) {
Write-Log "Shutting down Redis..."
try { & $cli -h 127.0.0.1 shutdown nosave 2>$null } catch {}
}
}
# Last resort: kill anything left via recorded PIDs.
if (Test-Path $PidsDir) {
foreach ($pidFile in Get-ChildItem $PidsDir -Filter "*.pid" -ErrorAction SilentlyContinue) {
$procId = Get-Content $pidFile.FullName -ErrorAction SilentlyContinue
if ($procId) {
$proc = Get-Process -Id $procId -ErrorAction SilentlyContinue
if ($proc -and -not $proc.HasExited) {
Write-Log "Force-stopping $($pidFile.BaseName) (pid $procId)..."
try { Stop-Process -Id $procId -Force -Confirm:$false -ErrorAction Stop } catch {}
}
}
Remove-Item $pidFile.FullName -Force -Confirm:$false -ErrorAction SilentlyContinue
}
}
Write-Log "Dev services stopped."