Skip to content

Workbench template

A workbench template is a workbench yml that monoceros init starts from. monoceros init <name> --template=<template> copies it into container-configs/<name>.yml, fills in the two placeholders and asks for the credentials it references.

~/.monoceros/templates/workbenches/<template>.yml

The file name is the template’s name. Your templates are looked for before the ones that ship with the CLI, so a file named web-app.yml replaces the shipped web-app.

init replaces these two strings everywhere in the file, comments included, and changes nothing else.

Placeholder Replaced with Example after init
__MONOCEROS_NAME__ The workbench name passed to init. shop
__MONOCEROS_RUNTIME_VERSION__ The runtime version of the installed CLI. 1.11.0

The first comment paragraph at the top of the file says what the template is for. monoceros list-components --json shows it as the template’s description. When the file starts with the header init writes into every yml (# The workbench …), the paragraph after that header is the description. Lines that hold only a URL are left out.

# The workbench `__MONOCEROS_NAME__`. This file is the source of truth; the container
# is built from it. Change it here or with `monoceros add-*`, then run
# `monoceros apply __MONOCEROS_NAME__`.
# https://getmonoceros.build/docs/concepts/configuration/
#
# Node with Postgres and RabbitMQ, plus Claude Code with the Acme wiki.

A template takes every field a workbench yml takes. Workbench configuration describes each one in full.

Field Required What it does in the template Example
schemaVersion yes Config format version. 1
name yes The workbench name. Use the placeholder. __MONOCEROS_NAME__
runtimeVersion no The pinned runtime. Use the placeholder, so every workbench gets the current one. __MONOCEROS_RUNTIME_VERSION__
languages no Toolchains, with the version inline. - node:22
aptPackages no Extra apt packages. [jq, make]
services no Service blocks. ref: <id>@<n> records the descriptor version a block came from. - name: rabbitmq with ref: rabbitmq@1
resources no Memory and CPU limit of the workspace container. memory: 4g
features no Features with their options and plugins: blocks. - ref: ghcr.io/getmonoceros/monoceros-features/claude-code:1
mcpServers no MCP servers, by name for a catalog or own one, or written out in full. - name: acme-wiki
repos no Git repositories cloned into projects/ on the first apply. HTTPS URLs only. - url: https://github.com/acme/api.git
git no Committer identity. user: with name: ${GIT_USER_NAME}
routing no Container ports routed through the proxy. ports: [3000]
installUrls no https:// install scripts run on build. - https://example.com/install.sh

Credentials stay ${VAR} references, as in any workbench yml. init asks for their values and writes them into <name>.env. A value never goes into the template.

Your workbench acme has worked on a real project, and the next project should start from the same setup. (acme and shop are sample workbench names; use your own.) Make acme a template:

Terminal window
monoceros create-template acme standard --description "Node with Postgres and RabbitMQ, plus Claude Code with the Acme wiki."

create-template writes workbenches/standard.yml with both placeholders and the description in place. A template written by hand can be this short:

# Node 22 for our front ends.
schemaVersion: 1
name: __MONOCEROS_NAME__
runtimeVersion: __MONOCEROS_RUNTIME_VERSION__
languages:
- node:22

Start the next workbench from it:

Terminal window
monoceros init shop --template=standard
  • --with-* flags go on top. init applies them after the template, under the rules of monoceros add-*. A component the template already has stays as the template set it.
  • The workbench yml belongs to the builder. A later change to the template reaches new workbenches only.
  • A broken template fails. monoceros init --template and monoceros list-components --json stop and name the file.