$ show AlchemillaHQ/Sylve
Sylve is an open-source FreeBSD infrastructure management platform written in Go. It provides a unified control plane for managing bhyve virtual machines, FreeBSD jails, ZFS storage, and networking (including VLANs, switches, DHCP, PF firewall, WireGuard, and mDNS). The system supports high-availability clustering via Hashicorp Raft consensus, with built-in backup/replication (Zelta) and live migration of workloads. It exposes a REST API (Gin), a CLI/REPL (Bubbletea TUI), and a SvelteKit web frontend. The architecture is modular with interface-based services, middleware for auth and request limiting, and a typed console protocol over Unix sockets. The codebase is heavily tested with unit, integration, and real-ZFS tests, and is licensed under BSD-2-Clause with sponsorship from the FreeBSD Foundation.
The LLM identified 5 files worth highlighting for reuse:
Provides safe encoding of shell commands and scripts for SSH transport, preventing shell injection. Uses a structured value type (RemoteExecValue) for file content and command lines, with canonicalization for ZFS dataset paths. Can be extracted as a standalone library for remote command execution over SSH.
Implements a generic GFS (Generalized Filer System) compaction algorithm for time-series data pruning. The ApplyGFS[T] function takes a sorted slice and target row count per step window, producing a compacted list. Reusable for any dataset requiring hierarchical retention (e.g., minutelyβhourlyβdaily).
Defines a typed operation protocol for CLI-daemon communication over Unix sockets. Uses integer opcodes and structured payloads for all management actions (VM, jail, network, tasks, etc.). The protocol design is self-contained and could be reused for any client-server IPC requiring typed commands.
Generic in-memory cache for mDNS service discovery results. Uses a TTL-based eviction strategy and supports both IPv4 and IPv6 addresses. The cache is parameterized by service type and can be reused in any Go application needing zero-config network discovery.
Implements a mutation gate that coordinates concurrent access to cluster state during critical operations like leave and readdress. Provides EnterMutation and DrainMutations methods with timeout and context cancellation. The pattern is reusable for any system needing to quiesce operations before state transitions.