mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-25 18:49:38 +00:00
537409eb3e
Adds script/bootstrap/ — idempotent Ubuntu 22.04+/WSL2/CI automation that takes a fresh clone to a running local stack with zero production traffic: - bootstrap_dev_stack.sh: apt packages, MySQL 8 + Redis up, storyteller DB/user, 281 diesel migrations, idempotent role/badge seeds, generated dummy development-secrets.env (19 required-at-boot vars no checked-in config supplies), SQLX_OFFLINE backend build, frontend npm install - run_backend_dev.sh / seed_demo_user.sh: run the API from the repo root and create+verify a demo login through the real POST /v1/create_account path - dev_stack_doctor.sh: PASS/WARN/FAIL diagnosis of every prerequisite _docs/dev_setup_local_stack.md records the requirements the scripts encode and corrects stale claims (server reads MYSQL_URL, not DATABASE_URL; repo-root .env is not loaded by the server; config precedence is first-value-wins; SQLX_OFFLINE is compile-time only). .gitattributes now forces LF for *.sh/*.env so Windows clones run under WSL2.
27 lines
1.3 KiB
Bash
Executable File
27 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run the storyteller-web backend for local development (binds 0.0.0.0:12345).
|
|
#
|
|
# Must run from a bootstrapped environment (./script/bootstrap/bootstrap_dev_stack.sh).
|
|
# Always runs from the repo root: the server's config search path
|
|
# (crates/service/web/storyteller_web/config/*.env) and its includes/ defaults
|
|
# are cwd-relative.
|
|
set -euo pipefail
|
|
|
|
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
source "${root_dir}/script/bootstrap/common.sh"
|
|
|
|
SECRETS_ENV_FILE="${root_dir}/crates/service/web/storyteller_web/config/storyteller-web.development-secrets.env"
|
|
|
|
mysql_app_reachable || die "MySQL is not reachable as '${DEV_MYSQL_USER}'. Run ./script/bootstrap/bootstrap_dev_stack.sh first."
|
|
redis_reachable || die "Redis is not reachable. Run ./script/bootstrap/bootstrap_dev_stack.sh first."
|
|
[ -f "${SECRETS_ENV_FILE}" ] || die "Missing ${SECRETS_ENV_FILE}. Run ./script/bootstrap/bootstrap_dev_stack.sh first."
|
|
|
|
ensure_cargo_on_path
|
|
cd "${root_dir}"
|
|
|
|
# SERVER_ENVIRONMENT defaults to Development when unset (bootstrap.rs), and the
|
|
# dev config files are picked up from the search path automatically.
|
|
# SQLX_OFFLINE only affects compile-time query checking, never runtime.
|
|
log "Starting storyteller-web on ${DEV_BACKEND_URL} (Ctrl-C to stop)..."
|
|
exec env SQLX_OFFLINE=true cargo run -p storyteller-web --bin storyteller-web
|