136 lines
3.3 KiB
TOML
136 lines
3.3 KiB
TOML
min_version = "2024.9.5"
|
||
|
||
[tools]
|
||
python = "3.12"
|
||
node = "22"
|
||
uv = "0.11"
|
||
|
||
[env]
|
||
PROJECT_NAME = "quellenatlas"
|
||
# Repo liegt auf einem anderen Volume als der uv-Cache → Copy statt Hardlink
|
||
UV_LINK_MODE = "copy"
|
||
NEXT_PUBLIC_API_URL = { default = "http://localhost:8000" }
|
||
_.file = [".env.example", { path = ".env", redact = true }]
|
||
# Virtualenv im Backend (Makefile/README nutzen backend/.venv)
|
||
_.python.venv = { path = "backend/.venv", create = true }
|
||
|
||
[hooks]
|
||
postinstall = "mise run install"
|
||
|
||
[tasks.default]
|
||
description = "Verfügbare Tasks anzeigen"
|
||
run = "mise tasks"
|
||
|
||
[tasks.install]
|
||
description = "Python- (backend) und Node-Abhängigkeiten (frontend) installieren"
|
||
alias = "i"
|
||
run = """
|
||
set -euo pipefail
|
||
if [ -x backend/.venv/bin/python ]; then
|
||
ver=$(backend/.venv/bin/python -c 'import sys; print("%d.%d" % sys.version_info[:2])')
|
||
if [ "$ver" != "3.12" ]; then
|
||
echo "backend/.venv ist Python $ver – neu anlegen für 3.12"
|
||
rm -rf backend/.venv
|
||
fi
|
||
fi
|
||
if [ ! -x backend/.venv/bin/python ]; then
|
||
uv venv backend/.venv --python 3.12
|
||
fi
|
||
uv pip install -e ".[dev]" --python .venv --directory backend
|
||
npm install --prefix frontend
|
||
"""
|
||
|
||
[tasks.postgres]
|
||
description = "PostgreSQL 16 via Compose auf Port 5433"
|
||
alias = "db"
|
||
run = """
|
||
set -euo pipefail
|
||
if [ ! -f .env ]; then
|
||
cp .env.example .env
|
||
echo "Angelegt: .env (aus .env.example) – JWT_SECRET und ADMIN_PASSWORD anpassen"
|
||
fi
|
||
docker compose up -d postgres
|
||
for i in $(seq 1 30); do
|
||
if docker compose exec -T postgres pg_isready -U quellenatlas >/dev/null 2>&1; then
|
||
echo "Postgres bereit auf localhost:5433"
|
||
exit 0
|
||
fi
|
||
sleep 1
|
||
done
|
||
echo "Postgres nicht bereit" >&2
|
||
exit 1
|
||
"""
|
||
|
||
[tasks.migrate]
|
||
description = "Alembic auf head"
|
||
dir = "backend"
|
||
run = "alembic upgrade head"
|
||
|
||
[tasks.bootstrap]
|
||
description = "Admin-User aus ADMIN_USERNAME / ADMIN_PASSWORD anlegen"
|
||
dir = "backend"
|
||
run = "python -m app.cli bootstrap-admin"
|
||
|
||
[tasks.sync]
|
||
description = "Quellenkatalog aus data/sources.yaml synchronisieren"
|
||
dir = "backend"
|
||
run = "python -m app.cli sync-sources"
|
||
|
||
[tasks.seed]
|
||
description = "Seed-YAML (Jurisdiktionen, Kategorien, Entitäten, Fälle, Zusagen)"
|
||
dir = "backend"
|
||
run = "python -m app.cli seed"
|
||
|
||
[tasks.ingest]
|
||
description = "RSS/API-Ingest in Review-Queue (nie Cases). Optional: mise run ingest -- --slug …"
|
||
dir = "backend"
|
||
run = "python -m app.cli ingest"
|
||
|
||
[tasks.setup]
|
||
description = "Lokal startklar: Postgres, Migrate, Admin, Quellen, Seed"
|
||
depends = ["install", "postgres"]
|
||
run = """
|
||
set -euo pipefail
|
||
mise run migrate
|
||
mise run bootstrap
|
||
mise run sync
|
||
mise run seed
|
||
echo
|
||
echo "UI http://localhost:3000"
|
||
echo "API http://localhost:8000/docs"
|
||
echo "Start: mise run dev"
|
||
"""
|
||
|
||
[tasks.backend]
|
||
description = "FastAPI mit Reload auf :8000"
|
||
alias = "api"
|
||
dir = "backend"
|
||
raw = true
|
||
run = "uvicorn app.main:app --reload --port 8000"
|
||
|
||
[tasks.frontend]
|
||
description = "Next.js Dev-Server auf :3000"
|
||
alias = "web"
|
||
dir = "frontend"
|
||
raw = true
|
||
run = "npm run dev"
|
||
|
||
[tasks.dev]
|
||
description = "Postgres + API + UI lokal (ohne Docker-App-Container)"
|
||
depends = ["postgres"]
|
||
run = "mise run --raw -j 2 ::: backend frontend"
|
||
|
||
[tasks.test]
|
||
description = "pytest (braucht Postgres auf localhost:5433)"
|
||
alias = "t"
|
||
dir = "backend"
|
||
run = "pytest -q"
|
||
|
||
[tasks.up]
|
||
description = "Gesamtes Stack in Docker Compose bauen und starten"
|
||
run = "docker compose up --build"
|
||
|
||
[tasks.down]
|
||
description = "Docker Compose stoppen"
|
||
run = "docker compose down"
|