- Add scan_manager: background asyncio task + Redis event store so scans survive UI navigation; SSE stream reads from Redis and is reconnectable - Replace SSE-tied scan endpoint with POST /nc-scan/start + GET /nc-scan/stream - Fix frontend: AbortController + useEffect cleanup cancels stream on unmount without stopping the server-side scan - Add unique constraint on audio_versions.nc_file_path (migration 0009) to prevent duplicate imports from concurrent scans; handle IntegrityError gracefully in nc_scan with rollback + skip - Fix API health check: use plain python instead of uv (not in dev image) - Optimize Taskfile: fix duplicate dev:restart, add dev:fresh/dev:rebuild/ dev:status, migrate uses run --rm, check includes typecheck Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
253 lines
8.0 KiB
YAML
253 lines
8.0 KiB
YAML
version: "3"
|
|
|
|
vars:
|
|
COMPOSE: docker compose
|
|
DEV_FLAGS: -f docker-compose.yml -f docker-compose.dev.yml
|
|
INFRA_SERVICES: db redis
|
|
APP_SERVICES: api audio-worker nc-watcher
|
|
DEV_SERVICES: db redis api web audio-worker nc-watcher
|
|
|
|
# ── Development ───────────────────────────────────────────────────────────────
|
|
|
|
tasks:
|
|
dev:up:
|
|
desc: "Start full dev environment and follow logs (recommended)"
|
|
cmds:
|
|
- echo "Starting services..."
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} up -d --wait {{.DEV_SERVICES}}"
|
|
- echo "All services healthy. Following logs... (Ctrl+C to stop)"
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} logs -f api web audio-worker nc-watcher"
|
|
|
|
dev:down:
|
|
desc: "Stop all dev services"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} down"
|
|
|
|
dev:restart:
|
|
desc: "Restart one service or all (e.g. task dev:restart SERVICE=api)"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} restart {{if .SERVICE}}{{.SERVICE}}{{else}}{{.DEV_SERVICES}}{{end}}"
|
|
|
|
dev:rebuild:
|
|
desc: "Rebuild and restart one service (e.g. task dev:rebuild SERVICE=api)"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} up -d --build --wait {{.SERVICE}}"
|
|
|
|
dev:build:
|
|
desc: "Rebuild all dev images (run after dependency changes)"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} build api web audio-worker nc-watcher"
|
|
|
|
dev:fresh:
|
|
desc: "Wipe volumes, rebuild all images, and start clean"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} down -v"
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} build api web audio-worker nc-watcher"
|
|
- task: dev:up
|
|
|
|
dev:clean:
|
|
desc: "Stop services and remove volumes (preserves images)"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} down -v"
|
|
|
|
dev:nuke:
|
|
desc: "Full cleanup — removes containers, volumes, images, and build cache"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} down -v --rmi local"
|
|
- docker system prune -f
|
|
|
|
dev:status:
|
|
desc: "Show status of all dev services"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} ps"
|
|
|
|
dev:logs:
|
|
desc: "Follow dev logs (all services, or pass SERVICE=api)"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} logs -f {{.SERVICE}}"
|
|
|
|
dev:web:
|
|
desc: "Run Vite dev server locally with HMR (run alongside dev:up)"
|
|
dir: web
|
|
cmds:
|
|
- npm run dev
|
|
|
|
# ── Production ────────────────────────────────────────────────────────────────
|
|
|
|
up:
|
|
desc: Start all services (production)
|
|
cmds:
|
|
- "{{.COMPOSE}} up -d"
|
|
|
|
down:
|
|
desc: Stop all services (production)
|
|
cmds:
|
|
- "{{.COMPOSE}} down"
|
|
|
|
logs:
|
|
desc: Follow logs (pass SERVICE= to filter)
|
|
cmds:
|
|
- "{{.COMPOSE}} logs -f {{.SERVICE}}"
|
|
|
|
restart:
|
|
desc: Restart a service without rebuilding (e.g. task restart SERVICE=api)
|
|
cmds:
|
|
- "{{.COMPOSE}} restart {{.SERVICE}}"
|
|
|
|
# ── Database ──────────────────────────────────────────────────────────────────
|
|
|
|
migrate:
|
|
desc: Run Alembic migrations (works whether or not the API container is running)
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} run --rm --no-deps api alembic upgrade head"
|
|
|
|
migrate:auto:
|
|
desc: Autogenerate a migration (e.g. task migrate:auto M="add users table")
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} run --rm --no-deps api alembic revision --autogenerate -m '{{.M}}'"
|
|
|
|
db:reset:
|
|
desc: "Drop and recreate schema (dev only — destroys all data)"
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} run --rm --no-deps api alembic downgrade base"
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} run --rm --no-deps api alembic upgrade head"
|
|
|
|
# ── Setup ─────────────────────────────────────────────────────────────────────
|
|
|
|
setup:
|
|
desc: First-time setup — start services, configure Nextcloud, seed data
|
|
cmds:
|
|
- task: up
|
|
- echo "Waiting for Nextcloud to initialize (~60s)..."
|
|
- sleep 60
|
|
- bash scripts/nc-setup.sh
|
|
- bash scripts/seed.sh
|
|
|
|
# ── Testing ───────────────────────────────────────────────────────────────────
|
|
|
|
test:feature:
|
|
desc: "Fast post-feature check: typecheck + frontend + backend unit tests (no services needed)"
|
|
cmds:
|
|
- task: typecheck:web
|
|
- task: lint
|
|
- task: test:web
|
|
- task: test:api:unit
|
|
- task: test:worker
|
|
- task: test:watcher
|
|
|
|
ci:
|
|
desc: "Full CI pipeline: lint + typecheck + all tests (requires services running)"
|
|
cmds:
|
|
- task: lint
|
|
- task: typecheck:web
|
|
- task: test:web
|
|
- task: test:api
|
|
- task: test:worker
|
|
- task: test:watcher
|
|
|
|
test:
|
|
desc: Run all backend tests (unit + integration)
|
|
deps: [test:api, test:worker, test:watcher]
|
|
|
|
test:web:
|
|
desc: Run frontend unit tests
|
|
dir: web
|
|
cmds:
|
|
- npm run test
|
|
|
|
test:api:
|
|
desc: Run all API tests with coverage (unit + integration)
|
|
dir: api
|
|
cmds:
|
|
- uv run pytest tests/ -v --cov=src/rehearsalhub --cov-report=term-missing
|
|
|
|
test:api:unit:
|
|
desc: Run API unit tests only (no database or external services required)
|
|
dir: api
|
|
cmds:
|
|
- uv run pytest tests/unit/ -v -m "not integration"
|
|
|
|
test:worker:
|
|
desc: Run worker tests with coverage
|
|
dir: worker
|
|
cmds:
|
|
- uv run pytest tests/ -v --cov=src/worker --cov-report=term-missing
|
|
|
|
test:watcher:
|
|
desc: Run watcher tests with coverage
|
|
dir: watcher
|
|
cmds:
|
|
- uv run pytest tests/ -v --cov=src/watcher --cov-report=term-missing
|
|
|
|
test:integration:
|
|
desc: Run integration tests (requires services running)
|
|
dir: api
|
|
cmds:
|
|
- uv run pytest tests/integration/ -v -m integration
|
|
|
|
# ── Linting & type checking ───────────────────────────────────────────────────
|
|
|
|
check:
|
|
desc: Run all linters and type checkers
|
|
cmds:
|
|
- task: lint
|
|
- task: typecheck:web
|
|
|
|
lint:
|
|
desc: Lint all services
|
|
cmds:
|
|
- cd api && uv run ruff check src/ tests/
|
|
- cd worker && uv run ruff check src/ tests/
|
|
- cd watcher && uv run ruff check src/ tests/
|
|
- cd web && npm run lint
|
|
|
|
typecheck:web:
|
|
desc: TypeScript type check
|
|
dir: web
|
|
cmds:
|
|
- npm run typecheck
|
|
|
|
format:
|
|
desc: Auto-format all Python source
|
|
cmds:
|
|
- cd api && uv run ruff format src/ tests/
|
|
- cd worker && uv run ruff format src/ tests/
|
|
- cd watcher && uv run ruff format src/ tests/
|
|
|
|
# ── Shells ────────────────────────────────────────────────────────────────────
|
|
|
|
shell:api:
|
|
desc: Shell into the API container
|
|
interactive: true
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} exec api bash"
|
|
|
|
shell:db:
|
|
desc: Open a psql shell
|
|
interactive: true
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} exec db psql -U ${POSTGRES_USER:-rh_user} -d ${POSTGRES_DB:-rehearsalhub}"
|
|
|
|
shell:redis:
|
|
desc: Open a redis-cli shell
|
|
interactive: true
|
|
cmds:
|
|
- "{{.COMPOSE}} {{.DEV_FLAGS}} exec redis redis-cli"
|
|
|
|
# ── Container Build & Release ─────────────────────────────────────────────────
|
|
|
|
build:
|
|
desc: Build all production images
|
|
cmds:
|
|
- bash scripts/build-containers.sh
|
|
|
|
push:
|
|
desc: Push all container images to the registry
|
|
cmds:
|
|
- bash scripts/upload-containers-simple.sh
|
|
|
|
release:
|
|
desc: Build and push all containers for release (uses current git tag)
|
|
cmds:
|
|
- bash scripts/release.sh
|