Commit Graph

6 Commits

Author SHA1 Message Date
79db119d1c feat: add Prometheus metrics to listener service
Add an optional Prometheus metrics HTTP endpoint to the listener for
monitoring deployment operations. Includes four metrics:

- homelab_deploy_deployments_total (counter with status/action/error_code)
- homelab_deploy_deployment_duration_seconds (histogram with action/success)
- homelab_deploy_deployment_in_progress (gauge)
- homelab_deploy_info (gauge with hostname/tier/role/version)

New CLI flags: --metrics-enabled, --metrics-addr (default :9972)
New NixOS options: metrics.enable, metrics.address, metrics.openFirewall

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 07:58:22 +01:00
cf3b1ce2c9 refactor: use flake package directly in NixOS module
Instead of requiring users to provide the package via overlay,
the module now receives `self` from the flake and uses the
package directly from `self.packages`.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 05:08:02 +01:00
95fbfb2339 chore: extract version from main.go in flake.nix
Use builtins.match to parse version from cmd/homelab-deploy/main.go
so only one location needs updating when bumping versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 04:25:38 +01:00
fa49e9322a feat: implement NATS-based NixOS deployment system
Implement the complete homelab-deploy system with three operational modes:

- Listener mode: Runs on NixOS hosts as a systemd service, subscribes to
  NATS subjects with configurable templates, executes nixos-rebuild on
  deployment requests with concurrency control

- MCP mode: MCP server exposing deploy, deploy_admin, and list_hosts
  tools for AI assistants with tiered access control

- CLI mode: Manual deployment commands with subject alias support via
  environment variables

Key components:
- internal/messages: Request/response types with validation
- internal/nats: Client wrapper with NKey authentication
- internal/deploy: Executor with timeout and lock for concurrency
- internal/listener: Subject template expansion and request handling
- internal/cli: Deploy logic with alias resolution
- internal/mcp: MCP server with mcp-go integration
- nixos/module.nix: NixOS module with hardened systemd service

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 04:19:47 +01:00
1460cc533d chore: add CLAUDE.md and configure nix dev shell
Add CLAUDE.md with project guidance for Claude Code including
architecture overview, build commands, and testing procedures.

Update flake.nix with proper Go development shell (go, gopls,
gotools, golangci-lint, govulncheck, delve) and buildGoModule
package definition.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 03:16:20 +01:00
737bb162c9 chore: initial commit with scaffolding and design doc 2026-02-07 03:07:30 +01:00