Skip to content

Feat/improve env bootstraping - #4

Merged
bartrosa merged 39 commits into
mainfrom
feat/improve-env-bootstraping
Jul 15, 2026
Merged

bartrosa merged 39 commits into
mainfrom
feat/improve-env-bootstraping

Conversation

@bartrosa

Copy link
Copy Markdown
Owner

Summary

This PR turns homelab-cli from a provisioning-focused tool (v0.2) into a full developer environment platform: installable stack components, compose-backed local services, and graph databases for GraphRAG workloads — all from one binary.

Branch: feat/improve-env-bootstraping
Scope: 39 commits · 107 files · +6,691 / −267 lines
Baseline preserved: lab iso, lab bootstrap essentials, self-update, install script — no regressions on v0.1/v0.2 flows.

After merge, a typical fresh-machine workflow looks like:

lab bootstrap essentials --yes
lab stack install --preset backend --yes
lab services up --preset graphrag --yes
lab services connect arcadedb

What's new

lab stack (rename from lab toolchain)

  • lab stack replaces lab toolchain with aliases toolchain and tc (backward compatible).
  • Component registry with dependency-ordered install, dry-run planning, and skip-if-installed behavior.
  • 26 installable components across 7 categories: languages (Python, Go, Rust, Scala, Kotlin, …), build tools, containers, GPU stacks (CUDA/ROCm), VCS, package managers, embedded DBs (SQLite, DuckDB).
  • Stack presets: minimal, basic, backend, frontend, systems, jvm, ml, data, gpu-nvidia, gpu-amd, full.
  • Shell PATH management via idempotent managed blocks in ~/.bashrc, ~/.zshrc, ~/.config/fish/config.fish.
  • GPU detection (lab stack gpu) from lspci output.

lab services framework

Replaces the v0.1 stub with a full compose orchestrator:

  • Service interface, config schema, stdin prompt engine (golang.org/x/term — only new dependency).
  • Shared Docker/Podman network homelab-net, embedded templates, secret handling, .env chmod 600.
  • Runtime auto-detection: Docker on Ubuntu, Podman on Silverblue.
  • Commands: init, up, down, restart, status, connect, logs, rm, preset list/show.

17 compose-backed services

Category Services
database postgres, mysql, mongodb, clickhouse
cache redis, valkey
message-queue rabbitmq, nats
vector qdrant, weaviate
observability prometheus, grafana, loki, tempo
storage minio
graph arcadedb, nebulagraph

Postgres supports plugin combinations (pgvector, postgis, timescaledb) via embedded Dockerfile when 2+ plugins are selected.

Grafana auto-provisions datasources (prometheus, loki, tempo, postgres, clickhouse) with soft-fail if a target is down.

Graph databases (Apache 2.0)

Two sovereign-friendly graph engines, selected after a 2026 license review (Neo4j GPLv3, FalkorDB SSPL, Memgraph/ArangoDB BSL excluded):

Service Description
arcadedb Single-container multi-model DB (graph, document, KV, vector). Studio UI, Cypher/Gremlin/SQL, optional MongoDB/Redis protocol plugins.
nebulagraph 4-container distributed stack (metad + storaged + graphd + studio). nGQL (openCypher-compatible). Automated post-init for storage host registration and root password rotation.

New presets:

  • graphrag — arcadedb + qdrant + minio + postgres (multi-modal AI stack)
  • graph-lab — arcadedb + nebulagraph (side-by-side comparison, no port collision)

New service category: graph (lab services list --category graph).

Optional PostUpper interface — NebulaGraph runs post-init after compose up without breaking existing services.

High-level wrappers

  • lab obs up/down → observability preset
  • lab vector up <id> → forwards to lab services up (qdrant, weaviate, arcadedb, nebulagraph)
  • lab data up <id> → postgres, clickhouse, minio

Configuration

Extended ~/.config/homelab-cli/config.yaml:

stack:
  default_preset: backend
  presets:
    my-workflow: [python, node, go, docker]
  components:
    python: { version: "3.12" }

services:
  runtime: auto
  network: homelab-net
  instances:
    postgres:
      plugins: [pgvector, postgis]
      password: env:LAB_POSTGRES_PASSWORD
  presets:
    my-ml-lab: [postgres, qdrant, minio, clickhouse]

Breaking default: services.runtime changed from podmanauto.


Documentation

  • README.md — dev environment + services walkthrough
  • docs/commands.md — full lab stack and lab services reference
  • docs/configuration.mdstack: and services: sections
  • docs/services.md — catalog of all 17 services, graph licensing rationale, embedded graph alternatives (Kuzu/LadybugDB)
  • CHANGELOG.md — v0.3 Developer Environment + Graph Databases entries

Design decisions

  1. Postgres multi-plugin — embedded Dockerfile + compose build on up when 2+ plugins are selected (no single upstream image covers all combinations).
  2. Grafana datasource provisioning — soft-fail; user restarts Grafana after bringing up missing backends.
  3. Pinned image versions in all templates; override via --set version=….
  4. ArcadeDB MCP plugin — gated on 24.11.x; warning logged if enabled on unverified versions. TODO: confirm plugin in official image.
  5. NebulaGraph post-init — shell-side idempotency via SHOW HOSTS + password probing (no marker files).
  6. NebulaGraph authenable_auth=true by default; post-init rotates root/nebula → random .env password.
  7. lab vector up arcadedb — forwards without blocking; connect notes that ArcadeDB is multi-model, not a dedicated vector DB.
  8. No Ruby, no .NET, no Faiss as stack components — by design.

Test plan

  • make ci green (fmt, vet, lint, test, build)
  • lab stack list — 26+ components in 7 categories
  • lab stack install --preset ml --yes — installs without errors
  • lab stack path refresh — idempotent shell rc block
  • lab toolchain install python --yes — alias works
  • lab services list — 17 services with status
  • lab services init postgres --set plugins=pgvector,postgis --yes — generates compose + Dockerfile + .env (600)
  • lab services up --preset observability --yes — prometheus, loki, tempo, grafana healthy
  • lab services init arcadedb --set databases=knowledge_graph --yes && lab services up arcadedb
  • curl http://127.0.0.1:2480/api/v1/ready → 200
  • lab services connect arcadedb — full endpoint list
  • lab services init nebulagraph --yes && lab services up nebulagraph — 4 containers healthy, post-init registers storaged0
  • lab services up --preset graphrag --yes — all 4 services up
  • lab services up --preset graph-lab --yes — both graph DBs parallel, no port conflict
  • lab vector up arcadedb — wrapper forwards correctly
  • lab obs up — observability preset
  • Regression: lab bootstrap essentials --dry-run, lab iso list, lab self-update --check

Migration notes

Before After
lab toolchain install go lab stack install go (alias still works)
services.runtime: podman services.runtime: auto (explicit override still supported)
lab services ensure ml-stack Still works (legacy homelab-repo compose)

Out of scope (follow-up PRs)

  • NebulaGraph multi-node scale-out (--nodes 3)
  • JanusGraph / HugeGraph
  • Embedded graph in lab stack (LadybugDB/bighorn when stable)
  • Full lab services logs compose integration (partial stub remains)
  • Integration tests in CI (make test-integration target added, not run in default CI)

bartrosa added 30 commits July 15, 2026 17:14
Added functionality to manage shell rc files for Bash, Zsh, and Fish, including generating, updating, reading, and removing managed blocks. Introduced unit tests for block generation to ensure idempotency and syntax correctness across different shell types. This enhances the usability of the homelab-cli by automating shell configuration management.
Implemented GPU detection from lspci output, supporting NVIDIA, AMD, and Intel vendors. Added parsing logic and helper functions in the gpu package. Included unit tests for various GPU scenarios to ensure accurate detection and handling of different outputs. This enhances the homelab-cli's capability to identify graphics hardware.
…ackage management

Introduced new components for managing various build tools (C/C++ toolchain, CMake, GNU Make), version control (Git), and language packages (Rust, Scala, Python, Node.js, etc.) in the homelab-cli. Each component includes installation checks, installation scripts, and path management for seamless integration. This enhances the CLI's capability to manage development environments effectively.
…sets

Added a comprehensive stack management system for installable developer components, including orchestration for dependency resolution and installation. Implemented presets for common development environments and provided functionality for merging custom presets. Introduced unit tests to ensure correct behavior of the orchestration and preset functionalities, enhancing the homelab-cli's capability to manage diverse development setups effectively.
Introduced a new Weaviate service to the homelab-cli, providing a vector database with a GraphQL API. The service includes configuration options for HTTP port and API key, enhancing the CLI's capabilities for managing vector databases.
Introduced the Valkey service to the homelab-cli, providing a Redis-compatible in-memory datastore. The service includes configuration options for host port and password, enhancing the CLI's capabilities for managing caching solutions.
Introduced the Tempo service to the homelab-cli, providing a distributed tracing backend. The service includes configuration options for HTTP port, enhancing the CLI's capabilities for observability solutions.
Introduced new service configurations for ClickHouse, Grafana, Loki, MinIO, MongoDB, MySQL, NATS, PostgreSQL, Prometheus, Qdrant, RabbitMQ, Redis, and Weaviate. Each service includes environment variables, port mappings, and volume configurations, enhancing the CLI's capabilities for managing a diverse set of data storage, monitoring, and messaging solutions.
Introduced a new package to register multiple services including ClickHouse, Grafana, Loki, MinIO, MongoDB, MySQL, NATS, PostgreSQL, Prometheus, Qdrant, RabbitMQ, Redis, Tempo, Valkey, and Weaviate. This package facilitates the integration of these services into the homelab-cli, enhancing its capability to manage a diverse set of data storage, monitoring, and messaging solutions.
Introduced the Redis service to the homelab-cli, providing an in-memory key-value store. The service includes configuration options for host port and password, enhancing the CLI's capabilities for managing caching solutions.
Introduced the RabbitMQ service to the homelab-cli, providing an AMQP message broker with a management UI. The service includes configuration options for AMQP and management ports, as well as default user and password settings, enhancing the CLI's capabilities for managing messaging solutions.
Introduced the Qdrant service to the homelab-cli, providing a vector similarity search engine. The service includes configuration options for HTTP and gRPC ports, as well as an optional API key, enhancing the CLI's capabilities for managing vector search solutions.
Introduced the Prometheus service to the homelab-cli, providing metrics collection and alerting capabilities. The service includes configuration options for the HTTP port, enhancing the CLI's observability features.
Introduced the PostgreSQL service to the homelab-cli, providing a relational database with support for optional plugins such as pgvector, postgis, and timescaledb. The service includes configuration options for host port, superuser credentials, and a default database, enhancing the CLI's capabilities for managing database solutions. Unit tests have been added to verify service registration and configuration behavior.
Introduced the NATS service to the homelab-cli, providing a cloud-native messaging system. The service includes configuration options for client and monitor ports, enhancing the CLI's capabilities for managing messaging solutions.
Introduced the MySQL service to the homelab-cli, providing a MySQL 8 relational database. The service includes configuration options for host port, root user credentials, root password, and a default database, enhancing the CLI's capabilities for managing database solutions.
Introduced the MongoDB service to the homelab-cli, providing a document database. The service includes configuration options for host port, root user credentials, and root password, enhancing the CLI's capabilities for managing database solutions.
Introduced the MinIO service to the homelab-cli, providing S3-compatible object storage. The service includes configuration options for API and console ports, as well as root user credentials, enhancing the CLI's capabilities for managing storage solutions.
Introduced the Loki service to the homelab-cli, providing a log aggregation system. The service includes configuration options for the HTTP port, enhancing the CLI's observability features.
Introduced the Grafana service to the homelab-cli, providing metrics and logs visualization capabilities. The service includes configuration options for HTTP port, admin user, and password, enhancing the CLI's observability features.
Introduced the ClickHouse service to the homelab-cli, providing a column-oriented OLAP database. The service includes configuration options for HTTP port, default user, and password, enhancing the CLI's capabilities for managing database solutions.
Added a comprehensive services management system to the homelab-cli, enabling users to manage compose-backed services effectively. This includes the implementation of service registration, orchestration, and configuration handling. Key features include support for service dependencies, initialization, and lifecycle management (up/down). Additionally, various utility functions for handling templates, environment variables, and network management have been introduced, enhancing the CLI's capabilities for managing complex service stacks.
Added a new package for interactive stdin prompting, enabling users to input configuration values during service initialization. This includes a Prompter interface with methods for string, password, boolean, and selection inputs. Additionally, a schema validation function ensures required fields are present for non-interactive initialization. Unit tests have been included to verify the functionality of the prompting methods and schema validation.
Enhanced the configuration model by introducing a new StackConfig type and additional fields in ServicesConfig, including Network, Instances, and Presets. Updated default values for services to use "auto" for Runtime and added necessary defaults for new fields. Adjusted tests to reflect the changes in configuration structure.
Updated the data and observability command structures in the CLI to improve service management. Introduced new commands for starting and listing data services, including Postgres, ClickHouse, and MinIO. Enhanced observability commands to manage Prometheus, Grafana, and Loki stacks. Added support for dry run operations and improved command descriptions for clarity. Removed the deprecated toolchain command and consolidated stack management under a new stack command structure.
Updated the CLI command structure by removing the deprecated toolchain command and introducing the new stack command under the foundation category. This change enhances the organization of commands related to service management.
Modified the version number in the install script usage instructions from v0.1.0 to v0.2.0 to reflect the latest release. This change ensures users are directed to the correct version during installation.
Updated the README to reflect the new features and capabilities of the `lab` CLI, including a comprehensive overview of homelab automation, installation instructions, and a detailed provisioning workflow. Added new documentation files for provisioning a new machine and a services catalog, outlining the management of compose-backed services. Enhanced command descriptions and configuration details to improve user guidance and clarity.
Introduced a new command `test-integration` in the Makefile to run compose integration tests with the integration tag. This addition enhances the testing capabilities of the project, allowing for more comprehensive validation of service interactions outside of CI.
Added new dependencies for `github.com/mattn/go-isatty` and `golang.org/x/term`, and updated the version of `golang.org/x/sys` to v0.47.0. This ensures compatibility with the latest features and improvements in the respective libraries.
bartrosa added 9 commits July 15, 2026 17:22
Changed the maintainer contact in the .goreleaser.yaml file from a placeholder to Bart Rosa's email address. This update ensures accurate attribution and communication for the project.
…ease

Expanded the CHANGELOG to include new features and changes for the v0.3.0 release, detailing the introduction of the `lab stack` command, the `lab services` framework, and various stack components and services. Updated the CONTRIBUTING guide to specify the version of golangci-lint used in the CI process, ensuring clarity for contributors.
…on scripts

Introduced new Docker Compose templates for Arcadedb and Nebulagraph services, including detailed configurations for containers, health checks, and environment variables. Added a post-initialization script for Nebulagraph to ensure proper setup and registration of storage hosts, enhancing the deployment process for these services.
…module

Updated the service registration in the register.go file to include Arcadedb and Nebulagraph, enhancing the service management capabilities of the application. This change ensures that these new services are properly registered and available for use.
Added the NebulaGraph service implementation, including its registration, configuration schema, and initialization logic. Introduced comprehensive unit tests to validate service registration, template rendering, and post-initialization behavior, enhancing the reliability and usability of the service within the application.
Added the ArcadeDB service implementation, including its registration, configuration schema, and initialization logic. Introduced comprehensive unit tests to validate service registration, template rendering, and password validation, enhancing the reliability and usability of the service within the application.
Implemented the ExposeBind function to determine host bind addresses based on service exposure modes, including LAN and Tailscale. Added new service presets for "graphrag" and "graph-lab" in the presets module, enhancing service management capabilities. Introduced unit tests for preset resolution to ensure correct functionality.
Updated the vector command's short and long descriptions to include support for graph databases with vector search. Modified the list command to reflect the addition of ArcadeDB and NebulaGraph, improving clarity on the services available and their categories. This enhances user experience and documentation for vector-capable services.
Introduced new service categories for graph databases, including ArcadeDB and NebulaGraph, along with their respective service presets "graphrag" and "graph-lab". Updated documentation to reflect these additions, enhancing user guidance on initializing and managing graph database services within the application. This update improves the overall functionality and usability of the lab stack.
@bartrosa
bartrosa merged commit 292fa3f into main Jul 15, 2026
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