60 Commits

Author SHA1 Message Date
Martin Hohenberg
f4e991e5dc Add .env.install template and unblock it from gitignore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 21:22:30 +02:00
Martin Hohenberg
ef8285e583 Auto-stamp or migrate on startup
On boot, run_migrations() checks the Alembic revision:
- no revision + tables exist  → stamp head (db.sql was run manually)
- no revision + no tables     → upgrade head (fresh install)
- revision present            → upgrade head (no-op if already current)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 21:21:51 +02:00
Martin Hohenberg
d092c19b41 Scaffold SQLAlchemy models, routers, and Alembic migrations
- app/models/: Printer, Filament, PrintJob, Todo, PricingConfig with full
  SQLAlchemy 2.x mapped columns and relationships
- app/routers/: list + get-by-id endpoints for all five resources
- app/db.py: SQLAlchemy engine + SessionLocal + get_db dependency
- alembic/: env.py reads MYSQL_* env vars; 0001_initial_schema mirrors db.sql
- alembic.ini: script_location configured, URL injected at runtime

Since db.sql already created the tables, stamp the DB before running future
migrations:  alembic stamp head

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 21:19:59 +02:00
Martin Hohenberg
005325d658 Add cryptography package for MySQL 8 caching_sha2_password auth
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 21:10:54 +02:00
Martin Hohenberg
03eebc4f9b Expose DB connection error in /health response for debugging
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 21:10:38 +02:00
Martin Hohenberg
16a13293cf Simplify docker-compose: app only, DB is external
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 19:22:48 +02:00
Martin Hohenberg
f66af4c732 Add FastAPI hello-world structure with Docker and DB health check
- app/main.py: root endpoint + /health that reports DB connectivity
- app/db.py: pymysql connection check from MYSQL_* env vars, logged at startup
- Dockerfile: python:3.12-slim, port 8720
- docker-compose.yml: mysql:8.2 with healthcheck, app waits for DB ready
- requirements.txt: fastapi, uvicorn, pymysql

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 19:21:55 +02:00
Martin Hohenberg
71beb2d65d Add create_db.sql for database and user provisioning
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 19:16:27 +02:00
Martin Hohenberg
7925ac4ba4 Add initial MySQL schema, gitignore, and improved README
- db.sql: tables for printers, filaments, print_jobs, todos, pricing_config
- .gitignore: excludes .env files and Python build artefacts
- README: cleaned up structure and added Getting Started section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 19:15:14 +02:00
Martin Hohenberg
ec0d409b9e first commit 2026-06-18 19:04:40 +02:00