Skip to content

Feat/add tools part 1 - #1

Merged
bartrosa merged 25 commits into
mainfrom
feat/add-tools-part-1
May 20, 2026
Merged

bartrosa merged 25 commits into
mainfrom
feat/add-tools-part-1

Conversation

@bartrosa

Copy link
Copy Markdown
Owner

Summary

Implements the first wave of real functionality in homelab-cli (lab): bootstrap profiles, package/toolchain management, homelab compose stacks, remote server workflows (SSH/rsync/deploy), PostgreSQL provisioning, bare-metal DB installers, dynamic bootable USB creation, templates, and HEIC conversion — with orchestration in Go and documented external binaries only.

Replaces placeholder stubs and homelab shell wrappers for the migrated workflows. Full English documentation refresh included.


Motivation

The personal homelab repo accumulated one-off scripts (sync-to-server.sh, deploy-and-compose.sh, apply.py, bare-metal installers, etc.). This PR consolidates the common paths into a single CLI with shared config, dry-run, and terminal UI — without calling homelab .sh/.py for migrated features.

YouTube playlist download was briefly implemented in Go, then removed from this CLI (stays in homelab tools/media/ if needed).


What's new

Foundation

Area Commands Implementation
Bootstrap lab bootstrap laptop|server|profile|list Embedded YAML profiles + runner (pkg, toolchain, optional script:)
Packages lab pkg install|ensure|list brew / apt / dnf / rpm-ostree via internal/packager
Toolchains lab toolchain install|list|use mise wrapper
Services lab services up|down|list|logs|ensure homelab compose stacks (e.g. ml-stack)

Infra & server

Area Commands Implementation
Server lab server run, lab server deploy [provision|compose|full] SSH + rsync; PG apply local via pgx
PostgreSQL lab postgres apply --config Idempotent users/DBs from YAML
Bare metal lab baremetal install qdrant|milvus|clickhouse Go orchestration on Linux target
System lab system usb list, lab system usb Live discovery from Ubuntu meta-release + Fedora mirrors
SSH lab ssh connect, lab ssh sync Host inventory + rsync to server.*

Workflow

Area Commands Implementation
Templates lab templates list|new Copy from homelab project-initiators/
Media lab media heic HEIC→JPEG via heif-convert
Repos lab repos backup GitLab mirror (still runs homelab Python script)

Cross-cutting

  • internal/ui — lipgloss sections/tables
  • internal/executil — command runner with --dry-run
  • internal/homelabroot — resolve homelab repo path
  • internal/cli/appctx — session on context (config, styles, dry-run)
  • Global flags: --homelab-root, --dry-run, --no-color
  • Module path: github.com/bartrosa/homelab-cli
  • Go 1.25 + pgx/v5 for PostgreSQL

Still stubbed (unchanged intent)

cluster, gpu, models, data, notebooks, mlops, vector, pipelines, agents, obs, logs, mcp, most of repos (clone/sync/status/list).


Design rules

  1. Orchestration in Go — ordering, config, retries, UI.
  2. No homelab .sh/.py for migrated commands (exceptions documented below).
  3. External binaries only where unavoidable — see docs/external-binaries.md.

Interim homelab dependencies

Feature Still uses homelab
lab repos backup tools/gitlab/backup_account.py
Bootstrap script: steps e.g. scripts/install-server-deps.sh on server profile

Configuration

New/extended keys:

  • homelab.root / LAB_HOMELAB_ROOT / --homelab-root
  • server.host, server.user, server.port, server.path
  • ssh.hosts for named connections

Example: docs/config.example.yaml

Removed: media.* (YouTube cookies) — no longer applicable.


Documentation

File Notes
README.md Rewritten for current scope
docs/README.md Doc index
docs/commands.md Full command reference
docs/configuration.md Config keys
docs/architecture.md Package layout
docs/external-binaries.md Required host tools
docs/homelab-migration.md homelab → lab mapping
CHANGELOG.md Unreleased section

Notable exclusions

  • lab media playlist — not part of this CLI; use homelab scripts or yt-dlp directly.
  • run-ml-stack-setup-on-server.sh — not wired into bootstrap yet.

Test plan

  • make ci passes locally
  • lab bootstrap list / lab bootstrap laptop --dry-run
  • lab pkg list on macOS and Linux
  • lab services list with valid homelab.root
  • lab ssh sync --dry-run with server.* configured
  • lab server deploy --dry-run (sync only)
  • lab postgres apply --config … --dry-run (or against test PG)
  • lab system usb list (network; verifies Ubuntu/Fedora discovery)
  • lab media heic . with sample .HEIC + heif-convert installed
  • lab templates list with homelab.root set
  • lab repos backup with GITLAB_TOKEN (optional)

bartrosa added 25 commits May 20, 2026 17:23
Introduced a new ui package that provides consistent terminal styling for lab commands. This includes styles for titles, subtitles, and various message types (OK, Warn, Err), as well as functions for rendering sections, steps, tables, and boxed content. The implementation enhances the visual output of the CLI, improving user experience.
Added a new package for managing language runtimes using mise. This includes functionality for installing, listing, and activating specific versions of languages. The implementation supports known language aliases and ensures mise is installed before performing operations, enhancing the CLI's capability to manage development environments.
Introduced a new scaffold package that facilitates the creation of new projects from predefined templates. This includes functionality for copying project-initiator templates based on specified languages (Go, Python, Rust, TypeScript) into a designated directory, enhancing project setup efficiency. The package also provides a method to list supported template kinds.
Added functionality for discovering bootable images from Ubuntu and Fedora mirrors, including support for LTS and interim releases. Implemented tests for image resolution and regex matching for ISO filenames. Introduced a method for creating bootable USB drives, including ISO download and checksum verification. This enhances the CLI's capabilities for managing bootable environments.
Introduced a new SSH package that provides functionality for connecting to remote hosts via SSH and synchronizing local homelab directories with remote servers using rsync. The package includes methods for establishing SSH connections with configurable options and handling home directory expansion for identity files, enhancing the CLI's capabilities for remote management.
Introduced a new services package that provides functionality for managing Docker and Podman compose stacks. This includes a Runner type for starting, stopping, and logging stacks, as well as methods for listing known stack names. The implementation enhances the CLI's capabilities for orchestrating containerized applications in a homelab environment.
Introduced deploy and remote packages to facilitate server management in the homelab CLI. The deploy package includes functionality for syncing the homelab to a server and executing various deployment modes (sync, provision, compose, full). The remote package provides methods for establishing SSH connections and executing commands on remote servers, enhancing the CLI's capabilities for remote operations and deployment workflows.
Introduced a new GitLabBackup function in the repos package, enabling the backup of GitLab accounts. This implementation includes environment variable handling for authentication, customizable backup directories, and support for parallel job execution. The addition enhances the CLI's capabilities for managing GitLab repositories and automating backup workflows.
Introduced new functionality for managing PostgreSQL instances, including configuration loading and applying desired states for databases and users. The implementation includes methods for ensuring user and database existence, granting permissions, and handling environment variables for authentication. This enhances the CLI's capabilities for managing PostgreSQL environments.
Introduced a new platform package that detects the operating system and identifies the package manager in use. The implementation includes constants for OS types and packagers, a struct for machine information, and methods for detecting the environment and checking for command availability. Additionally, unit tests were added to verify the detection logic for different operating systems, enhancing the CLI's capabilities for environment awareness and package management.
…d detection

Added a new packager package that provides functionality for installing system packages using native backends (brew, apt, dnf). The implementation includes a Manager struct for managing package installations, methods for ensuring package presence, and checking if packages are installed. Unit tests were also added to verify the installation logic and handle edge cases, enhancing the CLI's capabilities for package management across different platforms.
Introduced a new mlstack package that provides functionality to ensure the ML compose stack is running. The implementation includes a method for executing `podman-compose up -d`, checking for necessary files and commands, and printing service URLs for easy access. This enhances the CLI's capabilities for managing machine learning environments in a homelab setup.
Eliminated the exclusion of the yt_playlist_downloads directory from the rsync command in the remote package. This change allows the directory to be included in the synchronization process, enhancing the flexibility of the rsync functionality.
Modified the ListTracked method in the packager package to streamline the list of common lab dependencies by removing 'ffmpeg' and 'yt-dlp'. This change simplifies the dependency management process and focuses on essential tools.
Introduced a new media package for converting HEIC files to JPEG format, including the implementation of the ConvertHEIC function. Added unit tests to validate the conversion process, error handling for non-directory inputs, and dry run functionality to skip existing JPEG files. This enhances the CLI's capabilities for image format conversion.
Introduced a new homelabroot package that provides functionality to resolve the path to a personal homelab repository. The implementation includes a Resolve function that checks various locations and environment variables to find the repository. Additionally, unit tests were added to validate the path resolution and error handling for missing repositories, enhancing the CLI's capabilities for managing homelab environments.
Introduced new functions for installing ClickHouse, Milvus, and Qdrant on Linux bare metal environments. Each function checks for necessary dependencies, handles installation via package managers, and configures service settings. This enhances the CLI's capabilities for managing data services in a homelab setup.
…unctionality

Introduced a new bootstrap package that includes functionality for loading and executing setup profiles. The package supports embedded YAML profiles for various environments, such as laptop and server configurations. Added a Runner struct to manage the execution of profile steps, including package installation and toolchain setup. Unit tests were also created to validate the loading and execution processes, enhancing the CLI's capabilities for automated environment setup.
Updated CLI tests to include a dry run for the bootstrap laptop command, ensuring no errors occur during execution. Added tests for the bootstrap list and media help commands, verifying their output. Refactored import paths to use the correct module path, improving code organization and clarity. Introduced a new appctx package to manage per-invocation state, enhancing the context handling in the CLI.
… server management

Added new commands for managing bare metal installations, including support for installing Qdrant, Milvus, and ClickHouse. Implemented media conversion utilities for HEIC to JPEG. Introduced PostgreSQL provisioning from YAML configurations, allowing for idempotent database and user management. Added server command for remote operations, including running commands and deploying homelab configurations. Enhanced CLI functionality with dry run support across all new commands, improving usability and testing capabilities.
Introduced new SSH and server configuration structures to the config package, enabling management of SSH host inventory and server connection details. Added methods for retrieving sorted SSH host names and default values for homelab and server configurations. This enhances the configuration capabilities for managing remote operations in a homelab environment.
… and dry-run support

Introduced a new executil package that provides a Runner struct for executing shell commands with consistent logging and optional dry-run functionality. The package includes methods for running commands, checking command existence, and capturing output, enhancing the CLI's capabilities for managing external processes in a homelab environment.
Replaced the placeholder module path with the actual GitHub import path for the internal CLI package, ensuring correct package resolution and improving code clarity.
Replaced the placeholder module path with the actual GitHub import path in .goreleaser.yaml and Makefile. Updated Go version to 1.25.0 in go.mod, added new dependencies for pgx and yaml, and adjusted existing dependencies to their latest versions. This enhances the project's structure and ensures compatibility with the latest libraries.
…dates

Added new commands for managing server operations, PostgreSQL provisioning, and bare metal installations, including support for Qdrant, Milvus, and ClickHouse. Enhanced media handling with HEIC conversion utilities. Updated configuration management to include a starter YAML file and improved documentation across various guides. Removed deprecated commands and streamlined existing functionalities for better usability and clarity.
@bartrosa
bartrosa merged commit dfd6cc9 into main May 20, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant