Deploy Gitea via Helm with dedicated CloudNativePG database, in-cluster Actions runner (DinD), and built-in container registry. ArgoCD repoURLs updated to use in-cluster Gitea SSH. Preview ApplicationSet switched from GitHub PR generator to Gitea PR generator. App images now pull from gitea.coreworlds.io registry. Remaining setup after deploy: seal runner token, ArgoCD API token, and registry pull secret once Gitea is running. Add ArgoCD deploy key to Gitea repo settings.
2.2 KiB
2.2 KiB
Homelab Monorepo
Overview
Monorepo for frontend/backend apps deployed to a k3s cluster on Intel NUC machines. GitOps via ArgoCD, bare-metal provisioning via Ansible, Turborepo for app builds.
Tech Stack
- Monorepo: Turborepo + pnpm workspaces
- Apps: Next.js (frontend), Express (API), TypeScript
- Infrastructure: k3s, ArgoCD, Ansible
- Platform: Traefik, cert-manager, CloudNativePG, Valkey, Longhorn, Sealed Secrets
- Observability: kube-prometheus-stack, Loki, Promtail, Grafana
- CI/CD: Gitea Actions → gitea.coreworlds.io registry → ArgoCD
- Task Runner: Taskfile (go-task)
Directory Structure
apps/— Deployable applications (each has src/, Dockerfile, k8s/ manifests)packages/— Shared libraries (ui, config-eslint, config-typescript, db)infra/ansible/— Bare-metal provisioning playbooks and rolesinfra/kubernetes/— K8s manifests (argocd, platform, observability, namespaces)infra/ubiquiti/— Network documentation for Ubiquiti Cloud Gatewayscripts/— Utility scripts (new-app, seal-secret, kubeconfig-fetch)templates/— Copier templates for scaffolding new apps
Conventions
- All apps use Kustomize with base + overlays (preview, production)
- K8s manifests live inside each app at
k8s/ - Secrets are sealed with kubeseal before committing
- Branch deploys create
preview-<PR#>namespaces automatically - Use
task <command>for all operations (see Taskfile.yaml) - Docker images tagged with git SHA, pushed to gitea.coreworlds.io registry
- Git hosted on self-hosted Gitea, GitHub is a read-only push mirror
- Gitea Actions runners: in-cluster (amd64), Mac (arm64), Windows (WSL2)
Common Commands
task dev # Start all apps in dev mode
task build # Build all apps
task lint # Lint everything
task cluster:bootstrap # Provision NUCs with Ansible
task cluster:kubeconfig # Fetch kubeconfig from server node
task platform:install # Bootstrap ArgoCD + platform
task secrets:seal # Seal a secret for git
Testing
- Run
task testfor all tests - Run
task lintfor linting (includes ansible-lint) - K8s manifests:
kubectl apply --dry-run=client -f <file> - Kustomize:
kustomize build <dir>to verify rendering