diff --git a/img/20260906214753.png b/img/20260906214753.png new file mode 100644 index 0000000..04af2c6 Binary files /dev/null and b/img/20260906214753.png differ diff --git a/projects/homelab/guides/chatbot-assistant-backend-architecture.md b/projects/homelab/guides/chatbot-assistant-backend-architecture.md index d4ca984..1092293 100644 --- a/projects/homelab/guides/chatbot-assistant-backend-architecture.md +++ b/projects/homelab/guides/chatbot-assistant-backend-architecture.md @@ -1,6 +1,11 @@ --- type: guide project: homelab +tags: + - homelab + - ai + - chatbot + - telegram --- # 🤖 WhatsApp & Telegram AI Assistant Backend Architecture diff --git a/projects/homelab/guides/custom-api-security-and-hardening.md b/projects/homelab/guides/custom-api-security-and-hardening.md index 77a6918..277f812 100644 --- a/projects/homelab/guides/custom-api-security-and-hardening.md +++ b/projects/homelab/guides/custom-api-security-and-hardening.md @@ -1,6 +1,11 @@ --- type: guide project: homelab +tags: + - homelab + - security + - hardening + - api --- # 🛡️ Custom API Security Hardening & Threat Analysis diff --git a/projects/homelab/guides/dynu-ddns-troubleshooting.md b/projects/homelab/guides/dynu-ddns-troubleshooting.md new file mode 100644 index 0000000..eca006e --- /dev/null +++ b/projects/homelab/guides/dynu-ddns-troubleshooting.md @@ -0,0 +1,220 @@ +--- +type: guide +project: homelab +tags: + - dynu + - ddns + - wan + - troubleshooting + - homelab +--- +# Dynu DDNS Domain Configuration Troubleshooting + +## Problem Statement + +During an ISP WAN rotation the server turned unreachable. + +![Screen capture of the unreachable site in a web browser](../../../img/20260906214753.png) + +First I checked whether the server was connected to the internet. + +```shell +# Confirming the server can be reached locally +kiskaadee in 🌐 laptop in Config on  main +➜ ping 192.168.1.36 -c 3 +PING 192.168.1.36 (192.168.1.36) 56(84) bytes of data. +64 bytes from 192.168.1.36: icmp_seq=1 ttl=64 time=3.13 ms +64 bytes from 192.168.1.36: icmp_seq=2 ttl=64 time=1.66 ms +64 bytes from 192.168.1.36: icmp_seq=3 ttl=64 time=1.55 ms + +kiskaadee in 🌐 laptop in Config on  main +➜ ssh server-local "echo Server is Running" +Server is Running + +# Confirming the server can reached to the internet +kiskaadee in 🌐 laptop in Config on  main +➜ ssh server-local "ping google.com -c 3" +PING google.com (142.251.132.174) 56(84) bytes of data. +64 bytes from ncboga-ak-in-f14.1e100.net (142.251.132.174): icmp_seq=1 ttl=118 time=12.5 ms +64 bytes from ncboga-ak-in-f14.1e100.net (142.251.132.174): icmp_seq=2 ttl=118 time=10.9 ms +64 bytes from ncboga-ak-in-f14.1e100.net (142.251.132.174): icmp_seq=3 ttl=118 time=11.4 ms + +--- google.com ping statistics --- +3 packets transmitted, 3 received, 0% packet loss, time 2002ms +rtt min/avg/max/mdev = 10.937/11.593/12.478/0.649 ms + +``` + +Once confirmed the server is running, and connected to the internet, the first suspicion pointed to a WAN mismatch. + +```shell +# Testing server-ddns WAN mismatch + +kiskaadee in 🌐 laptop in Config on  main +➜ curl -Iv roadtotech.me --max-time 10 +* Trying 190.253.250.211:80... +* Host roadtotech.me:80 was resolved. +* IPv6: (none) +* IPv4: 190.253.250.211 +* Connection timed out after 10001 milliseconds +* closing connection #0 +curl: (28) Connection timed out after 10001 milliseconds + +kiskaadee in 🌐 laptop in Config on  main +➜ dig +short roadtotech.me @ns1.dynu.com +190.253.250.211 + +kiskaadee in 🌐 laptop in Config on  main +➜ ssh server-local "curl -s https://checkip.dynu.com" +Current IP Address: 186.168.137.93 +``` + +Mismatch confirmed, the next step is to find out whether the problem was caused by a failure in the `dynu-monitor` or `ddclient` services. + +```shell +kiskaadee in 🌐 laptop in Config on  main +➜ ssh server-local "systemctl status dynu-monitor.service" +○ dynu-monitor.service - Dynu DDNS Smart IP Change Monitor + Loaded: loaded (/etc/systemd/system/dynu-monitor.service; linked; preset: ignored) + Active: inactive (dead) since Sun 2026-09-06 20:37:33 -05; 13min ago + Invocation: 17600047a32242dd9e74e41a3ec7e5a7 + TriggeredBy: ● dynu-monitor.timer + Process: 6717 + ExecStart=/nix/store/xpis1sf9rxwrwvrgg16mhz8adzkdpwb0-dynu-ip-monitor/bin/dynu-ip-monitor + (code=exited, status=0/SUCCESS) + Main PID: 6717 (code=exited, status=0/SUCCESS) + IP: 4.9K in, 2.1K out + IO: 28.4M read, 0B written + Mem peak: 28.4M + CPU: 98ms + + Sep 06 20:37:31 server systemd[1]: Starting Dynu DDNS Smart IP Change Monitor... + Sep 06 20:37:33 server dynu-ip-monitor[6717]: + /nix/store/xpis1sf9rxwrwvrgg16mhz8adzkdpwb0-dynu-ip-monitor/bin/dynu-ip-monitor:139: + DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future + version. Use timezone-aware objects to represent datetimes in UTC: + datetime.datetime.now(datetime.UTC). + Sep 06 20:37:33 server dynu-ip-monitor[6717]: "timestamp": datetime.utcnow().isoformat() + "Z", + Sep 06 20:37:33 server dynu-ip-monitor[6717]: IP rotation detected! Old: 190.253.250.211, New: + 186.168.137.93 + Sep 06 20:37:33 server dynu-ip-monitor[6717]: Dynu DDNS update via ddclient triggered successfully. + Sep 06 20:37:33 server systemd[1]: dynu-monitor.service: Deactivated successfully. + Sep 06 20:37:33 server systemd[1]: Finished Dynu DDNS Smart IP Change Monitor. + Sep 06 20:37:33 server systemd[1]: dynu-monitor.service: Consumed 98ms CPU time over 1.480s wall + clock time, 28.4M memory peak, 28.4M read from disk, 4.9K incoming IP traffic, 2.1K outgoing IP + traffic. + +kiskaadee in 🌐 laptop in Config on  main +➜ ssh server-local "systemctl status ddclient.service" +○ ddclient.service - Dynamic DNS Client + Loaded: loaded (/etc/systemd/system/ddclient.service; enabled; preset: ignored) + Active: inactive (dead) since Sun 2026-09-06 20:37:33 -05; 2h 12min ago + Invocation: 30d915ac234e41c0b11890660d4a1b19 + Process: 6720 ExecStartPre=/nix/store/7qqkmydcjx6993sq8fc3ir35vhmcxz0z-ddclient-prestart (code=exited, status=0/SUCCESS) + Process: 6727 ExecStart=/nix/store/zpqihb48iddspmp5qnqy6yvgrw26q6ap-perl5.42.3-ddclient-4.0.0/bin/ddclient -file /run/ddclient/ddclient.conf (code=exited, status=0/SUCCESS) + Main PID: 6727 (code=exited, status=0/SUCCESS) + IP: 10.8K in, 5K out + IO: 0B read, 8K written + Mem peak: 15.9M + CPU: 136ms + +Sep 06 20:37:32 server systemd[1]: Starting Dynamic DNS Client... +Sep 06 20:37:33 server ddclient[6727]: SUCCESS: [dyndns2][arch-services.mywire.org]> IPv4 address set to 186.168.137.93 +Sep 06 20:37:33 server systemd[1]: ddclient.service: Deactivated successfully. +Sep 06 20:37:33 server systemd[1]: Finished Dynamic DNS Client. +Sep 06 20:37:33 server systemd[1]: ddclient.service: Consumed 136ms CPU time over 1.066s wall clock time, 15.9M memory peak, 8K written to disk, 10.8K incoming IP traffic, 5K outgoing IP traffic. + +``` + +## Root Cause Analysis + +The WAN IP rotation from `190.253.250.211` to `186.168.137.93` is the first one since the domain update from `arch-services.mywire.org` to `roadtotech.me`: +1. `dynu-monitor.service` successfully detected the IP rotation and called `ddclient.service`. +2. `ddclient.service` uses a `@dynu_domain` decrypted from secrets.yaml at runtime. +3. `ddclient.service` updated `arch-services.mywire.org` to `186.168.137.93` because the SOPS secret `dynu_domain` in `secrets.yaml` was configured with the legacy domain `arch-services.mywire.org`. +4. `roadtotech.me` remained pointing to the old IP `190.253.250.211` on Dynu's nameservers. +5. Because `dynu-ip-monitor` logged `186.168.137.93` as a successful update in `/var/lib/dynu/ip_history.jsonl`, subsequent periodic checks exit without re-triggering `ddclient`. + +## Resolution Steps + +**1. Generate Age Key on the Laptop**: + +Running `sops hosts/server/secrets.yaml` from `laptop` fails because the laptop currently lacks `~/.config/sops/age/keys.txt` matching the recipients in `.sops.yaml`. So we'll first authorize `laptop` as a new client in SOPS via Server Host Key. + +```shell +# Generate a key on the laptop +mkdir -p ~/.config/sops/age +age-keygen -o ~/.config/sops/age/keys.txt +chmod 600 ~/.config/sops/age/keys.txt +age-keygen -y ~/.config/sops/age/keys.txt + +``` + +**2. Update `.sops.yaml`:** +Register the laptop's new public age key and the server host key: + +```yml +keys: + - &laptop + - &server + +creation_rules: + - path_regex: hosts/server|laptop/secrets\.yaml$ + key_groups: + - pgp: [] + age: + - *laptop + - *server + +``` + +**3. Re-key Secret Envelope from Laptop using Server's Host Key** + +```shell +# Store the server's private age key (-t allows interactive sudo password prompt) +ssh -t server-local "sudo nix run nixpkgs#ssh-to-age -- -private-key -i /etc/ssh/ssh_host_ed25519_key" + +SOPS_AGE_KEY= sops updatekeys hosts/server/secrets.yaml +``` + +**4. Edit Encrypted Secrets**: + ```shell + sops hosts/server/secrets.yaml + ``` + Set `dynu_domain` to: + ```yaml + dynu_domain: roadtotech.me + ``` + +**5. Deploy and Rebuild to Server**: + + A CI/CD pipeline has not been established yet. To apply the configuration, we'll trigger the upstream fetch via ssh and then rebuild the system. + +```shell +# Review flake status +nix flake check + +# Once local changes are synced with upstream +ssh -t server-local \ +"cd Config && \ +git fetch && \ +git pull" + +# rebuild the NixOS system +ssh -t server-local \ +"cd Config && \ +sudo nixos-rebuild switch --flake .#server" + +``` + +**6. Force One-Off DDNS Update**: + ```bash + ssh server-local \ + "sudo systemctl restart ddclient.service && \ + systemctl status ddclient.service" + ``` + +**7. Verify Propagation**: + ```bash + dig +short roadtotech.me @ns1.dynu.com + ``` diff --git a/projects/homelab/guides/homelab-appctl-architecture.md b/projects/homelab/guides/homelab-appctl-architecture.md index 84091ea..08a0d84 100644 --- a/projects/homelab/guides/homelab-appctl-architecture.md +++ b/projects/homelab/guides/homelab-appctl-architecture.md @@ -1,6 +1,10 @@ --- type: guide project: homelab +tags: + - homelab + - appctl + - architecture --- # 📦 Homelab Architecture: Appctl & Decentralized Repositories diff --git a/projects/homelab/overview.md b/projects/homelab/overview.md index a642b3c..f64c67a 100644 --- a/projects/homelab/overview.md +++ b/projects/homelab/overview.md @@ -1,53 +1,64 @@ --- type: project status: active +tags: + - homelab + - infrastructure --- - # 🌐 Homelab & Infrastructure Planning This project documents the architectural roadmaps, infrastructure designs, deployment automation, and system administration workflows for the homelab ecosystem. --- -## 📑 Plans +## 📑 Plans & Roadmap -1. [**NixOS Server & Laptop Migration**](plans/nixos-server-laptop-migration.md) +### 🖥️ Server 24/7 & Infrastructure +1. [**NixOS Server & Laptop Migration**](plans/server-24-7/nixos-server-laptop-migration.md) - Converting the desktop into a 24/7 headless production server. - Setting up the laptop as the primary graphical development workstation. - Decoupling visual configurations (Niri, Hyprland, Waybar, GUI apps) from the server. -2. [**Domain Migration (`roadtotech.me`)**](plans/domain-migration-roadtotech.md) +2. [**Domain Migration (`roadtotech.me`)**](plans/server-24-7/domain-migration-roadtotech.md) - Step-by-step strategy for cutting over from `arch-services.mywire.org` to `roadtotech.me`. - DNS delegation options (Dynu vs. Cloudflare), Traefik ACME wildcard SSL, and Authelia session cookie updates. -3. [**Core & Sites Cutover and Testing Plan**](plans/core-sites-cutover-testing-plan.md) - - Zero-downtime, progressive testing and safe cutover guide from `~/Deployments` to `~/Core` and `~/Sites`. - - Complete pre-flight verification matrix, rollback commands, and post-validation cleanup. -4. [**CI/CD & Deployment Strategy**](plans/deployment-and-cicd-strategy.md) - - Automating image builds, GitOps updates, Gitea Actions/GitHub Actions, and production rollouts. -5. [**Production Folder Structure Reorganization**](plans/folder-structure-reorganization.md) +3. [**Production Folder Structure Reorganization**](plans/server-24-7/folder-structure-reorganization.md) - Establishing strict directory boundaries (`~/Core`, `~/Sites`, `~/Projects`). - Removing development traces and non-production scratchpads from the server. -6. [**LVM Storage Optimization & Partition Resizing Strategy**](plans/lvm-storage-optimization-and-resizing.md) +4. [**LVM Storage Optimization & Partition Resizing Strategy**](plans/server-24-7/lvm-storage-optimization-and-resizing.md) - Storage topology analysis, desktop indexer cache reclamation, and zero-data-loss LVM resize runbook. +### 📦 Orchestration (`appctl`) +1. [**Core & Sites Cutover and Testing Plan**](plans/appctl/core-sites-cutover-testing-plan.md) + - Zero-downtime, progressive testing and safe cutover guide from `~/Deployments` to `~/Core` and `~/Sites`. + - Complete pre-flight verification matrix, rollback commands, and post-validation cleanup. +2. [**appctl Refactor & Decentralized `app.yaml` Metadata Architecture**](plans/appctl/refactor-and-metadata-sync.md) + - Decentralizing service configurations into individual app repositories. + - Clean service aliases, enhanced status listing, and dynamic Homepage `services.yaml` generation. +3. [**appctl Git Synchronization & Full-Stack Lifecycle Strategy**](plans/appctl/git-sync-and-lifecycle.md) + - Real-time Git sync status in `appctl list` (`✓ Synced`, `⬆ Ahead`, `⬇ Behind`, `* Dirty`). + - Network fetch support (`--fetch`) and atomic stack upgrade workflow (`appctl update`). + +### 🍵 Gitea & GitOps +1. [**CI/CD & Deployment Strategy**](plans/gitea/deployment-and-cicd-strategy.md) + - Automating image builds, GitOps updates, Gitea Actions/GitHub Actions, and production rollouts. +2. [**Real-Time Brain Synchronization & Gitea Push Mirroring**](plans/gitea/brain-sync-and-gitea-mirroring.md) + - Zero-overhead markdown synchronization architecture between laptop and server using Gitea push mirroring. + - Systemd timer reconciliation, instant `doc2site` reflection, and GitHub offsite backup. +3. [**Discussion: Gitea Git Credential Helper & Hybrid Backup Architecture**](plans/gitea/gitea-git-helper-and-backup-strategy.md) + - Trade-offs between `tea`, `gh`, SSH transport, and Gitea-to-GitHub push mirroring. + --- -## 📑 Guides +## 📑 Guides & Incident Runbooks 1. [**Homelab Infrastructure & Appctl Architecture**](guides/homelab-appctl-architecture.md) - Making `appctl` a first-class homelab orchestrator. - Decoupling monolithic deployments into individual standalone Git repositories. -2. [**appctl Refactor & Decentralized `app.yaml` Metadata Architecture**](guides/appctl-refactor-and-metadata-sync.md) - - Decentralizing service configurations into individual app repositories. - - Clean service aliases, enhanced status listing, and dynamic Homepage `services.yaml` generation. -3. [**appctl Git Synchronization & Full-Stack Lifecycle Strategy**](guides/appctl-git-sync-and-lifecycle.md) - - Real-time Git sync status in `appctl list` (`✓ Synced`, `⬆ Ahead`, `⬇ Behind`, `* Dirty`). - - Network fetch support (`--fetch`) and atomic stack upgrade workflow (`appctl update`). -4. [**Custom API Security Hardening & Threat Analysis**](guides/custom-api-security-and-hardening.md) +2. [**Dynu DDNS Domain Configuration Troubleshooting Runbook**](guides/dynu-ddns-troubleshooting.md) + - Root cause analysis and step-by-step resolution for WAN IP rotations, SOPS key authorization, and `ddclient` domain updates. +3. [**Custom API Security Hardening & Threat Analysis**](guides/custom-api-security-and-hardening.md) - Attack surface review and actionable hardening roadmap for custom endpoints (`learning-hub`, `minecraft-web-admin`). - Authelia ForwardAuth integration, rate limiting, and JWT fail-fast validation. -5. [**Real-Time Brain Synchronization & Gitea Push Mirroring**](guides/brain-sync-and-gitea-mirroring.md) - - Zero-overhead markdown synchronization architecture between laptop and server using Gitea push mirroring. - - Systemd timer reconciliation, instant `doc2site` reflection, and GitHub offsite backup. -6. [**WhatsApp & Telegram AI Assistant Backend Architecture**](guides/chatbot-assistant-backend-architecture.md) +4. [**WhatsApp & Telegram AI Assistant Backend Architecture**](guides/chatbot-assistant-backend-architecture.md) - Architecture, channel trade-offs (Telegram vs WhatsApp), APScheduler cron triggers, and Brain vault RAG integration. diff --git a/projects/homelab/plans/core-sites-cutover-testing-plan.md b/projects/homelab/plans/appctl/core-sites-cutover-testing-plan.md similarity index 99% rename from projects/homelab/plans/core-sites-cutover-testing-plan.md rename to projects/homelab/plans/appctl/core-sites-cutover-testing-plan.md index d7b29af..d543bf9 100644 --- a/projects/homelab/plans/core-sites-cutover-testing-plan.md +++ b/projects/homelab/plans/appctl/core-sites-cutover-testing-plan.md @@ -2,6 +2,11 @@ type: plan status: active project: homelab +tags: + - appctl + - homelab + - cutover + - migration --- # 🚀 Migration, Testing & Safe Cutover Plan: `~/Deployments` ➔ `~/Core` + `~/Sites` diff --git a/projects/homelab/guides/appctl-git-sync-and-lifecycle.md b/projects/homelab/plans/appctl/git-sync-and-lifecycle.md similarity index 98% rename from projects/homelab/guides/appctl-git-sync-and-lifecycle.md rename to projects/homelab/plans/appctl/git-sync-and-lifecycle.md index 7df3999..035df90 100644 --- a/projects/homelab/guides/appctl-git-sync-and-lifecycle.md +++ b/projects/homelab/plans/appctl/git-sync-and-lifecycle.md @@ -1,6 +1,11 @@ --- type: guide project: homelab +tags: + - homelab + - appctl + - git + - devops --- # 🔄 appctl Git Synchronization & Full-Stack Lifecycle Strategy diff --git a/projects/homelab/guides/appctl-refactor-and-metadata-sync.md b/projects/homelab/plans/appctl/refactor-and-metadata-sync.md similarity index 99% rename from projects/homelab/guides/appctl-refactor-and-metadata-sync.md rename to projects/homelab/plans/appctl/refactor-and-metadata-sync.md index 8b2b5b1..4bdcbc8 100644 --- a/projects/homelab/guides/appctl-refactor-and-metadata-sync.md +++ b/projects/homelab/plans/appctl/refactor-and-metadata-sync.md @@ -1,6 +1,10 @@ --- type: guide project: homelab +tags: + - homelab + - appctl + - metadata --- # 🚀 appctl Refactor & Decentralized `app.yaml` Metadata Architecture diff --git a/projects/homelab/guides/brain-sync-and-gitea-mirroring.md b/projects/homelab/plans/gitea/brain-sync-and-gitea-mirroring.md similarity index 99% rename from projects/homelab/guides/brain-sync-and-gitea-mirroring.md rename to projects/homelab/plans/gitea/brain-sync-and-gitea-mirroring.md index 85c0c18..4b0ae9d 100644 --- a/projects/homelab/guides/brain-sync-and-gitea-mirroring.md +++ b/projects/homelab/plans/gitea/brain-sync-and-gitea-mirroring.md @@ -1,8 +1,13 @@ --- type: guide project: homelab +tags: + - gitea + - brain + - sync + - gitops + - homelab --- - # 🧠 Real-Time Brain Synchronization & Gitea Push Mirroring ## 🎯 Motivation & Objectives diff --git a/projects/homelab/plans/deployment-and-cicd-strategy.md b/projects/homelab/plans/gitea/deployment-and-cicd-strategy.md similarity index 98% rename from projects/homelab/plans/deployment-and-cicd-strategy.md rename to projects/homelab/plans/gitea/deployment-and-cicd-strategy.md index c7489f4..4dac2a8 100644 --- a/projects/homelab/plans/deployment-and-cicd-strategy.md +++ b/projects/homelab/plans/gitea/deployment-and-cicd-strategy.md @@ -2,6 +2,11 @@ type: plan status: active project: homelab +tags: + - gitea + - cicd + - gitops + - homelab --- # 🚀 Deployment & CI/CD Strategy diff --git a/projects/homelab/plans/gitea/gitea-git-helper-and-backup-strategy.md b/projects/homelab/plans/gitea/gitea-git-helper-and-backup-strategy.md new file mode 100644 index 0000000..fd7e318 --- /dev/null +++ b/projects/homelab/plans/gitea/gitea-git-helper-and-backup-strategy.md @@ -0,0 +1,123 @@ +--- +type: discussion +project: homelab +tags: + - gitea + - git + - backup + - homelab +--- + +# Discussion: Gitea Git Credential Helper, Protocol Trade-Offs, and Hybrid Backup Architecture + +## 1. Context & Motivation + +While expanding `knowledge/tools/tea.md`, an evaluation arose regarding whether to configure Gitea (via the `tea` CLI) as a Git credential helper, and how local Git workflows should adapt to a hybrid topology: +- **Primary Forge**: Self-hosted Gitea instance (`gitea.roadtotech.me`) running Gitea Actions for automated CI/CD pipelines. +- **Secondary / Backup Forge**: GitHub (`github.com`) as a public cloud warm backup. +- **Questions addressed**: + 1. What is the role of a Git helper, and does configuring Gitea as one provide tangible value? + 2. How does `tea` compare to GitHub's `gh` credential helper, and what are its limitations? + 3. What is the optimal architecture for keeping repositories synchronized between self-hosted Gitea and GitHub? + +--- + +## 2. Demystifying the Git Helper + +### The Role of a Credential Helper +Git core does not include native persistent storage for network credentials. When performing operations over **HTTPS** (e.g., `git clone https://...`, `git push origin main`), Git invokes a helper program (`git credential-`) implementing standard subcommands (`get`, `store`, `erase`) to retrieve HTTP Basic Auth credentials or access tokens without prompting the user on every transaction. + +### The Critical Protocol Divide: HTTPS vs. SSH +A credential helper is strictly scoped to the **HTTPS** transport protocol: +- **HTTPS (`https://...`)**: Passes tokens/passwords through the Git credential helper subsystem. +- **SSH (`git@...`)**: Authentication is handled entirely by OpenSSH (`ssh-agent`, public/private key pairs such as `~/.ssh/id_ed25519`). Git delegates the network transport directly to the SSH binary. Credential helpers are never queried or invoked. + +Because local developer configurations (such as `gh.settings.git_protocol = "ssh"` in `Config/modules/user/base.nix`) already standardize on SSH for day-to-day work, a Git credential helper remains completely inactive during standard SSH pushes and pulls. + +--- + +## 3. Comparative Analysis: `tea` vs. `gh` + +| Dimension | GitHub CLI (`gh auth git-credential`) | Gitea CLI (`tea login helper`) | +| :--- | :--- | :--- | +| **Authentication Flow** | Interactive OAuth web flows, 2FA prompts, or ephemeral personal tokens. | Static Personal Access Token (PAT) configured during `tea login add`. | +| **Lifecycle & Expiry** | Dynamically refreshes expiring OAuth tokens in the background. | Completely static; if the PAT expires or is revoked, Git fails until updated in `~/.config/tea/config.yml`. | +| **Target Scope** | Defaults to `credential.https://github.com`. | Defaults to `credential.https://`. | +| **Namespace Isolation** | Domain-scoped in Git config. | Domain-scoped in Git config. **Both helpers can coexist without conflicts.** | +| **NixOS Compatibility** | Declaratively handled via `programs.gh`. | Attempts imperative runtime `git config --global`, which fails (`exit status 255`) on NixOS due to read-only symlinks to `/nix/store`. | + +--- + +## 4. Trade-Off Evaluation: Should Gitea be Configured as a Git Helper? + +### Benefits +1. **Frictionless HTTPS Fallback**: Facilitates cloning private repositories via HTTPS without manual token prompts. +2. **Firewall Resilience**: If outbound SSH (port 22) is blocked (e.g., corporate networks, restrictive Wi-Fi), operations can fall back to HTTPS (port 443) seamlessly. +3. **No Cross-Forge Pollution**: Because Git matches helpers by explicit URL prefixes (e.g., `[credential "https://gitea.roadtotech.me"]`), configuring `tea` does not interfere with GitHub configurations. + +### Costs & Limitations +1. **NixOS Friction**: Cannot be registered imperatively via `tea login add` without triggering `exit status 255`. It must be declared explicitly in Home Manager (`programs.git.settings`). +2. **Maintenance Overhead**: Static tokens require manual renewal and re-configuration upon expiration. +3. **Redundancy**: With SSH keys deployed to both Gitea and GitHub, credential helpers provide no utility for standard development flows. + +### Conclusion +**Rely on SSH as the primary transport for daily development.** Configure `tea login helper` only if HTTPS fallback is specifically required, and do so declaratively in Home Manager rather than imperatively through the CLI. + +--- + +## 5. Architectural Blueprint: Self-Hosted Primary with Cloud Backup + +To fulfill the goal of self-hosting all repositories with Gitea Actions CI/CD while maintaining GitHub as a backup, two structural models exist: + +### Model A: Server-Side Push Mirroring (Recommended) + +```text +Local Workstation + │ + ▼ git push (SSH) +Gitea Instance (Primary) + ├── 1. Triggers local Gitea Actions (CI/CD) + └── 2. Push Mirror Daemon ──(Background Sync)──> GitHub (Backup) +``` + +1. **Workflow**: + - The developer pushes exclusively to Gitea: `git push origin main`. + - Gitea Actions picks up the push and runs automated tests/builds. + - Gitea's native **Push Mirror** automatically synchronizes all branches, tags, and commits to the corresponding GitHub repository. +2. **Advantages**: + - **Zero Local Overhead**: Single push command; no duplicate network egress from the local workstation. + - **Resilience**: If GitHub experiences downtime or rate limits, local work is unaffected; Gitea queues and retries the mirror sync automatically. + - **Guaranteed Parity**: The backup mirror is updated server-to-server immediately upon receipt. + +### Model B: Dual Push Remotes (Client-Side) + +1. **Configuration**: + ```gitconfig + [remote "origin"] + url = git@gitea.roadtotech.me:kiskaadee/repo.git + pushurl = git@gitea.roadtotech.me:kiskaadee/repo.git + pushurl = git@github.com:kiskaadee/repo.git + ``` +2. **Trade-offs**: + - Requires double upload bandwidth on the workstation. + - If one forge hangs or fails, the entire push command can fail or partially complete, requiring manual reconciliation. + +--- + +## 6. Actionable Implementation Path + +1. **Gitea SSH Authentication**: Add `~/.ssh/id_ed25519.pub` to the Gitea profile (`Settings -> SSH / GPG Keys`). +2. **Repository Mirroring Setup**: + - In Gitea, open **Repo Settings -> Repository -> Push Mirrors**. + - Set remote address to `https://github.com/kiskaadee/.git` (or SSH deploy key). + - Enter GitHub Personal Access Token with repository write permissions. + - Enable sync on push. +3. **Declarative HTTPS Fallback (Optional)**: + If HTTPS support is desired, add the following to `modules/user/base.nix`: + ```nix + programs.git.settings = { + "credential \"https://gitea.roadtotech.me\"" = { + helper = "tea login helper"; + }; + }; + ``` diff --git a/projects/homelab/plans/domain-migration-roadtotech.md b/projects/homelab/plans/server-24-7/domain-migration-roadtotech.md similarity index 96% rename from projects/homelab/plans/domain-migration-roadtotech.md rename to projects/homelab/plans/server-24-7/domain-migration-roadtotech.md index ec0b922..43d4bff 100644 --- a/projects/homelab/plans/domain-migration-roadtotech.md +++ b/projects/homelab/plans/server-24-7/domain-migration-roadtotech.md @@ -1,7 +1,12 @@ --- type: plan -status: active +status: completed project: homelab +tags: + - homelab + - server + - ddns + - domain --- # 🌐 Domain Migration Plan: `arch-services.mywire.org` ➔ `roadtotech.me` diff --git a/projects/homelab/plans/folder-structure-reorganization.md b/projects/homelab/plans/server-24-7/folder-structure-reorganization.md similarity index 96% rename from projects/homelab/plans/folder-structure-reorganization.md rename to projects/homelab/plans/server-24-7/folder-structure-reorganization.md index 5c92fc6..731aa41 100644 --- a/projects/homelab/plans/folder-structure-reorganization.md +++ b/projects/homelab/plans/server-24-7/folder-structure-reorganization.md @@ -2,6 +2,11 @@ type: plan status: active project: homelab +tags: + - homelab + - server + - storage + - hygiene --- # 📁 Server Folder Structure & Production Hygiene diff --git a/projects/homelab/plans/lvm-storage-optimization-and-resizing.md b/projects/homelab/plans/server-24-7/lvm-storage-optimization-and-resizing.md similarity index 98% rename from projects/homelab/plans/lvm-storage-optimization-and-resizing.md rename to projects/homelab/plans/server-24-7/lvm-storage-optimization-and-resizing.md index d2b9000..a933a41 100644 --- a/projects/homelab/plans/lvm-storage-optimization-and-resizing.md +++ b/projects/homelab/plans/server-24-7/lvm-storage-optimization-and-resizing.md @@ -2,6 +2,11 @@ type: plan status: active project: homelab +tags: + - homelab + - lvm + - storage + - server --- # 💾 LVM Storage Optimization & Partition Resizing Strategy diff --git a/projects/homelab/plans/nixos-server-laptop-migration.md b/projects/homelab/plans/server-24-7/nixos-server-laptop-migration.md similarity index 97% rename from projects/homelab/plans/nixos-server-laptop-migration.md rename to projects/homelab/plans/server-24-7/nixos-server-laptop-migration.md index b9654c3..99c77c1 100644 --- a/projects/homelab/plans/nixos-server-laptop-migration.md +++ b/projects/homelab/plans/server-24-7/nixos-server-laptop-migration.md @@ -2,6 +2,12 @@ type: plan status: active project: homelab +tags: + - homelab + - nixos + - migration + - server + - laptop --- # 🖥️ NixOS Server & Laptop Workstation Migration