Replace subject-based folder hierarchy with a document-type-based layout. Filesystem now establishes broad ownership and locality: - knowledge/ → concepts/ | technologies/ | methods/ - homelab/ → projects/homelab/plans/ | projects/homelab/guides/ - journal/ → records/journal/ - projects/ flat files → per-project sub-folders with overview.md - knowledge/parking-lot.md → inbox/ Deleted files: - Root-level Backend Residency operational files (AGENTS.md, CURRENT.md, ROADMAP.md, SKILLS.md, todo.md, todo.txt) — belong in backend-residency repo - docs/ directory entirely (ADRs belong in bitetrack-api, remaining files unused) - learning/ directory (backend-residency.md deleted; cicd guide moved to knowledge/methods/) - projects/README.md (replaced by individual project overview files)
5.8 KiB
5.8 KiB
🧠 Real-Time Brain Synchronization & Gitea Push Mirroring
🎯 Motivation & Objectives
The Brain repository (~/Brain) represents an actively edited knowledge vault (notes, architectural plans, daily learnings) accessed via Obsidian on client workstations (laptop) and served live to https://docs.roadtotech.me via homelab-doc2site.
Key Challenges & Invariants:
- Zero CI/CD & Rate-Limit Overhead: Standard GitHub Actions pipelines consume build minutes, hit quota limits, and take minutes to deploy. Note edits must appear in seconds without triggering remote CI runners.
- Instant Local Reflection:
homelab-doc2sitedynamically reads from disk on every HTTP request. As soon as changes land on the server host in/home/kiskaadee/Brain, they are visible ondocs.roadtotech.mewith zero container rebuilds. - Automated Cloud Backup: Edits must be backed up offsite to GitHub automatically without manual multi-remote pushes.
🏛️ End-to-End GitOps Architecture
┌────────────────────────┐
│ Laptop (Author) │
│ (Obsidian / Markdown) │
└───────────┬────────────┘
│ (Auto Git Push over HTTPS)
▼
┌────────────────────────┐
│ Self-Hosted Gitea │
│ (gitea.roadtotech.me) │
└───────────┬────────────┘
│
┌───────────────────────┴───────────────────────┐
│ [Push Mirror (Auto Cloud Backup)] │ [Server Host Sync Pull]
▼ ▼
┌───────────────────────────────┐ ┌───────────────────────────────┐
│ GitHub Remote (Offsite) │ │ Server Systemd Service/Timer │
│ (github.com/kiskaadee/Brain) │ │ (brain-sync.timer / pull) │
└───────────────────────────────┘ └───────────────┬───────────────┘
▼
┌───────────────────────────────┐
│ Server Host: ~/Brain │
│ (Mounted to doc2site) │
└───────────────┬───────────────┘
▼
┌───────────────────────────────┐
│ Live docs.roadtotech.me (0s) │
└───────────────────────────────┘
🚀 Validated Test Results
A full end-to-end integration test was executed using a test repository (testing-repo):
- Local Push: Laptop pushed commits over HTTPS to
https://gitea.roadtotech.me/kiskaadee/testing-repo.git. - Gitea Push Mirror: Configured with GitHub Classic Personal Access Token (
ghp_...) andreposcope. - SHA Parity: Verified identical commit hashes (
38285c4) mirrored tohttps://github.com/kiskaadee/testing-repoinstantaneously.
⚙️ Implementation Guide
1. Configure Gitea Push Mirror (Web UI)
- Open Gitea repository
\rightarrowSettings\rightarrowRepository\rightarrowMirror Settings. - Add Push Mirror:
- Target Address:
https://github.com/kiskaadee/<repo-name>.git - Authorization: GitHub Username + Classic PAT (
ghp_...withreposcope). - Sync Trigger: Enable "Sync when commits are pushed".
- Target Address:
2. Client-Side (Laptop) Automation
On your laptop, configure automatic commit and push:
- Option A (Obsidian Git Plugin): Set auto-save / auto-commit interval to 5–10 minutes.
- Option B (Git Remote Configuration):
cd ~/Brain git remote set-url origin https://gitea.roadtotech.me/kiskaadee/Brain.git
3. Server-Side Automated Git Reconciliation (brain-sync.timer)
A lightweight NixOS systemd timer runs periodically on the homelab host to pull upstream edits:
# Declarative Systemd Timer in NixOS
systemd.services.brain-sync = {
description = "Synchronize Brain markdown vault from Gitea";
serviceConfig = {
Type = "oneshot";
User = "kiskaadee";
WorkingDirectory = "/home/kiskaadee/Brain";
ExecStart = "${pkgs.git}/bin/git pull --ff-only origin main";
};
};
systemd.timers.brain-sync = {
description = "Trigger Brain sync every 2 minutes";
timerConfig = {
OnBootSec = "1min";
OnUnitActiveSec = "2min";
};
wantedBy = [ "timers.target" ];
};
📄 Summary of Benefits
- ⚡ Instant: Note changes render live upon page load on
docs.roadtotech.me. - 🛡️ Zero API / CI/CD Quotas: Never consumes billable GitHub Actions minutes.
- 📦 Offsite Redundancy: Gitea autonomously keeps GitHub in sync as a hot backup.