Welcome to Boilerplates! This guide will help you get up and running in just a few minutes.
Boilerplates provides two main components:
A collection of ready-to-use templates for common infrastructure components:
Templates include:
A Python-based command-line tool to work with templates:
Before you begin, ensure you have:
The quickest way to install the management CLI is using the automated installer:
curl -fsSL https://raw.githubusercontent.com/christianlempa/boilerplates/main/scripts/install.sh | bash
This installs the boilerplates command and configures access to the official template library.
For detailed installation instructions including platform-specific guidance, see the Installation page.
Once installed, let's generate your first template!
Download the latest templates from the library:
boilerplates repo update
This syncs the official template library to ~/.config/boilerplates/libraries/default/.
Explore available Docker Compose templates:
boilerplates compose list
You'll see a table showing available templates from the library with their descriptions.
Before generating, preview a template's structure and variables:
boilerplates compose show nginx
This shows:
Now, let's use the CLI to generate customized files from a template! You have two options:
Interactive Mode (Recommended for beginners):
boilerplates compose generate nginx
The tool prompts you for each variable. You can:
Non-Interactive Mode (For automation):
boilerplates compose generate nginx my-nginx \
--var service_name=my-nginx \
--var container_port=8080 \
--no-interactive
This uses template defaults and provided variables without prompts.
After generation, you'll find:
my-nginx/
├── docker-compose.yml
└── .env
Review the files and adjust as needed for your environment.
Here are the essential commands you'll use regularly:
Manage template library repositories:
# Sync official template library
boilerplates repo update
# List all configured libraries
boilerplates repo list
# Add a custom template library
boilerplates repo add my-templates https://github.com/user/templates \
--directory library \
--branch main
Discover and use templates from the library:
# Browse available templates
boilerplates compose list
# Search the library
boilerplates compose search nginx
# Inspect template structure
boilerplates compose show nginx
# Generate files from template
boilerplates compose generate nginx ./output
# Validate template syntax
boilerplates compose validate
Save frequently used values to avoid repetitive typing:
# Set a default value
boilerplates compose defaults set container_timezone="America/New_York"
# View all defaults
boilerplates compose defaults list
# Remove a default
boilerplates compose defaults rm container_timezone
# Clear all defaults
boilerplates compose defaults clear
Use template defaults without customization:
boilerplates compose generate portainer --no-interactive
Customize template variables interactively:
boilerplates compose show traefik # Review template structure
boilerplates compose generate traefik # Customize via prompts
For scripts and CI/CD pipelines:
boilerplates compose generate authentik ./auth \
--var service_name=authentik \
--var traefik_enabled=true \
--var traefik_host=auth.example.com \
--no-interactive \
--dry-run # Preview first
Preview generated files without writing them:
boilerplates compose generate nginx --dry-run
Enable detailed logging for troubleshooting:
boilerplates --log-level DEBUG compose generate nginx
Override specific variables without interactive prompts:
boilerplates compose generate grafana \
--var service_name=monitoring-grafana \
--var grafana_port=3000
Now that you know the basics, explore more:
If the boilerplates command is not found after installation:
# Ensure pipx binaries are in PATH
export PATH="$HOME/.local/bin:$PATH"
# Add to your shell profile (.bashrc, .zshrc, etc.)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
If templates aren't showing up after installation:
# Sync the template library
boilerplates repo update
# Verify library is configured
boilerplates repo list
If you encounter permission errors:
# Ensure output directory is writable
chmod +w ./output-directory
# Or generate to a different location
boilerplates compose generate nginx ~/my-projects/nginx
Happy templating!