mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-25 10:39:37 +00:00
07e9a35044
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.
53 lines
2.0 KiB
PowerShell
53 lines
2.0 KiB
PowerShell
# Start (or verify) the portable MySQL and Redis processes under .devstack/.
|
|
# Idempotent: already-running services are left alone. Safe to call from other
|
|
# scripts via dot-sourcing (defines Start-DevMySql / Start-DevRedis) or run
|
|
# directly.
|
|
param()
|
|
|
|
. (Join-Path $PSScriptRoot "common.ps1")
|
|
|
|
function Start-DevMySql {
|
|
if (Test-TcpPort 3306) {
|
|
Write-Log "MySQL already listening on 3306."
|
|
return
|
|
}
|
|
$mysqld = Join-Path $MySqlBaseDir "bin\mysqld.exe"
|
|
if (-not (Test-Path $mysqld)) {
|
|
Die "Portable MySQL not installed at $MySqlBaseDir. Run bootstrap_dev_stack.ps1 first."
|
|
}
|
|
if (-not (Test-Path (Join-Path $MySqlDataDir "mysql"))) {
|
|
Die "MySQL data directory not initialized at $MySqlDataDir. Run bootstrap_dev_stack.ps1 first."
|
|
}
|
|
Write-Log "Starting mysqld (portable, data in .devstack\mysql-data)..."
|
|
Start-DevProcess -Name "mysqld" -Exe $mysqld -Arguments @("--defaults-file=`"$MySqlIniPath`"") | Out-Null
|
|
Wait-ForCondition { Test-TcpPort 3306 } 60 "MySQL to listen on 3306 (see $LogsDir\mysqld.err.log and the .err file in $MySqlDataDir)" | Out-Null
|
|
Write-Log "MySQL is up."
|
|
}
|
|
|
|
function Start-DevRedis {
|
|
if (Test-TcpPort 6379) {
|
|
Write-Log "Redis already listening on 6379."
|
|
return
|
|
}
|
|
$redis = Join-Path $RedisDir "redis-server.exe"
|
|
if (-not (Test-Path $redis)) {
|
|
Die "Portable Redis not installed at $RedisDir. Run bootstrap_dev_stack.ps1 first."
|
|
}
|
|
Write-Log "Starting redis-server (portable)..."
|
|
# Keep the working dir (dump.rdb etc.) inside .devstack. NB: Start-Process
|
|
# rejects empty-string ArgumentList elements, so pass `--save ""` as one
|
|
# token to disable snapshotting.
|
|
Start-DevProcess -Name "redis" -Exe $redis -Arguments @(
|
|
"--port", "6379",
|
|
"--save", "`"`"",
|
|
"--dir", "`"$RedisDir`""
|
|
) | Out-Null
|
|
Wait-ForCondition { Test-TcpPort 6379 } 30 "Redis to listen on 6379 (see $LogsDir\redis.err.log)" | Out-Null
|
|
Write-Log "Redis is up."
|
|
}
|
|
|
|
if ($MyInvocation.InvocationName -ne '.') {
|
|
Start-DevMySql
|
|
Start-DevRedis
|
|
}
|