- Create ARCHITECTURE.md documenting Homelab Sites topology, Traefik priorities, Authelia forward-auth, and SQLite persistence - Record ADR-0001 for containerized orchestration and dual-router design - Add AGENTS.md defining branch-first development and repository constraints - Reconcile README.md: update routing table, clarify staging/PoC role, and close out issue #11 following native Turso driver normalization
4.0 KiB
ADR-0001: Containerized Homelab Sites Orchestration & Dual-Router Architecture
- Status: Accepted
- Date: 2026-10-19 (Reconciled: 2026-10-24)
- Deciders: Core Engineering Team
Context and Problem Statement
Armonía del Ser requires an operational platform uniting the FastAPI backend (armonia-api) and the Vite-based operator dashboard (armonia-dashboard). The system must be readily accessible to the business owner (Jasmin) and her assistant for hands-on operation and review, while allowing public clients to query availability and register booking requests.
We needed a deployment strategy that fits within the existing Homelab infrastructure, supports centralized Single Sign-On (SSO) with role-based access control, enables offline-tolerant local data storage, and provides a clear staging / PoC surface prior to cloud production.
Decision Outcome
Chosen option: Containerized Homelab Sites orchestration using Traefik dual-priority routers, Authelia ForwardAuth with LLDAP group mapping, and a local SQLite volume mount.
Specifically:
- Traefik Dual-Router Architecture:
- Router 1 (
Priority 30): Whitelists public intake endpoints (/api/health,/api/availability,/api/services,/api/packages,/api/payments/methods, andPOST /api/bookings) with prefix stripping (/api), bypassing Authelia authentication. - Router 2 (
Priority 20): Protects administrative/apiendpoints, enforcing Authelia ForwardAuth and forwarding authenticated identity headers (Remote-Email,Remote-Groups,Remote-Name,Remote-User). - Router 3 (
Priority 10): Serves the dashboard Vite SPA behind Authelia ForwardAuth.
- Router 1 (
- Decoupled Identity via
AUTH_PROVIDER=proxy_headers: The backend relies on incomingRemote-*headers validated by Authelia against LLDAP groups (armonia-owner,armonia-admin,armonia-assistant), eliminating hardcoded passwords or session storage in the containers. - Local SQLite Persistence with Native Turso Dual-Driver:
State is persisted locally in
./data/armonia.db(UID 1000:100). The underlying FastAPI application usesget_engine_url()to seamlessly switch between local SQLite files and remote Turso libSQL clusters.
Consequences
- Positive:
- Operators access the system using existing Homelab Single Sign-On without needing external Google OAuth configuration during staging.
- Zero cloud hosting costs during development and operational PoC testing.
- Public booking intake functions smoothly alongside protected administrative routes on a single domain (
armonia.roadtotech.me). - Fast local development cycle using
appctl(appctl config,appctl up).
- Negative:
- The homelab instance is subject to local hardware availability and home internet connectivity.
- Public intake requires DNS routing and SSL certificates to point to the homelab reverse proxy.
Alternatives Considered
- Deploying Directly to Cloud Production (Cloud Run + Cloudflare Pages + Turso Cloud):
- Rejected for initial validation: Jasmin and her assistant needed immediate hands-on access to test the UX and booking flows before provisioning Google Cloud organizations, DNS zone transfers, and Google OAuth approval.
- Single Unified Container (Serving Static UI and API from FastAPI):
- Rejected: Violates repository separation and complicates independent CI/CD builds for
armonia-apiandarmonia-dashboard.
- Rejected: Violates repository separation and complicates independent CI/CD builds for
- Basic Authentication in Nginx:
- Rejected: Fails to provide role-based distinction between owner (
OWNER) and assistant (ASSISTANT) required for 2-step payment verification and clinical notes access.
- Rejected: Fails to provide role-based distinction between owner (