01: infra

This commit is contained in:
Bobby committed 2026-11-17 14:39:40 -05:00
1 parent ec9bb74be0
commit 341cd05ac5
71 files changed
+2058 -1

No files matched your search

@@ -0,0 +1,14 @@
# 01: Infrastructure Setup
**What to build:** Linode infrastructure provisioned via Terraform: PostgreSQL database (with StatefulSet for production), Object Storage, and basic networking. Enables all other components to run.
**Blocked by:** None (can start immediately)
**Status:** ready-for-agent
- [ ] Terraform state stored in Linode Object Storage
- [ ] PostgreSQL database created (separate staging/production instances)
- [ ] Linode Object Storage buckets created for uploads
- [ ] Kubernetes StatefulSet for PostgreSQL production deployed
- [ ] Basic networking (firewall rules, load balancer) configured
- [ ] UptimeKuma configured to poll `/health` endpoint
@@ -0,0 +1,15 @@
# 01a: Linode Infrastructure with Terraform
**What to build:** Provision Linode infrastructure via Terraform: PostgreSQL database (separate staging/production), Object Storage buckets, and basic networking. Enables all other components to run.
**Blocked by:** None (can start immediately)
**Status:** ready-for-agent
- [ ] Terraform state stored in Linode Object Storage (backend configuration)
- [ ] PostgreSQL database instance for staging created
- [ ] PostgreSQL database instance for production created
- [ ] Linode Object Storage bucket for staging uploads created
- [ ] Linode Object Storage bucket for production uploads created
- [ ] Basic networking: firewall rules configured for API, PostgreSQL, Adminer
- [ ] Terraform outputs exported (database endpoints, object storage credentials)
@@ -0,0 +1,14 @@
# 01b: Kubernetes StatefulSet for Production PostgreSQL
**What to build:** Kubernetes StatefulSet for production PostgreSQL with persistent storage, enabling learnable infrastructure with stateful workload patterns.
**Blocked by:** 01a (Linode Infrastructure with Terraform)
**Status:** ready-for-agent
- [ ] Kubernetes cluster configured (or existing cluster accessible)
- [ ] StatefulSet manifest for PostgreSQL defined
- [ ] PersistentVolumeClaim for PostgreSQL data configured
- [ ] StatefulSet deployed to production cluster
- [ ] PostgreSQL pod healthy and accepting connections
- [ ] PostgreSQL version verified (e.g., 15.x or 16.x)
@@ -0,0 +1,15 @@
# 02: Database Schema & Migrations
**What to build:** PostgreSQL database initialized with Alembic migrations. First schema includes users table, auth tokens, and basic metadata. CI runs migrations on deploy.
**Blocked by:** 01 (Infrastructure Setup)
**Status:** ready-for-agent
- [ ] Alembic migrations configured and running
- [ ] Users table with JWT token support created
- [ ] Auth tokens table for API key rotation created
- [ ] Migrations applied in staging environment
- [ ] Migrations applied in production environment
- [ ] CI workflow runs migrations on deploy (staging on push to `main`, production on tags)
- [ ] Migration rollback capability tested (e.g., `alembic downgrade + upgrade`)
@@ -0,0 +1,15 @@
# 02a: Alembic Migration Framework
**What to build:** Alembic configured and running with additive-by-default migrations, destructive changes behind flags.
**Blocked by:** 01a (Linode Infrastructure with Terraform)
**Status:** ready-for-agent
- [ ] Alembic initialized in FastAPI project (`alembic init`)
- [ ] `alembic.ini` configured with environment-specific URLs (staging/production)
- [ ] First migration created (empty schema or minimal `users` table)
- [ ] Migration applied to staging database
- [ ] Migration applied to production database
- [ ] Migration rollback tested (`alembic downgrade + upgrade`)
- [ ] CI workflow step added to run migrations on deploy
@@ -0,0 +1,13 @@
# 02b: Users Table & Auth Tokens Schema
**What to build:** Database schema for users and authentication tokens with JWT support.
**Blocked by:** 02a (Alembic Migration Framework)
**Status:** ready-for-agent
- [ ] `users` table created with columns: id, email, hashed_password, is_active, created_at, updated_at
- [ ] `auth_tokens` table created with columns: id, user_id, token, token_type, expires_at, revoked_at
- [ ] Indexes added for common queries (email lookup, token expiration)
- [ ] Migration applied to staging and production
- [ ] Database constraints verified (unique email, foreign key to users)
@@ -0,0 +1,15 @@
# 03: FastAPI Application Foundation
**What to build:** Layered FastAPI app structure (`models/`, `routers/`, `schemas/`, `services/`, `db/`) with JWT auth middleware and rate limiting. Includes `/health` endpoint with DB status check.
**Blocked by:** 02 (Database Schema & Migrations)
**Status:** ready-for-agent
- [ ] Layered FastAPI app structure created (`models/`, `routers/`, `schemas/`, `services/`, `db/`)
- [ ] JWT authentication middleware implemented with token validation
- [ ] Rate limiting middleware configured (per-token limits)
- [ ] `/health` endpoint returns API status and DB connection status
- [ ] `/health/ready` and `/health/live` endpoints implemented
- [ ] OpenAPI docs generated and accessible at `/docs`
- [ ] FastAPI app tested with test client against test database
@@ -0,0 +1,14 @@
# 03a: Layered FastAPI App Structure
**What to build:** FastAPI app with layered module structure (`models/`, `routers/`, `schemas/`, `services/`, `db/`).
**Blocked by:** 02b (Users & Auth Tokens Schema)
**Status:** ready-for-agent
- [ ] Directory structure created (`models/`, `routers/`, `schemas/`, `services/`, `db/`)
- [ ] `main.py` entry point with FastAPI app instance
- [ ] Database module (`db/session.py`, `db/connection.py`) implemented
- [ ] First router (e.g., `routers/health.py`) created with basic endpoints
- [ ] Schemas module initialized with base models (e.g., `schemas/base.py`)
- [ ] Services module initialized with base service class
@@ -0,0 +1,14 @@
# 03b: JWT Authentication Middleware
**What to build:** JWT authentication middleware with token validation, supporting multiple signers and future OAuth.
**Blocked by:** 03a (Layered FastAPI App Structure)
**Status:** ready-for-agent
- [ ] JWT middleware implemented (token extraction, validation, user injection)
- [ ] Token generation function (`create_token(user_id, expires_in)`)
- [ ] Token validation with secret key (configurable via environment)
- [ ] `/auth/login` endpoint implemented (returns JWT token)
- [ ] `/auth/logout` endpoint implemented (marks token as revoked)
- [ ] Test client configured with auth header fixture
@@ -0,0 +1,13 @@
# 03c: Rate Limiting Middleware
**What to build:** Token-based rate limiting middleware in FastAPI, extensible to Redis or Traefik later.
**Blocked by:** 03b (JWT Authentication Middleware)
**Status:** ready-for-agent
- [ ] Rate limiting middleware implemented (per-token limits)
- [ ] Default rate limit configured (e.g., 100 requests/minute per token)
- [ ] Rate limit headers exposed in responses (`X-RateLimit-Limit`, `X-RateLimit-Remaining`)
- [ ] Rate limit exceeded response returns `429 Too Many Requests`
- [ ] Rate limiting tests written (test client simulates multiple requests)
@@ -0,0 +1,14 @@
# 03d: Health Endpoint
**What to build:** `/health` endpoint with DB and object storage dependency checks.
**Blocked by:** 03c (Rate Limiting Middleware)
**Status:** ready-for-agent
- [ ] `/health` endpoint implemented (returns status: `healthy`, `degraded`, `unhealthy`)
- [ ] Database dependency check included (connectivity, query test)
- [ ] Object storage dependency check included (bucket access test)
- [ ] `/health/ready` endpoint implemented (blocks on all dependencies)
- [ ] `/health/live` endpoint implemented (always returns `healthy`)
- [ ] Health check tests written (test client validates response schema)
@@ -0,0 +1,15 @@
# 04: Object Storage Integration
**What to build:** File upload support integrated with Linode Object Storage + NextCloud backup. Includes upload/download/cleanup workflows tested end-to-end.
**Blocked by:** 01 (Infrastructure Setup)
**Status:** ready-for-agent
- [ ] Linode Object Storage SDK integrated (boto3 or equivalent)
- [ ] Upload endpoint accepts files and stores in Linode Object Storage
- [ ] Download endpoint retrieves files from Linode Object Storage
- [ ] NextCloud backup integration: files mirrored to NextCloud after upload
- [ ] File cleanup workflow (e.g., delete orphaned files, retention policy)
- [ ] Object storage operations tested end-to-end (upload → Linode → NextCloud → download)
- [ ] Error handling for storage failures (retry, fallback, alerts)
@@ -0,0 +1,14 @@
# 04a: Linode Object Storage SDK Integration
**What to build:** Linode Object Storage SDK integration for uploads, downloads, and file management.
**Blocked by:** 01a (Linode Infrastructure with Terraform)
**Status:** ready-for-agent
- [ ] Linode Object Storage SDK added (e.g., `boto3` or `linode-api-client`)
- [ ] Object storage client initialized with credentials (configurable via environment)
- [ ] Upload function implemented (`upload_file(bucket, key, data)`)
- [ ] Download function implemented (`download_file(bucket, key)`)
- [ ] Delete function implemented (`delete_file(bucket, key)`)
- [ ] Object storage client tested against staging bucket
@@ -0,0 +1,13 @@
# 04b: File Upload Endpoint
**What to build:** API endpoint for file uploads to Linode Object Storage.
**Blocked by:** 04a (Linode Object Storage SDK Integration)
**Status:** ready-for-agent
- [ ] `/files/upload` endpoint implemented (POST with multipart/form-data)
- [ ] Upload endpoint stores file in Linode Object Storage
- [ ] Upload endpoint returns file metadata (id, url, size, content_type)
- [ ] File upload tests written (test client simulates multipart upload)
- [ ] Error handling for storage failures (retry, fallback, alerts)
@@ -0,0 +1,13 @@
# 04c: File Download Endpoint
**What to build:** API endpoint for file downloads from Linode Object Storage.
**Blocked by:** 04b (File Upload Endpoint)
**Status:** ready-for-agent
- [ ] `/files/{file_id}` endpoint implemented (GET)
- [ ] Download endpoint retrieves file from Linode Object Storage
- [ ] Download endpoint sets appropriate content-type headers
- [ ] Download endpoint returns file stream or presigned URL
- [ ] File download tests written (test client verifies file content matches)
@@ -0,0 +1,13 @@
# 04d: NextCloud Backup Integration
**What to build:** NextCloud backup integration: files mirrored to NextCloud after upload to Linode Object Storage.
**Blocked by:** 04a (Linode Object Storage SDK Integration)
**Status:** ready-for-agent
- [ ] NextCloud API client initialized with credentials
- [ ] Mirror function implemented (`mirror_to_nextcloud(linode_key, nextcloud_key)`)
- [ ] Upload workflow updated: after Linode upload, mirror to NextCloud
- [ ] Error handling for NextCloud failures (retry, fallback, alerts)
- [ ] NextCloud backup tests written (test client verifies file in NextCloud)
@@ -0,0 +1,15 @@
# 05: Observability Setup
**What to build:** JSON structured logging and NTFY alerts for errors/warnings. Logs include context (request ID, user ID); alerts include severity and topic.
**Blocked by:** 03 (FastAPI Application Foundation)
**Status:** ready-for-agent
- [ ] JSON structured logging configured (timestamp, level, message, context)
- [ ] Request ID injected into all log entries
- [ ] User ID included in logs where applicable
- [ ] NTFY integration: API pushes errors/warnings to configurable topics
- [ ] Alert severity levels implemented (info, warning, error, critical)
- [ ] NTFY alerts include context (e.g., "Database connection failures")
- [ ] Logging and alerts tested in staging environment
@@ -0,0 +1,13 @@
# 05a: JSON Structured Logging
**What to build:** JSON structured logging configured with timestamp, level, message, and context fields.
**Blocked by:** 03a (Layered FastAPI App Structure)
**Status:** ready-for-agent
- [ ] Logging configuration set to JSON format
- [ ] Timestamp, level, message fields included in every log entry
- [ ] Context fields (request_id, user_id) injected where applicable
- [ ] FastAPI request lifecycle logs (start, end, error)
- [ ] Structured logging tests written (verify JSON output schema)
@@ -0,0 +1,13 @@
# 05b: Request ID Injection
**What to build:** Request ID injected into all log entries via FastAPI middleware.
**Blocked by:** 05a (JSON Structured Logging)
**Status:** ready-for-agent
- [ ] Request ID middleware implemented (generates UUID per request)
- [ ] Request ID stored in FastAPI request state
- [ ] Request ID included in all log entries within request context
- [ ] Request ID exposed in response headers (`X-Request-ID`)
- [ ] Request ID tests written (verify consistency across log entries)
@@ -0,0 +1,12 @@
# 05c: User ID Logging
**What to build:** User ID included in logs where applicable (authenticated requests).
**Blocked by:** 05b (Request ID Injection)
**Status:** ready-for-agent
- [ ] User ID extracted from JWT token
- [ ] User ID logged in authenticated request context
- [ ] Anonymous users logged with placeholder ID
- [ ] User ID tests written (verify user ID in logs for authenticated requests)
@@ -0,0 +1,13 @@
# 05d: NTFY Alerts Integration
**What to build:** NTFY integration: API pushes errors/warnings to configurable topics.
**Blocked by:** 05c (User ID Logging)
**Status:** ready-for-agent
- [ ] NTFY client initialized with API URL and authentication
- [ ] Alert function implemented (`send_alert(topic, severity, message, context)`)
- [ ] Severity levels implemented (info, warning, error, critical)
- [ ] NTFY alerts sent for common events (DB failures, storage errors)
- [ ] NTFY tests written (verify alert received in NTFY dashboard)
@@ -0,0 +1,15 @@
# 06: Local Development Environment
**What to build:** Docker Compose setup with FastAPI (hot reload), PostgreSQL, and Adminer. Enables local development with full stack.
**Blocked by:** 03 (FastAPI Application Foundation)
**Status:** ready-for-agent
- [ ] Docker Compose file defines FastAPI, PostgreSQL, and Adminer services
- [ ] FastAPI service includes hot reload (e.g., `--reload` flag or volumes)
- [ ] PostgreSQL service configured with persistent volume
- [ ] Adminer accessible at local port (e.g., `localhost:8080`)
- [ ] Environment variables injected into FastAPI service
- [ ] Docker Compose setup tested end-to-end (start → API available → DB queries → Adminer accessible)
- [ ] Hot reload verified (code change triggers API reload without restart)
@@ -0,0 +1,14 @@
# 06a: Docker Compose Configuration
**What to build:** Docker Compose file defining FastAPI, PostgreSQL, and Adminer services.
**Blocked by:** 03a (Layered FastAPI App Structure)
**Status:** ready-for-agent
- [ ] `docker-compose.yml` defined with services: api, postgres, adminer
- [ ] FastAPI service configured with hot reload (volumes, `--reload` flag)
- [ ] PostgreSQL service configured with persistent volume
- [ ] Adminer service configured (port, database connection)
- [ ] Environment variables injected into FastAPI service
- [ ] Docker Compose setup tested (start → API available → DB queries)
@@ -0,0 +1,12 @@
# 06b: Hot Reload Verification
**What to build:** Hot reload verified for FastAPI service in Docker Compose.
**Blocked by:** 06a (Docker Compose Configuration)
**Status:** ready-for-agent
- [ ] FastAPI service configured for hot reload (e.g., `--reload` flag, volume mounts)
- [ ] Code change triggers API reload without restart (verified via log output)
- [ ] API responses reflect code changes after reload
- [ ] Hot reload tested with multiple code changes (schema update, endpoint addition)
@@ -0,0 +1,12 @@
# 06c: Adminer Accessibility
**What to build:** Adminer accessible at local port for database inspection and queries.
**Blocked by:** 06a (Docker Compose Configuration)
**Status:** ready-for-agent
- [ ] Adminer service accessible at `localhost:8080`
- [ ] Adminer connected to PostgreSQL service
- [ ] Database schema visible in Adminer
- [ ] Sample queries executed successfully in Adminer
+15
View File
@@ -0,0 +1,15 @@
# 07: CI/CD Pipeline
**What to build:** Gitea CI/CD workflows for build, test, push, and deploy. Auto-deploys staging on `main` branch; production on tags.
**Blocked by:** 01 (Infrastructure Setup), 05 (Observability Setup)
**Status:** ready-for-agent
- [ ] Gitea CI/CD workflow for build (lint, type-check, test)
- [ ] Gitea CI/CD workflow for push Docker image (buildx, caching)
- [ ] Auto-deploy staging on `main` branch push
- [ ] Auto-deploy production on tags (e.g., `v*`)
- [ ] CI/CD workflows use `act_runner` (Gitea Actions compatible)
- [ ] Deployment workflow includes health check verification
- [ ] CI/CD logs integrated with NTFY alerts (failures reported)
@@ -0,0 +1,13 @@
# 07a: Gitea CI/CD Build Workflow
**What to build:** Gitea CI/CD workflow for build (lint, type-check, test).
**Blocked by:** 01a (Linode Infrastructure with Terraform)
**Status:** ready-for-agent
- [ ] `.gitea/workflows/build.yml` defined
- [ ] Build workflow runs lint (e.g., `ruff`, `mypy`)
- [ ] Build workflow runs tests (pytest)
- [ ] Build workflow outputs test coverage report (optional)
- [ ] Build workflow runs on push to `main` and feature branches
@@ -0,0 +1,13 @@
# 07b: Gitea CI/CD Push Workflow
**What to build:** Gitea CI/CD workflow for pushing Docker image (buildx, caching).
**Blocked by:** 01a (Linode Infrastructure with Terraform)
**Status:** ready-for-agent
- [ ] Push workflow defined (`.gitea/workflows/push.yml`)
- [ ] Docker image built with `buildx` (multi-platform if applicable)
- [ ] Docker caching configured (build cache, layer caching)
- [ ] Image pushed to container registry (Linode Container Registry or Docker Hub)
- [ ] Image tag includes commit SHA and/or branch name
@@ -0,0 +1,13 @@
# 07c: Auto-Deploy Staging on Main
**What to build:** Auto-deploy staging on `main` branch push to Gitea.
**Blocked by:** 07a (Gitea CI/CD Build Workflow), 07b (Gitea CI/CD Push Workflow)
**Status:** ready-for-agent
- [ ] Deployment workflow triggered on push to `main` branch
- [ ] Kubernetes deployment updated with new image tag
- [ ] Rolling update applied (zero-downtime)
- [ ] Health check verification after deployment
- [ ] Rollback capability tested (manual and automatic on failure)
@@ -0,0 +1,13 @@
# 07d: Auto-Deploy Production on Tags
**What to build:** Auto-deploy production on tags (e.g., `v*`) to Gitea.
**Blocked by:** 07a (Gitea CI/CD Build Workflow), 07b (Gitea CI/CD Push Workflow)
**Status:** ready-for-agent
- [ ] Deployment workflow triggered on tags matching `v*`
- [ ] Production Kubernetes deployment updated with new image tag
- [ ] Manual approval step (optional) before production deploy
- [ ] Health check verification after deployment
- [ ] Production deployment tested with sample tag (e.g., `v0.1.0`)
@@ -0,0 +1,15 @@
# 08: Secrets Management
**What to build:** SOPS + age for encrypted secrets in Git. Age keys stored in Vaultwarden. CI/CD uses decrypted secrets during deploy.
**Blocked by:** 01 (Infrastructure Setup)
**Status:** ready-for-agent
- [ ] SOPS configured with age encryption
- [ ] Secrets files created (e.g., `secrets.yaml`) and encrypted
- [ ] Age public/private key pair generated
- [ ] Age public key stored in Vaultwarden
- [ ] CI/CD workflow decrypts secrets during deploy (e.g., `sops decrypt`)
- [ ] Secrets injected into FastAPI and infrastructure (e.g., PostgreSQL credentials, NTFY API key)
- [ ] Secrets rotation tested (new key pair, re-encrypt)
@@ -0,0 +1,13 @@
# 08a: SOPS + Age Configuration
**What to build:** SOPS configured with age encryption for secrets management.
**Blocked by:** 01a (Linode Infrastructure with Terraform)
**Status:** ready-for-agent
- [ ] SOPS installed and configured
- [ ] Age key pair generated (`age-keygen`)
- [ ] SOPS encryption configured (`secrets.yaml` encrypted)
- [ ] First secret added (e.g., `JWT_SECRET`) and encrypted
- [ ] Decryption tested (`sops decrypt secrets.yaml`)
@@ -0,0 +1,12 @@
# 08b: Age Keys in Vaultwarden
**What to build:** Age public/private keys stored in Vaultwarden for secrets management.
**Blocked by:** 08a (SOPS + Age Configuration)
**Status:** ready-for-agent
- [ ] Age public key stored in Vaultwarden (notes field or attachment)
- [ ] Age private key stored in Vaultwarden (notes field or attachment, encrypted)
- [ ] Vaultwarden accessible from CI/CD (optional: API token)
- [ ] Age keys retrieved from Vaultwarden for decryption in CI/CD
@@ -0,0 +1,12 @@
# 08c: CI/CD Secrets Injection
**What to build:** CI/CD workflow decrypts secrets and injects into FastAPI and infrastructure.
**Blocked by:** 08a (SOPS + Age Configuration)
**Status:** ready-for-agent
- [ ] CI/CD workflow decrypts secrets during deploy (`sops decrypt`)
- [ ] Secrets injected into FastAPI (environment variables)
- [ ] Secrets injected into infrastructure (e.g., PostgreSQL credentials, NTFY API key)
- [ ] Decryption tested in staging deployment
@@ -0,0 +1,15 @@
# 09: Testing Infrastructure
**What to build:** Pytest tests run against separate test database. Tests cover auth endpoints, health endpoint, and object storage workflows.
**Blocked by:** 02 (Database Schema & Migrations), 03 (FastAPI Application Foundation)
**Status:** ready-for-agent
- [ ] Pytest fixtures for `TestClient` configured
- [ ] Test database (`hapi_test`) created and cleaned between test runs
- [ ] Auth endpoint tests (token generation, validation, revocation)
- [ ] Health endpoint tests (DB status, storage status)
- [ ] Object storage workflow tests (upload → Linode → NextCloud → download)
- [ ] Tests run in CI (staging and production deployments)
- [ ] Test coverage reported (optional: thresholds for lines/functions)
@@ -0,0 +1,13 @@
# 09a: Pytest Test Framework Setup
**What to build:** Pytest configured with test database (`hapi_test`), fixtures for `TestClient`.
**Blocked by:** 02b (Users & Auth Tokens Schema), 03a (Layered FastAPI App Structure)
**Status:** ready-for-agent
- [ ] Pytest installed and configured (`pytest.ini` or `pyproject.toml`)
- [ ] Test database (`hapi_test`) created and cleaned between runs
- [ ] Pytest fixtures: `TestClient`, `async_test_client`, `db_session`
- [ ] First test suite created (e.g., `tests/test_health.py`)
- [ ] Tests run locally and in CI
@@ -0,0 +1,13 @@
# 09b: Auth Endpoint Tests
**What to build:** Pytest tests for auth endpoints (token generation, validation, revocation).
**Blocked by:** 09a (Pytest Test Framework Setup)
**Status:** ready-for-agent
- [ ] `/auth/login` tests (valid credentials, invalid credentials, rate limiting)
- [ ] `/auth/logout` tests (valid token, revoked token)
- [ ] Token generation tests (token structure, expiration)
- [ ] Token validation tests (valid token, expired token, revoked token)
- [ ] Auth tests run in CI
@@ -0,0 +1,13 @@
# 09c: Health Endpoint Tests
**What to build:** Pytest tests for health endpoint (DB status, storage status).
**Blocked by:** 09a (Pytest Test Framework Setup)
**Status:** ready-for-agent
- [ ] `/health` tests (status: healthy, degraded, unhealthy)
- [ ] `/health/ready` tests (blocks on DB and storage)
- [ ] `/health/live` tests (always returns healthy)
- [ ] DB dependency test (connectivity, query test)
- [ ] Storage dependency test (bucket access test)
@@ -0,0 +1,13 @@
# 09d: Object Storage Workflow Tests
**What to build:** Pytest tests for object storage workflows (upload → Linode → NextCloud → download).
**Blocked by:** 09a (Pytest Test Framework Setup)
**Status:** ready-for-agent
- [ ] Upload workflow tests (Linode storage, NextCloud mirror)
- [ ] Download workflow tests (Linode retrieval)
- [ ] Delete workflow tests (cleanup, retention policy)
- [ ] Error handling tests (storage failures, retries)
- [ ] End-to-end workflow test (full upload → download cycle)
@@ -0,0 +1,15 @@
# 10: MVP Integration & Validation
**What to build:** End-to-end validation of all MVP components. Verifies UptimeKuma polling `/health`, NTFY alerts, and all user stories are satisfied.
**Blocked by:** 03 (FastAPI Application Foundation), 04 (Object Storage Integration), 05 (Observability Setup), 06 (Local Development Environment), 07 (CI/CD Pipeline), 08 (Secrets Management), 09 (Testing Infrastructure)
**Status:** ready-for-agent
- [ ] UptimeKuma polling `/health` endpoint verified (staging and production)
- [ ] NTFY alerts received for errors/warnings (verified via NTFY dashboard)
- [ ] All user stories from MVP-SPEC validated (e.g., JWT auth, rate limiting, migrations)
- [ ] End-to-end flow tested: developer workflow (push → CI → deploy → health → alerts)
- [ ] Local development environment validated (Docker Compose → FastAPI → Adminer)
- [ ] MVP scope confirmed (WebSockets/GraphQL deferred, not blocking)
- [ ] MVP release notes drafted (optional: published to Gitea release)
@@ -0,0 +1,12 @@
# 10a: UptimeKuma Health Polling
**What to build:** UptimeKuma configured to poll `/health` endpoint (staging and production).
**Blocked by:** 03d (Health Endpoint), 07c (Auto-Deploy Staging on Main), 07d (Auto-Deploy Production on Tags)
**Status:** ready-for-agent
- [ ] UptimeKuma monitor configured for staging `/health`
- [ ] UptimeKuma monitor configured for production `/health`
- [ ] Health check alerts configured (failure threshold, recovery)
- [ ] UptimeKuma dashboard verified (green status for staging/production)
@@ -0,0 +1,12 @@
# 10b: NTFY Alert Verification
**What to build:** NTFY alerts verified for errors/warnings (staging and production).
**Blocked by:** 05d (NTFY Alerts Integration), 07c (Auto-Deploy Staging on Main), 07d (Auto-Deploy Production on Tags)
**Status:** ready-for-agent
- [ ] NTFY alerts received for staging (verified via NTFY dashboard)
- [ ] NTFY alerts received for production (verified via NTFY dashboard)
- [ ] Alert topics verified (e.g., "Database connection failures")
- [ ] Alert severity levels verified (info, warning, error, critical)
@@ -0,0 +1,13 @@
# 10c: MVP User Stories Validation
**What to build:** End-to-end validation of all user stories from MVP-SPEC.
**Blocked by:** 01a (Linode Infrastructure with Terraform), 01b (K8s StatefulSet), 02a (Alembic), 02b (Schema), 03a (FastAPI Structure), 03b (JWT), 03c (Rate Limiting), 03d (Health), 04a (Object Storage SDK), 04b (Upload), 04c (Download), 04d (NextCloud), 05a (Logging), 05b (Request ID), 05c (User ID), 05d (NTFY), 06a (Docker Compose), 06b (Hot Reload), 06c (Adminer), 07a (Build), 07b (Push), 07c (Deploy Staging), 07d (Deploy Prod), 08a (SOPS), 08b (Vaultwarden), 08c (Secrets Injection), 09a (Pytest), 09b (Auth Tests), 09c (Health Tests), 09d (Storage Tests), 10a (UptimeKuma), 10b (NTFY)
**Status:** ready-for-agent
- [ ] All 30 user stories validated (verified via integration tests, manual testing)
- [ ] Staging deployment validated (hot reload, health checks, alerts)
- [ ] Production deployment validated (tag-based deploy, health checks, alerts)
- [ ] Local development validated (Docker Compose → FastAPI → Adminer)
- [ ] MVP scope confirmed (WebSockets/GraphQL deferred, not blocking)
@@ -0,0 +1,13 @@
# 10d: MVP Release Notes & Documentation
**What to build:** MVP release notes drafted and published; documentation updated.
**Blocked by:** 10a (UptimeKuma), 10b (NTFY), 10c (User Stories)
**Status:** ready-for-agent
- [ ] MVP release notes drafted (version, features, breaking changes)
- [ ] Release notes published to Gitea release (`v0.1.0` or similar)
- [ ] API documentation updated (OpenAPI `/docs`, README)
- [ ] Infrastructure documentation updated (Terraform README)
- [ ] Development documentation updated (Docker Compose setup, local dev guide)
+111
View File
@@ -0,0 +1,111 @@
# HAPI MVP Tickets
**Source:** [MVP-SPEC.md](../MVP-SPEC.md)
**Issue Tracker:** Gitea (https://git.bobbypalko.com/bobby/hapi)
**Triage Label:** `ready-for-agent`
---
## Summary
**Total Tickets:** 20 (expanded from 10 MVP tickets into fine-grained vertical slices)
Each ticket is a **tracer-bullet**: cuts vertically through layers (schema, API, tests, infrastructure) and delivers end-to-end behavior.
---
## Tickets
### Infrastructure
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 01a | Linode Infrastructure with Terraform | — | Linode: PostgreSQL, Object Storage, networking |
| 01b | Kubernetes StatefulSet for PostgreSQL | 01a | K8s StatefulSet for production PostgreSQL |
### Database
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 02a | Alembic Migration Framework | 01a | Alembic configured with additive migrations |
| 02b | Users & Auth Tokens Schema | 02a | `users` and `auth_tokens` tables with JWT support |
### FastAPI
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 03a | Layered FastAPI App Structure | 02b | `models/`, `routers/`, `schemas/`, `services/`, `db/` |
| 03b | JWT Authentication Middleware | 03a | Token validation, login/logout, multiple signers |
| 03c | Rate Limiting Middleware | 03b | Per-token rate limits with headers |
| 03d | Health Endpoint | 03c | `/health`, `/health/ready`, `/health/live` |
### Object Storage
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 04a | Linode Object Storage SDK | 01a | Linode SDK for uploads, downloads, deletes |
| 04b | File Upload Endpoint | 04a | `/files/upload` endpoint with multipart support |
| 04c | File Download Endpoint | 04b | `/files/{file_id}` endpoint with streaming |
| 04d | NextCloud Backup Integration | 04a | Files mirrored to NextCloud after upload |
### Observability
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 05a | JSON Structured Logging | 03a | JSON logs with timestamp, level, message, context |
| 05b | Request ID Injection | 05a | UUID per request, logged and in headers |
| 05c | User ID Logging | 05b | User ID from JWT included in logs |
| 05d | NTFY Alerts Integration | 05c | API pushes errors/warnings to NTFY topics |
### Local Dev
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 06a | Docker Compose Configuration | 03a | FastAPI, PostgreSQL, Adminer services |
| 06b | Hot Reload Verification | 06a | Code changes trigger API reload |
| 06c | Adminer Accessibility | 06a | Adminer at `localhost:8080` |
### CI/CD
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 07a | Gitea CI/CD Build Workflow | 01a | Lint, type-check, test |
| 07b | Gitea CI/CD Push Workflow | 01a | Docker buildx, caching, push |
| 07c | Auto-Deploy Staging on Main | 07a, 07b | Push to `main` triggers staging deploy |
| 07d | Auto-Deploy Production on Tags | 07a, 07b | Tags `v*` trigger production deploy |
### Secrets
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 08a | SOPS + Age Configuration | 01a | Encrypted secrets in Git |
| 08b | Age Keys in Vaultwarden | 08a | Public/private keys in Vaultwarden |
| 08c | CI/CD Secrets Injection | 08a | Decrypt secrets, inject into app |
### Testing
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 09a | Pytest Test Framework Setup | 02b, 03a | Test DB, fixtures, `TestClient` |
| 09b | Auth Endpoint Tests | 09a | Login, logout, token generation/validation |
| 09c | Health Endpoint Tests | 09a | DB and storage dependency checks |
| 09d | Object Storage Workflow Tests | 09a | Upload → Linode → NextCloud → download |
### MVP Integration
| # | Title | Blocked By | Summary |
|---|-------|------------|---------|
| 10a | UptimeKuma Health Polling | 03d, 07c, 07d | Staging/production health checks |
| 10b | NTFY Alert Verification | 05d, 07c, 07d | Alerts verified for staging/production |
| 10c | MVP User Stories Validation | All prior | All 30 user stories validated |
| 10d | MVP Release Notes & Docs | 10a, 10b, 10c | Release notes, API docs, dev guide |
---
## Notes
- **Priority order:** Tickets are ordered by dependency (blockers first). Many tickets can run in parallel (e.g., Object Storage, CI/CD, and Secrets can all start after infrastructure).
- **Frontier:** Work on tickets whose blockers are all closed/merged. At start, frontier includes: 01a, 02a, 03a, 04a, 05a, 06a, 07a, 08a, 09a.
- **Wide refactor exceptions:** None in MVP scope; all tickets are tracer-bullet vertical slices.