videogen/scripts/dev-bootstrap.sh
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

97 lines
3.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# =============================================================================
# ReelForge developer bootstrap — NEW file.
#
# One-shot local setup for running the backend WITHOUT Docker (the full Docker
# stack is `make -f Makefile.dev up`). It:
# 1. Creates a Python virtualenv (.venv) — prefers `uv`, falls back to python -m venv.
# 2. Installs dependencies from requirements.txt (via uv or pip).
# 3. Copies .env.full.example -> .env.full if missing (placeholders only).
# 4. Applies DB migrations (`alembic upgrade head`) when NEON_DATABASE_URL is set.
#
# It NEVER overwrites an existing .env.full and NEVER prints secrets. Safe to
# re-run (idempotent).
#
# Usage:
# ./scripts/dev-bootstrap.sh
# =============================================================================
set -euo pipefail
log() { printf '\033[36m[bootstrap]\033[0m %s\n' "$*"; }
warn() { printf '\033[33m[bootstrap]\033[0m %s\n' "$*" >&2; }
# Resolve the repo root as the parent of this script's directory, so the script
# works regardless of the caller's current working directory.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
cd "${REPO_ROOT}"
HAVE_UV=0
if command -v uv >/dev/null 2>&1; then
HAVE_UV=1
fi
# --- 1 + 2. venv + dependency install ---------------------------------------
if [ "${HAVE_UV}" -eq 1 ]; then
log "uv detected — creating venv + syncing dependencies with uv."
uv venv .venv
if [ -f uv.lock ]; then
log "Installing from uv.lock (uv sync)."
uv sync || uv pip install -r requirements.txt
else
uv pip install -r requirements.txt
fi
else
log "uv not found — using python venv + pip."
PY="$(command -v python3 || command -v python)"
if [ -z "${PY}" ]; then
warn "No python interpreter found on PATH. Install Python 3.11+ and retry."
exit 1
fi
"${PY}" -m venv .venv
# shellcheck disable=SC1091
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
fi
# --- 3. env file ------------------------------------------------------------
if [ -f .env.full ]; then
log ".env.full already exists — leaving it untouched."
else
cp .env.full.example .env.full
log "Created .env.full from .env.full.example (placeholders only — edit as needed)."
fi
# Load NEON_DATABASE_URL from .env.full for the migration step (without exporting
# secrets to the terminal). Only NEON_DATABASE_URL is read.
NEON_URL="$(grep -E '^NEON_DATABASE_URL=' .env.full | tail -n1 | cut -d= -f2- || true)"
# --- 4. migrations ----------------------------------------------------------
run_alembic() {
if [ "${HAVE_UV}" -eq 1 ]; then
uv run alembic upgrade head
else
# shellcheck disable=SC1091
source .venv/bin/activate
alembic upgrade head
fi
}
if [ -n "${NEON_DATABASE_URL:-}" ] || [ -n "${NEON_URL}" ]; then
log "Applying database migrations (alembic upgrade head)."
if NEON_DATABASE_URL="${NEON_DATABASE_URL:-${NEON_URL}}" run_alembic; then
log "Migrations applied."
else
warn "alembic upgrade head failed — is the database reachable? Skipping (non-fatal)."
fi
else
warn "NEON_DATABASE_URL not set — skipping migrations. Set it in .env.full and run:"
warn " make -f Makefile.dev migrate"
fi
log "Bootstrap complete."
log "Next:"
log " * Full Docker stack : make -f Makefile.dev up (then: make -f Makefile.dev smoke)"
log " * Quality gate : make -f Makefile.dev gate"