Skip to content

๐Ÿณโšก A powerful CLI tool for building Docker Compose files from modular components with multi-environment support and extension system ๐Ÿ”ง๐Ÿš€

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

zyrakq/stackbuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Stackbuilder Logo

๐Ÿ—๏ธ Stackbuilder

License: Apache-2.0 License: MIT Rust

A powerful CLI tool for building Docker Compose files from modular components. Stackbuilder enables you to create maintainable, scalable Docker environments by assembling base components with environment-specific configurations and optional extensions.

โœจ Key Features

  • ๐Ÿงฉ Modular Architecture - Compose Docker environments from reusable components
  • ๐ŸŒ Multi-Environment Support - Deploy to development, staging, production with ease
  • ๐Ÿ”Œ Extension System - Add features like monitoring, authentication, logging as needed
  • ๐ŸŽฏ Named Combos - Define reusable extension combinations for consistency
  • ๐Ÿ“ฆ Smart File Management - Intelligent merging of configurations and environment files
  • โšก Fast Builds - Efficient assembly with intelligent cleanup and preservation
  • ๐Ÿ”ง Flexible Configuration - TOML-based configuration with sensible defaults

โšก Quick Start

Get up and running in 3 simple steps:

# 1. Install stackbuilder
cargo install stackbuilder

# 2. Navigate to your project with components
cd your-project

# 3. Build your stack
stackbuilder

Your assembled Docker Compose files will be generated in the ./build directory!

๐Ÿ“ฆ Installation

From Cargo (Recommended)

cargo install stackbuilder

Arch Linux

# Using makepkg (see docs/archlinux-packaging.md for details)
cd packaging/archlinux
makepkg -si

From Source

git clone https://github.com/zyrakq/stackbuilder.git
cd stackbuilder
cargo build --release
./target/release/stackbuilder --help

๐ŸŽฎ Basic Usage

Project Structure

Organize your Docker components in this structure:

your-project/
โ”œโ”€โ”€ stackbuilder.toml          # Configuration file
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ base/                  # Core services (required)
โ”‚   โ”‚   โ””โ”€โ”€ docker-compose.yml
โ”‚   โ”œโ”€โ”€ environments/          # Environment-specific configs
โ”‚   โ”‚   โ”œโ”€โ”€ dev/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ docker-compose.yml
โ”‚   โ”‚   โ””โ”€โ”€ prod/
โ”‚   โ”‚       โ””โ”€โ”€ docker-compose.yml
โ”‚   โ””โ”€โ”€ extensions/            # Optional features
โ”‚       โ”œโ”€โ”€ monitoring/
โ”‚       โ”‚   โ””โ”€โ”€ docker-compose.yml
โ”‚       โ””โ”€โ”€ auth/
โ”‚           โ””โ”€โ”€ docker-compose.yml
โ””โ”€โ”€ build/                     # Generated output (auto-created)

Configuration Examples

Basic Configuration (stackbuilder.toml)

[build]
[build.environments]
available = ["dev", "prod"]

[build.environments.dev]
extensions = ["monitoring", "auth"]

[build.environments.prod]
extensions = ["monitoring", "auth"]

Advanced Configuration with Named Combos

[build]
# Define reusable extension combinations
combos = {
    security = ["auth", "guard"],
    observability = ["monitoring", "logging"]
}

# New environments API
[build.environments]
available = ["dev", "staging", "prod"]

# Per-environment configurations
[build.environments.dev]
extensions = ["debugging"]
combos = ["security"]

[build.environments.staging]
combos = ["security", "observability"]

[build.environments.prod]
combos = ["security", "observability"]

๐Ÿ“ Example Walkthrough

This repository includes several example configurations:

๐Ÿ”ฐ Basic Example (examples/basic/)

Simple setup with two environments and authentication extensions:

cd examples/basic
stackbuilder

What it demonstrates:

  • Base component with core services
  • Two environments: devcontainer and internal
  • Extensions: oidc and guard for authentication
  • Generated structure in build/ directory

๐ŸŽฏ Complex Example (examples/complex/)

Multi-environment production setup:

cd examples/complex
stackbuilder

What it demonstrates:

  • Three environments: development, staging, production
  • Multiple extensions: monitoring, logging, auth, backup
  • Environment-specific configurations
  • Production-ready deployment structure

๐Ÿ› ๏ธ Custom Paths Example (examples/custom-paths/)

Using custom directory structure:

cd examples/custom-paths
stackbuilder

What it demonstrates:

  • Custom component directory names
  • Non-standard project layout
  • Flexible path configuration

๐ŸŽจ Named Combos Example (examples/named-combos/)

Advanced extension management with named combinations:

cd examples/named-combos
stackbuilder

What it demonstrates:

  • Named combo definitions
  • Reusable extension groups
  • Per-environment combo assignments

๐Ÿš€ How It Works

  1. Component Assembly - Stackbuilder reads your component structure
  2. Configuration Parsing - Processes stackbuilder.toml for build rules
  3. Docker Compose Merging - Intelligently combines YAML files
  4. Environment File Merging - Merges .env.example files with priority
  5. Additional File Copying - Copies configs, scripts, and certificates
  6. Smart Cleanup - Preserves existing .env files during rebuilds

๐Ÿ”— Docker Stack Collection

Stackbuilder is used extensively in practical deployment examples. Check out the docker-stack-collection repository for real-world stack configurations and deployment patterns using stackbuilder.

๐Ÿ“š Documentation

๐Ÿค Contributing

We welcome contributions! Please feel free to:

  1. Report Issues - Found a bug? Open an issue
  2. Submit PRs - Improvements and new features are welcome
  3. Share Examples - Add your stackbuilder configurations to help others
  4. Improve Documentation - Help make our docs even better

๐Ÿ“„ License

This project is dual-licensed under:

You may choose either license for your use.


Built with โค๏ธ in Rust | Perfect for DevOps teams and Docker enthusiasts

About

๐Ÿณโšก A powerful CLI tool for building Docker Compose files from modular components with multi-environment support and extension system ๐Ÿ”ง๐Ÿš€

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published