From ef09b36ca2e5f0847be3bfacdb0349c715ba1563 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Fri, 11 Sep 2026 08:07:11 -0500 Subject: [PATCH] docs(homelab): unify appctl guide and mark historical plans as completed --- .../guides/homelab-appctl-architecture.md | 75 +++++++++++++++---- .../plans/appctl/git-sync-and-lifecycle.md | 9 ++- .../appctl/refactor-and-metadata-sync.md | 8 +- 3 files changed, 76 insertions(+), 16 deletions(-) diff --git a/projects/homelab/guides/homelab-appctl-architecture.md b/projects/homelab/guides/homelab-appctl-architecture.md index 08a0d84..a455452 100644 --- a/projects/homelab/guides/homelab-appctl-architecture.md +++ b/projects/homelab/guides/homelab-appctl-architecture.md @@ -5,6 +5,8 @@ tags: - homelab - appctl - architecture + - devops + - git --- # 📦 Homelab Architecture: Appctl & Decentralized Repositories @@ -12,7 +14,7 @@ tags: ## 🎯 Architecture Model & Goals 1. **Decoupled Application Repositories (`~/Sites`)**: Each application lives in an isolated, independently version-controlled Git repository containing its own Docker Compose stack and self-describing `app.yaml` manifest. 2. **Hardened Control Plane (`~/Core`)**: Core reverse proxy (Traefik v3.6), authentication gateway (Authelia), container isolation (`socket-proxy`), management GUI (Portainer), and real-time logs (Dozzle). -3. **Decentralized Metadata & Orchestration (`appctl`)**: Unified CLI tool powered by Python/Bash that dynamically parses `app.yaml` manifests, manages aliases, injects environment configurations, inspects core infrastructure, and auto-compiles the Homepage dashboard (`services.yaml`). +3. **Decentralized Metadata & Orchestration (`appctl`)**: Unified CLI tool powered by Python/Bash that dynamically parses `app.yaml` manifests, manages aliases, injects environment configurations, monitors Git repository synchronization, and auto-compiles the Homepage dashboard (`services.yaml`). --- @@ -25,12 +27,13 @@ tags: │ ├── config/ │ └── scripts/ │ ├── appctl # Bash entrypoint wrapper -│ └── appctl_engine.py # Python metadata & orchestration engine +│ ├── appctl_engine.py # Python metadata & orchestration engine +│ └── gitops_dispatcher.py # Dynamic webhook receiver engine └── Sites/ # Data Plane (User Applications & Stacks) ├── homelab-dashboard/ # Homepage portal & Learning API (app.yaml) ├── homelab-doc2site/ # Reactive Obsidian/Markdown viewer (app.yaml) ├── homelab-excalidraw/ # Collaborative whiteboard (app.yaml) - ├── homelab-gitea/ # Git service & code repository (app.yaml) + ├── homelab-gitea/ # Git service, CI runner & code repository (app.yaml) ├── homelab-jellyfin/ # Media streaming platform (app.yaml) ├── homelab-landing/ # Apex domain portfolio portal (app.yaml) ├── homelab-mermaid/ # Mermaid live diagramming editor (app.yaml) @@ -44,7 +47,7 @@ tags: ## 📋 Self-Describing Manifest Standard (`app.yaml`) -Every repository under `~/Sites` defines its identity and parameters via `app.yaml`: +Every repository under `~/Sites` defines its identity, routing, environment, and deployment parameters via `app.yaml`: ```yaml name: "docs" # Canonical service name @@ -56,9 +59,18 @@ auth: false # Authelia ForwardAuth protection networks: - proxy-net +# Stack-specific default environment variables env: PROJECT_PATH: "/home/kiskaadee/Brain" +# Optional dynamic GitOps deployment configuration +deployment: + branch: "main" + actions: + - git_pull + - compose_up + +# Presentation metadata for Homepage (dashboard) compilation homepage: title: "Docs-Viewer" group: "Knowledge & Notes" @@ -69,15 +81,52 @@ homepage: --- -## ⚙️ `appctl` CLI Commands +## 🔄 Git Synchronization & Lifecycle Model -* `appctl list`: Formatted table showing `SERVICE`, `STATUS`, `DOMAIN`, and `DIRECTORY`. -* `appctl list --core` (or `-a` / `--all`): Includes the Core infrastructure stack from `~/Core`. -* `appctl info `: Detailed inspection of runtime status, security, domains, environment defaults, and dashboard cards. -* `appctl up `: Start an application stack using short names, aliases, or directory names. +In a decentralized topology where each service is an independent Git repository, `appctl` surfaces real-time repository tracking status alongside container health: + +```text +SERVICE STATUS GIT SYNC DOMAIN DIRECTORY +------- ------ -------- ------ --------- +dashboard 🟢 Running (2) ✓ Synced dashboard.roadtotech.me ~/Sites/homelab-dashboard +docs 🟢 Running (1) ✓ Synced docs.roadtotech.me ~/Sites/homelab-doc2site +excalidraw 🟢 Running (2) ✓ Synced excalidraw.roadtotech.me ~/Sites/homelab-excalidraw +gitea 🟢 Running (2) ✓ Synced gitea.roadtotech.me ~/Sites/homelab-gitea +jellyfin 🟢 Running (1) ✓ Synced jellyfin.roadtotech.me ~/Sites/homelab-jellyfin +... +``` + +### Git Sync Badge Legend: +* `✓ Synced`: Local branch is clean and fully in sync with upstream. +* `⬆ N Ahead`: Local branch has `N` unpushed commits. +* `⬇ N Behind`: Remote tracking branch has `N` new commits ready to pull. +* `⚡ N⬆ M⬇`: Local and remote branches have diverged. +* `* Dirty`: Working tree has uncommitted or modified files (e.g. `✓ Synced *`, `⬆ 1 Ahead *`). +* `⚪ Untracked`: No upstream remote tracking branch configured. + +--- + +## ⚙️ `appctl` CLI Command Reference + +### Status & Inspection: +* `appctl list` (or `appctl status`): Display formatted table of user applications with container status, Git sync status, routed domain, and path. +* `appctl list --fetch` (or `-f`): Concurrently run `git fetch` across all repositories before reporting sync status. +* `appctl list --core` (or `-c` / `--all`): Include Core infrastructure services (`~/Core`) in the output table. +* `appctl info `: Detailed diagnostic inspection including Git remotes, tracking branches, Authelia status, container ports, environment defaults, and dashboard cards. + +### Stack Lifecycle: +* `appctl up `: Start an application stack using short names, aliases, or directory names. Injects SOPS secrets from `/run/secrets/traefik-deployments.env` and triggers Homepage re-sync. * `appctl down `: Gracefully stop and tear down an application stack. -* `appctl restart `: Restart an application stack. -* `appctl pull `: Pull latest container images and recreate the stack. -* `appctl logs `: Stream live container logs. -* `appctl config `: Validate and inspect resolved Compose configurations. +* `appctl restart `: Gracefully restart an application stack. +* `appctl pull `: Pull latest container images and recreate containers (`--remove-orphans`). +* `appctl update `: **Full atomic update**: validates clean working tree $\rightarrow$ `git pull --ff-only` $\rightarrow$ `docker compose pull` $\rightarrow$ `docker compose up -d --remove-orphans` $\rightarrow$ `appctl sync`. +* `appctl logs `: Stream live container logs (`-f`). +* `appctl config `: Validate and inspect resolved Compose configuration. * `appctl sync`: Compile `Sites/*/app.yaml` manifests where `visible: true` directly into `homelab-dashboard/config/services.yaml`. + +--- + +## 🔗 Related Plans & Implementation Runbooks +- [Core & Sites Cutover and Testing Plan](../plans/appctl/core-sites-cutover-testing-plan.md) — Completed zero-downtime cutover runbook from `~/Deployments` to `~/Core` and `~/Sites`. +- [appctl Refactor & Metadata Sync Plan](../plans/appctl/refactor-and-metadata-sync.md) — Architectural design for `app.yaml` manifests and Homepage auto-compilation. +- [appctl Git Synchronization & Lifecycle Plan](../plans/appctl/git-sync-and-lifecycle.md) — Design specification for Git tracking badges, `--fetch`, and `appctl update`. diff --git a/projects/homelab/plans/appctl/git-sync-and-lifecycle.md b/projects/homelab/plans/appctl/git-sync-and-lifecycle.md index 4b60f08..64e605c 100644 --- a/projects/homelab/plans/appctl/git-sync-and-lifecycle.md +++ b/projects/homelab/plans/appctl/git-sync-and-lifecycle.md @@ -1,12 +1,12 @@ --- -type: guide +type: plan +status: completed project: homelab tags: - homelab - appctl - git - devops -status: stable --- # 🔄 appctl Git Synchronization & Full-Stack Lifecycle Strategy @@ -89,3 +89,8 @@ appctl update --all ## 🔒 Safety & Error Handling Rules 1. **Safety First on Pulls**: `appctl update` uses `git pull --ff-only`. If merge conflicts or diverging histories exist, execution halts immediately with a clear error prompt rather than corrupting repository state. 2. **Dirty Tree Protection**: If uncommitted local edits are present in an app repo, `appctl update` warns the user and aborts unless `--force` is explicitly provided. + +--- + +## 🔗 Production Guide +* [Homelab Architecture: Appctl & Decentralized Repositories](../../guides/homelab-appctl-architecture.md) diff --git a/projects/homelab/plans/appctl/refactor-and-metadata-sync.md b/projects/homelab/plans/appctl/refactor-and-metadata-sync.md index 4bdcbc8..85d3b24 100644 --- a/projects/homelab/plans/appctl/refactor-and-metadata-sync.md +++ b/projects/homelab/plans/appctl/refactor-and-metadata-sync.md @@ -1,5 +1,6 @@ --- -type: guide +type: plan +status: completed project: homelab tags: - homelab @@ -83,3 +84,8 @@ All 11 homelab applications will include an `app.yaml` defining their identity, - Validate `appctl list` and `appctl list --core`. - Validate `appctl info `. - Validate dynamic `services.yaml` generation via `appctl sync`. + +--- + +## 🔗 Production Guide +* [Homelab Architecture: Appctl & Decentralized Repositories](../../guides/homelab-appctl-architecture.md)