mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-26 02:59:37 +00:00
f23a6df80b
Pass 1 (correctness sweep): - All native invocations (mysql, mysqld init, winget, curl downloads, cargo run, seed curl) now go through Invoke-Native, so a caller capturing the scripts' output can never turn ordinary stderr (warnings, progress) into a terminating NativeCommandError under Stop preference - Provisioning DDL feeds through a temp file + `source` and prints the mysql output when it fails (with the MYSQL_ROOT_PASSWORD hint) - Get-MySqlCount distinguishes "table empty" (0) from "query failed" (-1); bootstrap and doctor no longer misread a failed COUNT as unseeded - diesel_cli that is present but broken (moved libmysql.dll) is detected via an exit-code probe and reinstalled with --force - Shared Add-BuildToolsToSession maps winget install dirs + LIBCLANG_PATH in bootstrap, doctor, and run_backend_dev (cargo run may recompile); the tools check maps PATH before probing so re-runs skip winget entirely - my.ini values quoted (clone paths with spaces); service-start timeouts point at the .devstack log files Pass 2 (live retest matrix, all green on this machine): - Full re-run with output captured in-PowerShell: exit 0, no NativeCommandError - Wiped-state rebuild (mysql-data/my.ini/redis/secrets deleted): re-init, re-provision, 281 migrations replayed, seeds + secrets regenerated, backend booted, demo user recreated via /v1/create_account, doctor 0 fail / 0 warn - Failure paths: seed without backend and doctor without services both die cleanly with actionable messages and exit 1; stop_dev_services frees both ports gracefully
34 lines
1.5 KiB
PowerShell
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
|
|
}
|