#devops #infrastructure #cli

bin+lib lmrc-cli

CLI tool for scaffolding LMRC Stack infrastructure projects

21 releases

Uses new Rust 2024

0.3.16 Dec 11, 2025
0.3.14 Dec 3, 2025
0.3.9 Nov 30, 2025
0.2.12 Nov 27, 2025
0.1.0 Nov 26, 2025

#2416 in Command line utilities

MIT/Apache

1MB
22K SLoC

LMRC Stack

Infrastructure-as-Code toolkit for building production-ready Rust applications with automated deployment pipelines.

Note: This is a monorepo containing multiple independently-published Rust crates. See MONOREPO.md for development and publishing workflows.

LMRC Stack provides a CLI tool that scaffolds complete infrastructure projects with:

  • Pre-configured CI/CD pipelines (GitLab)
  • Infrastructure provisioning (Hetzner, more coming soon)
  • Kubernetes/K3s cluster management
  • Database setup (PostgreSQL)
  • DNS management (Cloudflare)
  • Automated deployment workflows

Monorepo Structure

lmrc-stack/
├── apps/
│   └── lmrc-cli/              # CLI application for scaffolding projects
├── libs/
│   ├── lmrc-config-validator/ # Configuration validation library
│   ├── gitlab-manager/        # GitLab API client
│   ├── hetzner-client/        # Hetzner Cloud API client
│   ├── k3s-manager/           # K3s cluster management
│   ├── kubernetes-manager/    # Kubernetes management
│   ├── cloudflare-client/     # Cloudflare API client
│   ├── postgres-manager/      # PostgreSQL management
│   ├── ssh-manager/           # SSH operations
│   ├── docker-manager/        # Docker operations
│   └── cargo-workspace-manager/ # Cargo workspace utilities
└── docs/                      # Documentation

Quick Start

Prerequisites

  • Rust 1.75 or later
  • Cargo

Installation

Build the CLI from source:

cd apps/lmrc-cli
cargo install --path .

Or run directly:

cargo run -p lmrc-cli -- --help

Usage

Create a New Project

Interactive mode (recommended):

lmrc new

With a project name:

lmrc new my-awesome-project

With a configuration file:

lmrc config -o my-config.toml  # Generate template
# Edit my-config.toml
lmrc new --config my-config.toml

Generate Configuration Template

lmrc config -o lmrc.toml

Validate Configuration

lmrc validate lmrc.toml

What Gets Generated

When you create a new project, LMRC CLI generates:

Directory Structure

your-project/
├── apps/              # Your applications
├── libs/              # Shared libraries
├── infra/
│   └── pipeline/      # Deployment pipeline binary
├── docker/            # Docker configurations
├── docs/              # Documentation
│   ├── README.md      # Project overview
│   ├── SECRETS.md     # Required GitLab variables
│   └── SETUP.md       # Setup instructions
├── .gitlab-ci.yml     # GitLab CI/CD configuration
├── .gitignore
├── lmrc.toml          # Project configuration
└── Cargo.toml         # Workspace configuration

Pipeline Application

The generated infra/pipeline application provides commands for:

  • provision - Provision cloud infrastructure (servers, networks)
  • setup - Set up services (Kubernetes, databases)
  • deploy - Deploy applications
  • full - Run complete pipeline (provision → setup → deploy)

GitLab CI/CD Pipeline

Automatically configured stages:

  1. build-pipeline - Build the deployment tool
  2. test - Build and test all applications
  3. provision - Provision infrastructure (manual trigger)
  4. setup - Configure services
  5. deploy - Deploy applications

Supported Providers

Current Support

  • Server: Hetzner Cloud
  • Kubernetes: K3s, Kubernetes
  • Database: PostgreSQL
  • DNS: Cloudflare
  • CI/CD: GitLab

Coming Soon

  • Server: AWS, DigitalOcean, GCP
  • Database: MySQL, MongoDB
  • DNS: Route53, Google Cloud DNS
  • CI/CD: GitHub Actions, Jenkins

Configuration

Projects are configured via lmrc.toml:

[project]
name = "my-project"
description = "My infrastructure project"

[providers]
server = "hetzner"
kubernetes = "k3s"
database = "postgres"
dns = "cloudflare"
git = "gitlab"

[[apps.applications]]
name = "api"
app_type = "api"

[[apps.applications]]
name = "web"
app_type = "web"

[infrastructure.hetzner]
server_type = "cx21"
location = "nbg1"
count = 1

[infrastructure.k3s]
enable_traefik = true

[infrastructure.postgres]
version = "16"
database_name = "myapp"

[infrastructure.cloudflare]
domain = "example.com"
proxied = true

[infrastructure.gitlab]
url = "https://gitlab.com"
namespace = "mygroup"

Development

Build the Workspace

cargo build

Run Tests

# Unit tests
cargo test

# Integration tests with real infrastructure
LMRC_RUN_REAL_INFRASTRUCTURE_TESTS=1 cargo test --ignored -- --nocapture

📋 See docs/TESTING.md for complete testing documentation

Build CLI

cargo build -p lmrc-cli --release

Check Code

cargo check --workspace
cargo clippy --workspace
cargo fmt --workspace

Library Usage

Each manager crate can be used independently in your own projects:

[dependencies]
hetzner-cloud-client = "0.1"
k3s-manager = "0.1"
cloudflare-client = "0.2"
postgres-manager = "0.1"
gitlab-manager = "0.1"

See individual crate documentation for usage examples.

Monorepo Development

This is a monorepo where all crates are developed together but published independently.

Working on the Monorepo

# Clone the repository
git clone https://gitlab.com/lemarco/lmrc-stack.git
cd lmrc-stack

# Build everything
cargo build --workspace

# Run all tests
cargo test --workspace

# Run linter
cargo clippy --workspace

Publishing Individual Crates

Each crate has its own version and can be published independently to crates.io.

See MONOREPO.md for detailed publishing workflow.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Run cargo test --workspace and cargo clippy --workspace
  6. Submit a merge request

See MONOREPO.md for detailed development workflow.

License

Apache-2.0

Author

Lemarc lemarc.dev@gmail.com

Documentation

Dependencies

~100MB
~1.5M SLoC