# Deployment Conventions This document describes the GitOps-lite deployment process for the homelab. ## Principles 1. **Git as Source of Truth**: All infrastructure definitions (Docker Compose, configurations) are stored in Git. 2. **Unidirectional Flow**: Changes flow from **SATURN** (commit node) to execution nodes. 3. **Lightweight**: No complex orchestrators (no Kubernetes). Use `docker compose` and simple shell scripts. 4. **Tailscale Mesh**: All hosts are connected via Tailscale, allowing secure communication without public port exposure. 5. **Host Autonomy**: Services that must operate during WAN or Git outages keep their runtime dependencies on the execution node or local LAN. ## Deployment Process ### 1. Preparation (on SATURN) - Modify or create service definitions in `services/`. - Assign services to hosts by creating/updating `hosts//services.txt` (or similar mapping). - Commit and push changes to the Forgejo instance. ### 2. Deployment (on Execution Node) Execution nodes run a deployment script (e.g., via cron or manual trigger) that: 1. Performs a `git pull` from the source of truth. 2. Identifies services assigned to this host. 3. Symlinks or copies `services//docker-compose.yml` to `/opt/homelab/services/`. 4. Runs `docker compose up -d --remove-orphans`. ## Host-Local Overrides If a service requires host-specific configuration (e.g., unique device paths for GPUs on SOLARIA): 1. Create a `docker-compose.override.yml` in `/opt/homelab/config//`. 2. The deployment script should include this override if it exists. For CHELSTY Home Assistant infrastructure, host-local configuration is the authority for runtime identity, secrets, and local device endpoints: - Home Assistant config: `/opt/homelab/config/homeassistant` - Zigbee2MQTT config: `/opt/homelab/config/zigbee2mqtt` - Mosquitto config: `/opt/homelab/config/mosquitto` CHELSTY services must not require SATURN, VPS, or Forgejo to be reachable after deployment has completed. Docker Compose definitions can still come from Git, but Home Assistant automation, Zigbee control, and MQTT messaging must continue locally while LTE or Tailscale connectivity is unavailable. ## Exposure Classes Service inventory may declare one of these exposure classes: - `local-only`: bind only to host, LAN, or container networks. This is the default for Zigbee2MQTT and Mosquitto. - `tailscale-internal`: reachable over Tailscale only. This is appropriate for Home Assistant remote administration. - `public`: reachable from the public internet through a deliberate ingress path, normally the VPS edge role. Public exposure is not implied by a service existing in Git. It must be explicit in host inventory and ingress configuration. ## CHELSTY Home Automation Deployment Notes CHELSTY remains a Docker Compose execution node. No Kubernetes, Helm, Ansible, or additional orchestration layer is required for Home Assistant infrastructure. The SLZB-06U coordinator is network-connected over Ethernet or WiFi. Compose files and host overrides should configure Zigbee2MQTT for a TCP/network coordinator endpoint, not a USB serial device. Avoid `/dev/ttyUSB0` mappings. Runtime paths follow the standard layout: - `/opt/homelab/data/homeassistant` - `/opt/homelab/config/homeassistant` - `/opt/homelab/logs/homeassistant` - `/opt/homelab/data/zigbee2mqtt` - `/opt/homelab/config/zigbee2mqtt` - `/opt/homelab/logs/zigbee2mqtt` - `/opt/homelab/data/mosquitto` - `/opt/homelab/config/mosquitto` - `/opt/homelab/logs/mosquitto` Recommended backup coverage: - Home Assistant config and persistent data before upgrades or major integration changes. - Zigbee2MQTT config, database, coordinator backup files, and Zigbee network key material. - SLZB-06U firmware version, exported configuration, network address reservation, and coordinator state. - Mosquitto config, ACL/password files, persistence data, and bridge configuration if enabled. ## Secrets Management - **Do NOT commit secrets to Git.** - Secrets should be placed in `/opt/homelab/config//.env` on the target host. - The deployment script should ensure these are sourced by Docker Compose.