All checks were successful
Build Docker Image / build (pull_request) Successful in 2m32s
Enables career-total aggregation by real-world player identity (SbaPlayer) across all seasons. JOINs StratPlay → Player to access Player.sbaplayer FK, groups by that FK, and excludes players with null sbaplayer. Also refactors stratplay router from single file into package and adds integration tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Major Domo Database API
FastAPI backend serving SBA fantasy league data. Peewee ORM with PostgreSQL.
Commands
docker-compose up # Start PostgreSQL + API + Adminer
docker-compose up --build # Rebuild and start
docker-compose --profile sync up sync-prod # One-time production data sync
python migrations.py # Run migrations (SQL files in migrations/)
- Dev server:
10.10.0.42:814/ssh sba-db→cd container-data/dev-sba-database| Adminer:http://10.10.0.42:8080 - Production:
ssh akamai→cd container-data/sba-database - Deploy (dev/prod):
docker-compose pull && docker-compose down && docker-compose up -d(on the remote server)
Architecture
- Routers: Domain-based in
app/routers_v3/under/api/v3/prefix - ORM: Peewee — always specify
Meta.table_nameto match PostgreSQL naming - Auth: OAuth2 bearer token via
API_TOKENenv var - Error handling:
@handle_db_errorsdecorator (logging, rollback, HTTP errors) - POST models: Use
Optional[int] = Noneforidfields (DB auto-generates) - Logging: Rotating file handler (
/tmp/sba-database.log, 8MB max, 5 backups)
Production Environment
- Host:
ssh akamai - Path:
~/container-data/sba-database - Bot container:
sba_postgres(PostgreSQL) +sba_db_api(API) — check withdocker ps - Other services on same host:
major-domo-discord-app-1,sba_adminer,sba-website_sba-web_1,sba-ghost_sba-ghost_1 - Image:
manticorum67/major-domo-database(Docker Hub) - Version file:
VERSION— bump before merge tomain - Health: API Port 80 —
/health,/ready,/metrics,/diagnostics - Env vars: Set in
docker-compose.prod.ymland passed to the container on startup (not stored in GitHub)
Development Environment
-
Host:
ssh sba-db -
Path:
~/container-data/dev-sba-database -
Bot container:
dev_sba_postgres(PostgreSQL) +dev_sba_db_api(API) — check withdocker ps -
Image:
manticorum67/major-domo-database:dev(Docker Hub) -
CI/CD: Gitea Actions on PR to
main— builds Docker image, auto-generates CalVer version (YYYY.MM.BUILD) on merge
Important
- All active code is in
/app— root-levelmain.py,db_engine.pyare legacy, not in use - PostgreSQL only (no SQLite fallback)
- Migrations are SQL files in
migrations/, applied manually via psql - API docs auto-generated at
/api/docs - NEVER run or test against the local docker compose — always deploy to and test against the dev server (
10.10.0.42:814). The local container has no meaningful data.