Files
artcraft/script/bootstrap/windows/run_backend_dev.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

34 lines
1.5 KiB
PowerShell

# Run the storyteller-web backend for local development (binds 0.0.0.0:12345).
#
# Requires a bootstrapped environment (bootstrap_dev_stack.ps1). Starts the
# portable MySQL/Redis if they aren't running. Always runs from the repo root:
# the server's config search path (crates/service/web/storyteller_web/config)
# and its includes/ defaults are cwd-relative.
param()
. (Join-Path $PSScriptRoot "common.ps1")
. (Join-Path $PSScriptRoot "start_dev_services.ps1")
Start-DevMySql
Start-DevRedis
if (-not (Test-MySqlApp)) { Die "MySQL is up but '$DevMySqlUser' cannot reach '$DevMySqlDb'. Run bootstrap_dev_stack.ps1." }
if (-not (Test-Path $SecretsEnvFile)) { Die "Missing $SecretsEnvFile. Run bootstrap_dev_stack.ps1." }
Add-SessionPath @((Join-Path $env:USERPROFILE ".cargo\bin"))
# cargo run may need to (re)compile, which needs the native build toolchain.
Add-BuildToolsToSession
Push-Location $RootDir
try {
# SERVER_ENVIRONMENT defaults to Development when unset; dev config files are
# picked up from the search path automatically. SQLX_OFFLINE only affects
# compile-time query checking, never runtime. TEMP_DIR belt-and-suspenders in
# case an older generated secrets file predates the Windows TEMP_DIR line.
$env:SQLX_OFFLINE = "true"
if (-not $env:TEMP_DIR) { $env:TEMP_DIR = $env:TEMP -replace '\\', '/' }
Write-Log "Starting storyteller-web on $DevBackendUrl (Ctrl-C to stop)..."
Invoke-Native "cargo run -p storyteller-web --bin storyteller-web"
} finally {
Pop-Location
}