Brain Structural Validation / Validate Markdown Structure & Links (push) Failing after 8s
4.3 KiB
4.3 KiB
type, status, project, tags
| type | status | project | tags | ||||||
|---|---|---|---|---|---|---|---|---|---|
| plan | completed | homelab |
|
🔄 appctl Git Synchronization & Full-Stack Lifecycle Strategy
🎯 Motivation & Rationale
In a decentralized homelab architecture where ~/Core and every application stack in ~/Sites are independent Git repositories:
- Prevent Configuration Drift: Developers frequently push edits (compose labels,
app.yamlmetadata, Dockerfile changes) from laptops or secondary workstations. The production server needs instant visibility into repositories that are behind remote (git pullneeded) or ahead of remote (git pushpending). - Prevent Forgotten Uncommitted State: Dirty working trees on production need to be surfaced prominently to avoid accidental overwrites or uncommitted production hotfixes.
- Atomic Stack Updates (
appctl update): Provide a single command that pulls Git repository changes, pulls new Docker container images, recreates the stack, and synchronizes the Homepage dashboard.
🏛️ Architecture & Display Schema
1. Enhanced appctl list Table Format
appctl list includes a dedicated GIT / SYNC column alongside runtime container health:
SERVICE STATUS GIT SYNC DOMAIN DIRECTORY
------- ------ -------- ------ ---------
dashboard 🟢 Running (2) ⬆ 1 Ahead 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 🔴 Stopped ⬇ 1 Behind gitea.roadtotech.me ~/Sites/homelab-gitea
jellyfin 🟢 Running (1) ✓ Synced jellyfin.roadtotech.me ~/Sites/homelab-jellyfin
...
2. Status Badge Legend
✓ Synced: Local branch is clean and fully in sync with upstream.⬆ N Ahead: Local branch hasNunpushed commits.⬇ N Behind: Remote tracking branch hasNnew commits ready to pull.⚡ Diverged (NA NB): Local and remote branches have diverged.* Dirty: Working directory has uncommitted or modified files (e.g.✓ Synced *,⬆ 1 *).⚪ Untracked: No upstream remote branch configured.
3. Execution Performance Model
- Instant Local Mode (Default):
appctl listexecutes instant local Git rev-list checks against existing tracking branches (HEADvs@{upstream}), completing in milliseconds. - Live Network Mode (
--fetch/-f):appctl list --fetchperforms concurrent, backgroundgit fetchacross repositories before evaluating status.
🚀 Commands & Workflows
1. appctl list [--fetch] [--core]
appctl list: Lists all apps with container and local Git sync status.appctl list --fetch(or-f): Fetches remote refs first to report real-time upstream changes.appctl list --core(or-c/--all): Includes Core infrastructure services and theCorerepository Git sync status.
2. appctl info <service>
Includes detailed Git repository diagnostics:
Git Repository:
Branch: main
Upstream: origin/main
Sync Status: ⬆ 1 Ahead (1 unpushed commit)
Working Tree: Clean
3. Full Stack Upgrade (appctl update <service>)
Executes an atomic 5-step upgrade pipeline:
flowchart LR
A["Check Clean Worktree"] --> B["git pull --ff-only"]
B --> C["docker compose pull"]
C --> D["docker compose up -d"]
D --> E["appctl sync\n(Update Dashboard)"]
# Update a single application stack
appctl update docs
# Update all running application stacks
appctl update --all
🔒 Safety & Error Handling Rules
- Safety First on Pulls:
appctl updateusesgit pull --ff-only. If merge conflicts or diverging histories exist, execution halts immediately with a clear error prompt rather than corrupting repository state. - Dirty Tree Protection: If uncommitted local edits are present in an app repo,
appctl updatewarns the user and aborts unless--forceis explicitly provided.