Files
second-brain/projects/homelab/plans/deployment-and-cicd-strategy.md
T
kiskaadee a1152d4075 docs(brain): add document metadata frontmatter
Add YAML frontmatter to all 54 retained markdown documents.
Frontmatter schema is type-specific — no universal status field.

Type contracts applied:
- knowledge: type + status (draft|stable) + topics
- project:   type + status (planned|active|paused|completed)
- plan:      type + status + project context
- guide:     type + project context (no lifecycle status)
- journal:   type + date (no status — journals are historical by definition)
- practice:  type + status (completed|active) + topics
- inbox:     type + created date

54 documents tagged across:
  knowledge/concepts/     (3)
  knowledge/technologies/ (7, including python/ subdirectory with 4)
  knowledge/methods/      (6)
  projects/homelab/       (1 overview + 6 plans + 6 guides)
  projects/magnetflix/    (1)
  projects/nekoweb/       (1)
  records/journal/        (7)
  practice/LeetCode/      (14)
  inbox/                  (1)
2026-09-05 21:49:17 -05:00

63 lines
2.3 KiB
Markdown

---
type: plan
status: active
project: homelab
---
# 🚀 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 (Pull Model - Recommended)
- **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 or open firewall ports needed from CI into homelab.
- **Cons**: Less granular control over immediate rollbacks.
### 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 <service> && appctl restart <service>`.
- **Pros**: Full visibility, reproducible deployments, direct log output in CI UI.
---
## 🎯 Candidate Pilot Services for CI/CD
The following micro-repos are selected as prioritized pilot targets for automated CI/CD pipelines:
1. **`homelab-landing`** (`~/Sites/homelab-landing`):
- Pure static/nginx web portal (`roadtotech.me`).
- Fast, low-risk playground to test multi-stage Docker build, GHCR push, and automated deployment.
2. **`homelab-dashboard`** (`~/Sites/homelab-dashboard`):
- Fast-evolving Learning Hub API backend & Homepage customization.
- Ideal for testing pytest/linting pipelines before publishing.
3. **`homelab-minecraft`** (`~/Sites/homelab-minecraft`):
- Custom FastAPI Identity Manager Web Admin.
- Ideal for testing Python security linters, JWT validation, and container packaging.