Curate operational guides, architectural evaluations, and completed plans for the Stalwart mail server + Brevo relay deployment, LLDAP dynamic user directory integration, and Homepage multirepo reintegration into Core.
11 KiB
type, status, project, tags
| type | status | project | tags | ||||
|---|---|---|---|---|---|---|---|
| plan | completed | homelab |
|
Implementation Plan: Multirepo Refactor of Homepage & Learning Hub
Goal Description
Restructure the homelab services by disentangling the Homepage dashboard from the Learning Hub (courses API & Kanban board):
- Reintegrate Homepage into Homelab Core (
/home/kiskaadee/Homelab/Core): Return Homepage to its natural role as the central infrastructure portal and container status monitor in the Core stack, removing custom DOM-injection scripts (custom.js,custom.css). - Establish Standalone Courses App (
/home/kiskaadee/Homelab/Sites/courses): Promote the learning API and its Kanban board into an independent application underSites/courses, equipped with its ownapp.yaml, standalone frontend UI, Turso database connection, and isolated lifecycle. - Update Orchestrator (
appctl): Directappctl syncto output Homepage configuration toCore/config/homepage/services.yaml, ensuring dynamic discovery of allSites/*/app.yamlmanifests including the newcoursessite. - Decommission
Sites/dashboard: Safely transition and retire the deprecatedSites/dashboardrepository.
Architectural Evaluation: Is This the Right Direction?
Yes, this refactoring is strongly recommended.
flowchart TD
subgraph Current Architecture [Current Coupled State]
SitesDash["Sites/dashboard (homelab-dashboard repo)"]
HP1["Homepage Container"]
LearnAPI1["Learning API Container"]
CustomJS["custom.js / custom.css (DOM Injection Hack)"]
SitesDash --> HP1
SitesDash --> LearnAPI1
HP1 -.->|"MutationObserver\nDOM Injection"| CustomJS
CustomJS -->|"Fetch courses"| LearnAPI1
end
subgraph Target Architecture [Target Decoupled State]
subgraph CoreInfra [Homelab Core]
CoreCompose["Core/docker-compose.yml"]
HP2["Homepage (Core Portal)"]
SocketProxy["socket-proxy:2375"]
Appctl["appctl sync"]
CoreCompose --> HP2
HP2 -->|"Reads container status"| SocketProxy
Appctl -->|"Generates services.yaml"| HP2
end
subgraph SitesApps [Homelab Sites]
CoursesSite["Sites/courses (homelab-courses repo)"]
CoursesApp["Courses Container (FastAPI + Standalone UI)"]
Turso[(Turso Cloud / SQLite)]
CoursesSite --> CoursesApp
CoursesApp --> Turso
end
HP2 -->|"Navigation Link"| CoursesApp
end
Key Rationale
- Separation of Infrastructure vs. Domain Application:
- Homepage is an operational monitoring tool tightly coupled to
socket-net(viasocket-proxy:2375) and the host's container lifecycle. It lists containers, inspects CPU/RAM/Disk, and aggregates links. It belongs squarely insideCore. - Learning Hub / Courses is a personal domain application with its own database (Turso/LibSQL), schemas, business logic, and UI. It does not need socket access or cluster privileges.
- Homepage is an operational monitoring tool tightly coupled to
- Elimination of Frontend Anti-Patterns:
- Injecting a Kanban board into Homepage via
custom.jswithMutationObserverpolling and arbitrary HTML string templates was a fragile workaround. - Giving
coursesa dedicated frontend (served directly alongside the API) creates a clean, testable user interface without cross-origin hacks or layout collisions.
- Injecting a Kanban board into Homepage via
- Consistency with the Homelab Specification:
- Every application in
Sites/must be self-describing viaapp.yamland discoverable byappctl. In the current setup,dashboardwas an anomaly (visible: false, dual containers, special-cased inappctl_engine.py). - Moving Homepage into Core allows
appctl syncto treat allSites/*uniformly.
- Every application in
User Review Required
Important
Domain Names & Routing:
- Currently,
Sites/dashboarduseddashboard.roadtotech.mefor Homepage andlearning.roadtotech.mefor the learning API.- In the new layout:
- Homepage in Core will serve
dashboard.roadtotech.me.- Courses in
Sites/coursescan servecourses.roadtotech.me(with an alias forlearning.roadtotech.meif desired).- Please confirm if you prefer
courses.roadtotech.meorlearning.roadtotech.meas the primary domain for the courses app.
Note
Frontend Implementation for Courses: We propose serving a clean, responsive standalone Kanban board (extracted and modernized from
custom.js/custom.css) directly from FastAPI viaStaticFilesat/while the API lives at/api/courses. This avoids needing a separate Node.js build step or container, maintaining zero-overhead single-container deployment.
Proposed Changes
Component 1: Homelab/Sites/courses (New Application Repository)
[NEW] Sites/courses/app.yaml
Declare metadata for the courses service:
name: "courses"
aliases:
- "learning"
domain: "courses.roadtotech.me"
description: "Learning Path & Course Tracking Kanban Hub"
visible: true
auth: false
networks:
- proxy-net
homepage:
title: "Courses"
group: "Knowledge & Notes"
icon: "school.png"
container: "courses"
weight: 20
[NEW] Sites/courses/docker-compose.yml
Standard container stack adhering to Homelab Sites conventions:
services:
courses:
build: .
container_name: ${CONTAINER_NAME:-courses}
restart: unless-stopped
volumes:
- ./data:/app/data
environment:
- TURSO_DATABASE_URL=${TURSO_DATABASE_URL}
- TURSO_AUTH_TOKEN=${TURSO_AUTH_TOKEN}
- PORT=8000
networks:
- proxy
labels:
- "traefik.enable=true"
# HTTPS Router
- "traefik.http.routers.${CONTAINER_NAME:-courses}.rule=Host(`${SERVICE_DOMAIN:-courses.roadtotech.me}`)"
- "traefik.http.routers.${CONTAINER_NAME:-courses}.entrypoints=websecure"
- "traefik.http.routers.${CONTAINER_NAME:-courses}.tls=true"
- "traefik.http.routers.${CONTAINER_NAME:-courses}.service=${CONTAINER_NAME:-courses}-svc"
# HTTP to HTTPS Redirect
- "traefik.http.routers.${CONTAINER_NAME:-courses}-red.rule=Host(`${SERVICE_DOMAIN:-courses.roadtotech.me}`)"
- "traefik.http.routers.${CONTAINER_NAME:-courses}-red.entrypoints=web"
- "traefik.http.routers.${CONTAINER_NAME:-courses}-red.middlewares=https-redirect@docker"
# Service Port
- "traefik.http.services.${CONTAINER_NAME:-courses}-svc.loadbalancer.server.port=8000"
networks:
proxy:
name: ${PROXY_NETWORK:-proxy-net}
external: true
[NEW] Migrate Application Code & Static Frontend
- Copy
app/,tests/,docs/,Dockerfile,pyproject.toml,uv.lock,.dockerignore, and.env-examplefromSites/dashboard/learning/toSites/courses/. - Add
app/static/containing standaloneindex.html,style.css, andapp.jsderived from the existing Kanban UI logic. - Update
app/main.pyto mountapp/staticat/while serving/api/courses. - Add
UNLICENSE(maintaining Homelab license invariant) andREADME.md.
Component 2: Homelab/Core (Reintegration of Homepage)
[NEW] Core/config/homepage/
- Transfer configuration files from
Sites/dashboard/config/:bookmarks.yamldocker.yaml(configured to connect tohost: socket-proxy,port: 2375)settings.yamlwidgets.yaml- Icons and brand assets (
houston.png,houston.svg)
- Do not include
custom.jsorcustom.css(or leave them empty), keeping Homepage clean.
[MODIFY] Core/docker-compose.yml
Add the homepage service to the core stack:
homepage:
image: ghcr.io/gethomepage/homepage:latest
container_name: homepage
restart: always
volumes:
- ./config/homepage:/app/config
environment:
- HOMEPAGE_ALLOWED_HOSTS=dashboard.${DOMAIN}
networks:
- proxy-net
- socket-net
labels:
- "traefik.enable=true"
# HTTPS Router
- "traefik.http.routers.homepage.rule=Host(`dashboard.${DOMAIN}`)"
- "traefik.http.routers.homepage.entrypoints=websecure"
- "traefik.http.routers.homepage.tls=true"
- "traefik.http.routers.homepage.tls.certresolver=myresolver"
- "traefik.http.routers.homepage.service=homepage-svc"
# Public HTTP Redirect
- "traefik.http.routers.homepage-red.rule=Host(`dashboard.${DOMAIN}`)"
- "traefik.http.routers.homepage-red.entrypoints=web"
- "traefik.http.routers.homepage-red.middlewares=https-redirect@docker"
# Service Port
- "traefik.http.services.homepage-svc.loadbalancer.server.port=3000"
[MODIFY] Core/scripts/appctl_engine.py
Update cmd_sync_homepage() to target Core/config/homepage/services.yaml:
def cmd_sync_homepage(args):
"""Compile Sites/*/app.yaml into Core/config/homepage/services.yaml."""
homepage_dir = os.path.join(CORE_DIR, "config", "homepage")
for a in args:
if a.startswith("--dashboard-dir=") or a.startswith("--homepage-dir="):
homepage_dir = a.split("=", 1)[1]
services_yaml_path = os.path.join(homepage_dir, "services.yaml")
...
[MODIFY] Core/tests/structural/test_repository_structure.py
Ensure config/homepage is validated as part of the core repository structure tests.
Component 3: Decommissioning Homelab/Sites/dashboard
- Once the changes in Core and Courses are verified, tear down any old containers in
Sites/dashboard. - Commit and push the initial commit in
Homelab/Sites/courses(origin main). - Commit and push the Core changes in
Homelab/Core(origin main). - Archive or remove the local
Sites/dashboarddirectory and clean up its Gitea remote repository.
Verification Plan
Automated Tests
- Core Structural & Security Invariants:
cd /home/kiskaadee/Homelab/Core uv run --with pytest --with pyyaml pytest tests - Courses Service Unit Tests & Type Check:
cd /home/kiskaadee/Homelab/Sites/courses uv run python -m unittest discover tests uv run pyright - Orchestrator Validation:
appctl sync appctl list appctl config courses appctl config core
Manual Verification
- Homepage Verification:
- Access
https://dashboard.roadtotech.me - Verify that Homepage displays system resource widgets and all registered services from
Sites/(including the new Courses card). - Ensure the previous custom JS injection is removed and Homepage loads cleanly without DOM console warnings.
- Access
- Courses App Verification:
- Access
https://courses.roadtotech.me - Test adding a course, dragging between WIP / Planning / Archive columns, editing, and deleting.
- Verify API status at
https://courses.roadtotech.me/api/courses.
- Access