2.8 KiB
2.8 KiB
Deployment Conventions
This document describes the GitOps-lite deployment process for the homelab.
Principles
- Git as Source of Truth: All infrastructure definitions (Docker Compose, configurations) are stored in Git.
- Unidirectional Flow: Changes flow from SATURN (commit node) to execution nodes.
- Lightweight: No complex orchestrators (no Kubernetes). Use
docker composeand simple shell scripts. - Tailscale Mesh: All hosts are connected via Tailscale, allowing secure communication without public port exposure.
Staged Deployment Framework
The homelab uses a staged deployment framework located at scripts/deploy/deploy.sh. This script is designed to be resumable, stage-aware, and observable.
Deployment Stages
- prepare: Pulls the latest changes from Git, validates inventory, and prepares the local environment.
- deploy: Executes
docker composecommands for all assigned services. - verify: Checks the health and connectivity of deployed services.
- diagnose: Performs deep checks and resource analysis if something goes wrong.
- rollback: Reverts to a previous known-good state.
- resume: Automatically continues from the last successful stage.
State Tracking and Logging
- State: Local node state is tracked in
/opt/homelab/state/deploy/current_stage. - Logs: Detailed execution logs are stored in
/opt/homelab/logs/deploy/deploy_<timestamp>.log.
Operational Semantics
Deployment is hybrid:
- SATURN acts as the orchestrator and source of truth.
- Nodes execute the deployment locally using the
deploy.shscript. - Human-in-the-loop is required for triggering and confirming deployments.
Recovery Workflow
If a deployment fails:
- Run
deploy.sh diagnoseto identify the issue. - Use the
recover-nodeAI prompt to analyze logs and get recommendations. - Either fix the issue and run
deploy.sh resume, or usedeploy.sh rollback.
Onboarding New Nodes
Refer to inventory/templates/how_to_add_new_node.yaml for a detailed guide on adding new hardware to the mesh. The general flow is:
- Define node in
hosts/andinventory/topology.yamlon SATURN. - Bootstrap the node (Docker, Tailscale, Git).
- Run the staged deployment framework starting with
prepare.
Host-Local Overrides
If a service requires host-specific configuration (e.g., unique device paths for GPUs on SOLARIA):
- Create a
docker-compose.override.ymlin/opt/homelab/config/<service>/. - The deployment script should include this override if it exists.
Secrets Management
- Do NOT commit secrets to Git.
- Secrets should be placed in
/opt/homelab/config/<service>/.envon the target host. - The deployment script should ensure these are sourced by Docker Compose.