diff --git a/README.md b/README.md index 1de8da3..008bcb4 100644 --- a/README.md +++ b/README.md @@ -1 +1,22 @@ -# second-brain +# 🧠 Second Brain + +Central repository for personal knowledge management, architecture plans, roadmaps, homelab infrastructure designs, and project tracking. + +--- + +## 🧭 Navigation & Areas + +| Area | Focus & Purpose | Key Documents | +| :--- | :--- | :--- | +| [**Homelab & Infrastructure**](homelab/README.md) | Systems architecture, NixOS migrations, DNS, CI/CD, and `appctl`. | [NixOS Server & Laptop Migration](homelab/nixos-server-laptop-migration.md)
[Domain Migration (`roadtotech.me`)](homelab/domain-migration-roadtotech.md)
[Appctl & Repositories Architecture](homelab/homelab-appctl-architecture.md)
[CI/CD & Deployment Strategy](homelab/deployment-and-cicd-strategy.md)
[Production Folder Structure](homelab/folder-structure-reorganization.md) | +| [**Projects**](projects/README.md) | Active software projects, architecture notes, and feature roadmaps. | [MagNetFlix](projects/magnetflix.md)
[Nekoweb](projects/nekoweb.md) | +| [**Learning & Growth**](learning/README.md) | Academic tracking, residency curriculum milestones, and notes. | [Backend Residency Roadmap](learning/backend-residency.md) | + +--- + +## 🎯 Active Strategic Goals + +1. **Host Roles Separation**: Transition the desktop workstation into a dedicated 24/7 headless NixOS production server, making the laptop the primary graphical workstation. +2. **Domain Migration**: Move from Dynu's free subdomain (`arch-services.mywire.org`) to owned domain (`roadtotech.me`). +3. **Repository Decoupling**: Extract monolithic deployments into standalone Git repositories with CI/CD and manage lifecycles using `appctl`. +4. **Clean Production State**: Remove non-production and development artifacts from the server machine. diff --git a/homelab/README.md b/homelab/README.md new file mode 100644 index 0000000..1cb5a7f --- /dev/null +++ b/homelab/README.md @@ -0,0 +1,23 @@ +# 🌐 Homelab & Infrastructure Planning + +This section documents the architectural roadmaps, infrastructure designs, deployment automation, and system administration workflows for the homelab ecosystem. + +--- + +## πŸ“‘ Index of Plans + +1. [**NixOS Server & Laptop Migration**](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`)**](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. [**Homelab Infrastructure & Appctl Architecture**](homelab-appctl-architecture.md) + - Making `appctl` a first-class homelab orchestrator. + - Decoupling monolithic deployments into individual standalone Git repositories. +4. [**CI/CD & Deployment Strategy**](deployment-and-cicd-strategy.md) + - Automating image builds, GitOps updates, Gitea Actions/GitHub Actions, and production rollouts. +5. [**Production Folder Structure Reorganization**](folder-structure-reorganization.md) + - Establishing strict directory boundaries (`/home/kiskaadee/Production`, `/home/kiskaadee/Deployments`, `/home/kiskaadee/Projects`). + - Removing development traces and non-production scratchpads from the server. diff --git a/homelab/deployment-and-cicd-strategy.md b/homelab/deployment-and-cicd-strategy.md new file mode 100644 index 0000000..eaf05b8 --- /dev/null +++ b/homelab/deployment-and-cicd-strategy.md @@ -0,0 +1,39 @@ +# πŸš€ Deployment & CI/CD Strategy + +## 🎯 Objective +Automate the build, test, containerization, and deployment lifecycle for services hosted in the homelab. + +--- + +## πŸ”„ CI/CD Pipelines Overview + +```mermaid +sequenceDiagram + autonumber + actor Dev as Developer (Laptop) + participant Git as Git Remote (Gitea / GitHub) + participant CI as CI Runner (Actions) + participant Registry as Container Registry (GHCR / Local Registry) + participant Server as 24/7 Homelab Server + + Dev->>Git: git push (feat/fix branch -> main) + Git->>CI: Trigger Build & Test workflow + CI->>CI: Run Linters & Unit Tests + CI->>Registry: Build multi-stage Docker image & Push + CI->>Server: Trigger GitOps Deploy / Webhook / SSH appctl pull + Server->>Registry: Pull new image + Server->>Server: Restart container with zero/minimal downtime +``` + +--- + +## πŸ› οΈ Implementation Approaches + +### 1. Webhooks & Watchtower / Diun +- **Approach**: CI pushes tagged images to GHCR. Watchtower/Diun running on the server detects new digest and automatically updates containers. +- **Pros**: Zero inbound SSH keys needed from CI into homelab. +- **Cons**: Less granular control over rollback logic. + +### 2. GitOps with Gitea Actions / GitHub Actions Runner +- **Approach**: Run a self-hosted lightweight Gitea runner on the server. On release/push to `main`, the runner executes `appctl pull && appctl restart `. +- **Pros**: Full visibility, reproducible deployments, direct log output in CI UI. diff --git a/homelab/domain-migration-roadtotech.md b/homelab/domain-migration-roadtotech.md new file mode 100644 index 0000000..646ece4 --- /dev/null +++ b/homelab/domain-migration-roadtotech.md @@ -0,0 +1,38 @@ +# 🌐 Domain Migration Plan: `arch-services.mywire.org` βž” `roadtotech.me` + +## 🎯 Objective +Migrate all homelab public endpoints, Authelia single sign-on (SSO), Traefik reverse proxy routers, and SSL certificates from Dynu's free subdomain (`arch-services.mywire.org`) to the custom registered domain (`roadtotech.me`). + +--- + +## πŸ› οΈ DNS & Provider Strategies + +### Option A: Dynu Custom Domain (Zero Traefik Changes) +1. In Hostinger registrar, set Custom Nameservers: `ns1.dynu.com` ... `ns6.dynu.com`. +2. In Dynu Control Panel, add `roadtotech.me` under DDNS services. +3. Keep Traefik ACME resolver as `provider=dynu` with existing `DYNU_API_KEY`. +4. Update NixOS environment declarations to `DOMAIN = "roadtotech.me"`. + +### Option B: Cloudflare DNS (Homelab Industry Standard) +1. In Hostinger registrar, set Cloudflare Nameservers. +2. In Cloudflare, create an `A` record or dynamic DNS updater with API token. +3. Switch Traefik ACME resolver to `provider=cloudflare` with `CF_DNS_API_TOKEN`. + +--- + +## πŸ“‹ Implementation Checklist + +- [ ] **Step 1: DNS Setup & Propagation Verification** + - Add domain to chosen DNS manager. + - Create wildcard record: `*.roadtotech.me` βž” Target WAN IP. + - Verify DNS resolution via `dig roadtotech.me +short` and `dig test.roadtotech.me +short`. +- [ ] **Step 2: Update Declarative NixOS Configuration** + - `hosts/desktop/homeserver.nix`: Change `DOMAIN` to `"roadtotech.me"`. + - `hosts/desktop/traefik-deployments.nix`: Update `DOMAIN_SUFFIX` and subdomain variables (`DOCS_DOMAIN`, `GITEA_DOMAIN`, etc.). + - `hosts/desktop/secrets.yaml`: Update DDNS domain variable if stored in SOPS. +- [ ] **Step 3: Traefik & SSL Validation** + - Trigger Traefik reload/restart. + - Inspect Traefik logs to confirm Let's Encrypt DNS-01 challenge completion for `roadtotech.me` and `*.roadtotech.me`. +- [ ] **Step 4: Authelia & Cookie Verification** + - Authenticate against `https://auth.roadtotech.me`. + - Verify SSO forward-auth across subdomains (`gitea.roadtotech.me`, `jellyfin.roadtotech.me`, etc.). diff --git a/homelab/folder-structure-reorganization.md b/homelab/folder-structure-reorganization.md new file mode 100644 index 0000000..9d0f0e0 --- /dev/null +++ b/homelab/folder-structure-reorganization.md @@ -0,0 +1,37 @@ +# πŸ“ Server Folder Structure & Production Hygiene + +## 🎯 Objective +Establish clear, unambiguous directory boundaries across both the Server and Laptop to prevent development clutter from mixing with 24/7 production services. + +--- + +## πŸ—ΊοΈ Standardized Directory Layout + +### πŸ–₯️ Production Server Layout +```text +/home/kiskaadee/ +β”œβ”€β”€ Config/ # NixOS declarative configuration for this host +β”œβ”€β”€ Deployments/ # Or Production/ - Live Docker compose services (Git tracked) +β”‚ β”œβ”€β”€ core/ # Ingress (Traefik, Authelia, Socket-Proxy) +β”‚ β”œβ”€β”€ apps/ # Individual standalone services +β”‚ └── data/ # Persistent volumes or bind-mount configs +β”œβ”€β”€ Media/ # Jellyfin media libraries, recordings, storage +└── second-brain/ # Synced knowledge base & operational docs +``` + +*Rule for Server*: +- **No** active development trees, compiler build caches (`target/`, `node_modules/` in home), or transient scratchpads. +- All running services run as containers or declarative systemd units. + +--- + +### πŸ’» Laptop Workstation Layout +```text +/home/kiskaadee/ +β”œβ”€β”€ Config/ # Shared NixOS repository (laptop configuration) +β”œβ”€β”€ Projects/ # Active source code repositories +β”œβ”€β”€ Learn/ # Backend residency and study coursework +β”œβ”€β”€ Experiments/ # Prototypes, spike tests, scratchpads +β”œβ”€β”€ second-brain/ # Personal notes & architecture plans +└── Downloads/ / Pictures/ # Standard user directories +``` diff --git a/homelab/homelab-appctl-architecture.md b/homelab/homelab-appctl-architecture.md new file mode 100644 index 0000000..f9b06d0 --- /dev/null +++ b/homelab/homelab-appctl-architecture.md @@ -0,0 +1,37 @@ +# πŸ“¦ Homelab Architecture: Appctl & Independent Repositories + +## 🎯 Vision & Goals +1. **Decouple Deployments**: Break monolithic multi-service compose stacks into isolated, independently version-controlled Git repositories. +2. **First-Class Orchestrator (`appctl`)**: Standardize service lifecycle management (start, stop, logs, update, backup, healthcheck) via `appctl`. + +--- + +## πŸ›οΈ Architecture Model + +```text +/home/kiskaadee/Production/ (or /srv/deployments/) +β”œβ”€β”€ core-ingress/ # Traefik, Authelia, Socket-Proxy (Git repo) +β”œβ”€β”€ gitea/ # Gitea & Gitea Actions runner (Git repo) +β”œβ”€β”€ jellyfin/ # Media server stack (Git repo) +β”œβ”€β”€ magnetflix/ # MagNetFlix app & microservices (Git repo) +β”œβ”€β”€ nekoweb/ # Haruneko / Nekoweb deployments (Git repo) +└── docs/ # Astro / Starlight documentation (Git repo) +``` + +Each service directory contains: +- `compose.yaml` (clean, self-contained Docker Compose file) +- `.env` / environment variable template linked to `/run/secrets/` +- Custom Dockerfiles or build scripts if applicable + +--- + +## βš™οΈ `appctl` Responsibilities + +`appctl` acts as the unified CLI wrapper across all production services: +- `appctl list`: Discover registered production services and their operational statuses. +- `appctl up `: Start container stack using standard networks (`proxy-net`, `socket-net`). +- `appctl down `: Gracefully stop container stack. +- `appctl restart `: Restart service. +- `appctl pull `: Pull latest container images and trigger zero-downtime recreation. +- `appctl logs [-f]`: Stream container logs. +- `appctl status `: Inspect health status and resource consumption. diff --git a/homelab/nixos-server-laptop-migration.md b/homelab/nixos-server-laptop-migration.md new file mode 100644 index 0000000..c133111 --- /dev/null +++ b/homelab/nixos-server-laptop-migration.md @@ -0,0 +1,56 @@ +# πŸ–₯️ NixOS Server & Laptop Workstation Migration + +## 🎯 Executive Summary +Transition the current physical machine (`desktop`) into a dedicated, headless, 24/7 homelab production server (`server`). Transfer all GUI workflows, desktop environments, and active development workspaces to the `laptop`. + +--- + +## πŸ—οΈ Architectural Topology + +```mermaid +graph LR + subgraph "Workstation (Laptop)" + A[NixOS Laptop] + A1[Niri / Hyprland / Wayland GUI] + A2[Alacritty / Foot / Browser] + A3[Active Code & Dev Workspaces] + end + + subgraph "Production (Server / Ex-Desktop)" + B[NixOS Headless Server 24/7] + B1[Docker & Traefik Core] + B2[Appctl / Service Orchestration] + B3[Databases, Media & Homelab Services] + end + + A -- "SSH / WireGuard / Git" --> B +``` + +--- + +## πŸ“‹ Phased Execution Roadmap + +### Phase 1: Laptop NixOS Baseline & Graphical Parity +- [ ] Install NixOS on the target laptop. +- [ ] Pull and configure `hosts/laptop/` from `nixos-config`. +- [ ] Move graphical stack definitions (Niri, Hyprland, Waybar, Mako, Rofi/Fuzzel, audio tools) to be enabled on `hosts/laptop/`. +- [ ] Verify GPU hardware acceleration (Intel/AMD/Nvidia drivers on laptop). +- [ ] Test user applications and shell environments on the laptop. + +### Phase 2: Workspaces & Project Data Transfer +- [ ] Migrate local development repositories from desktop to laptop: + - Working trees in `Projects/`, `Learn/`, `Experiments/`. +- [ ] Configure SSH keys, GPG keys, and GitHub/Gitea credentials on the laptop. +- [ ] Verify that all ongoing development compiles and runs natively on the laptop. + +### Phase 3: Server Configuration & Headless Conversion +- [ ] Refactor NixOS configuration repository: + - Rename/refactor `hosts/desktop` into `hosts/server` (or enforce pure headless specialization as default). + - Remove graphical packages, desktop managers, display managers (`greetd`), and desktop-only daemons from the server host. + - Keep homelab modules: `homeserver.nix`, `traefik-deployments.nix`, `dynu.nix`, Docker daemon, SOPS secrets. +- [ ] Set up robust unattended boot, power management (disable sleep/suspend on idle), and wake-on-LAN/systemd watchdog if applicable. +- [ ] Dry-build and validate server configuration (`nix build .#nixosConfigurations.server.config.system.build.toplevel --no-link`). + +### Phase 4: Production Hygiene & Decommissioning +- [ ] Clean up redundant folders on the server (e.g. personal browser profiles, desktop scratchpads, non-production experiments). +- [ ] Verify 24/7 stability, monitoring, and auto-restart of all Docker containers on boot. diff --git a/learning/README.md b/learning/README.md new file mode 100644 index 0000000..ea0efed --- /dev/null +++ b/learning/README.md @@ -0,0 +1,10 @@ +# πŸ“š Learning & Curriculum Tracking + +Overview of active technical studies, residencies, and skill development roadmaps. + +--- + +## πŸ“‘ Topics Index + +1. [**Backend Residency**](backend-residency.md) + - Curriculum milestones, projects, reading lists, and core competency goals. diff --git a/learning/backend-residency.md b/learning/backend-residency.md new file mode 100644 index 0000000..2bc2f60 --- /dev/null +++ b/learning/backend-residency.md @@ -0,0 +1,25 @@ +# πŸŽ“ Backend Residency Roadmap & Tracking + +## πŸ“Œ Context +The backend residency curriculum is focused on deep engineering fundamentals: systems programming, distributed systems, high-throughput backend services, database internals, and concurrency. + +*Active Workspace*: `/home/kiskaadee/Learn/backend-residency` + +--- + +## πŸ—ΊοΈ Core Pillars & Milestones + +### 1. Fundamentals & Networking +- [ ] Low-level TCP/UDP socket programming. +- [ ] HTTP/1.1, HTTP/2, and gRPC implementations. +- [ ] Protocol serialization (JSON, Protobuf, FlatBuffers). + +### 2. Databases & Storage Engines +- [ ] Relational databases (PostgreSQL queries, execution plans, indexing strategies). +- [ ] NoSQL / Document databases (MongoDB data modeling). +- [ ] Storage engine architecture (LSM-trees vs B-Trees, WAL, caching). + +### 3. Concurrency & Systems Architecture +- [ ] Multi-threading, event loops, async I/O models. +- [ ] Distributed locks, transactions, consensus mechanisms (Raft/Paxos). +- [ ] Message queues and streaming (Kafka / RabbitMQ / Redis PubSub). diff --git a/projects/README.md b/projects/README.md new file mode 100644 index 0000000..d320295 --- /dev/null +++ b/projects/README.md @@ -0,0 +1,12 @@ +# πŸ› οΈ Projects Hub + +Central tracker for active development projects, architecture notes, feature roadmaps, and deployment states. + +--- + +## πŸ“‘ Projects Index + +1. [**MagNetFlix**](magnetflix.md) + - Media streaming / torrent frontend & indexing ecosystem. +2. [**Nekoweb**](nekoweb.md) + - Haruneko personal web presence and static/dynamic publishing experiments. diff --git a/projects/magnetflix.md b/projects/magnetflix.md new file mode 100644 index 0000000..2e35ada --- /dev/null +++ b/projects/magnetflix.md @@ -0,0 +1,19 @@ +# 🎬 MagNetFlix + +## πŸ“Œ Project Overview +MagNetFlix is an integrated media application designed for exploring, streaming, and indexing media content. + +--- + +## 🎯 Architecture & Components +- **Frontend / Client**: Web UI for browsing media catalog, managing queues, and playback. +- **Backend Services**: API layer, scrapers/indexers, metadata fetchers (TMDB/OMDb), and torrent client bridge. +- **Data Persistence**: Database storage for library states, watch progress, and torrent sessions. + +--- + +## πŸ“‹ Roadmaps & Action Items +- [ ] Decouple into a standalone Git repository with isolated Docker build files. +- [ ] Configure GitHub Actions / Gitea Actions to build container images on release. +- [ ] Define declarative Traefik reverse proxy routing (`magnetflix.roadtotech.me`). +- [ ] Implement healthcheck endpoints and integrate with `appctl`. diff --git a/projects/nekoweb.md b/projects/nekoweb.md new file mode 100644 index 0000000..289579d --- /dev/null +++ b/projects/nekoweb.md @@ -0,0 +1,19 @@ +# 🐱 Nekoweb / Haruneko + +## πŸ“Œ Project Overview +Personal web presence, static/dynamic site generation, and online showcase deployed to Nekoweb / homelab infrastructure. + +--- + +## 🎯 Scope & Integrations +- **Web Assets**: HTML/CSS/JS frontend, themes, retro aesthetics, and interactive components. +- **Hosting / Deployments**: + - Direct Nekoweb integration or self-hosted mirror behind Traefik. + - Automated deployment on push via CI/CD. + +--- + +## πŸ“‹ Roadmaps & Action Items +- [ ] Establish standalone Git repository structure. +- [ ] Setup automated sync / upload script for Nekoweb API. +- [ ] Connect custom domain / subdomain routing if needed.