Skip to content

Service descriptor

A service descriptor describes one service the way the curated ones are described. monoceros add-service <name> <service> and init --with-services=<service> write its block into the workbench yml, with a ref: <service>@<version> line. Every monoceros apply reads the briefing of that version from the file.

~/.monoceros/templates/services/<service>.yml
~/.monoceros/templates/services/<service>@<n>.yml

The first file is the current version. Each @<n> file is an older version, kept by monoceros create-version. A descriptor with the id of a curated service, postgres say, replaces it for you.

Field Required What it does Example
id yes The service’s name. Must equal the file name. Lowercase letters, digits and -. rabbitmq
category yes Always service. service
version no Whole number, 1 when absent. create-version raises it. An @<n> file must carry its own n here. 2
displayName yes Shown in the comment above the block in the workbench yml. RabbitMQ
description yes One line on what the service is. Shown in that comment and in list-components. 'Message broker with the management UI.'
service yes The service block, see below.
options no Environment variables of the service container, see below.
briefing no Lines for the agent briefing, see below.
deploy no The service’s block for the project’s pipeline compose file, written into .monoceros/deploy.md. compose holds the service body, its image: equal to service.image. requires holds what it needs beside itself, named after the service. compose: | with the compose body
Field Required What it does Example
image yes The container image. rabbitmq:4-management
defaultPort yes The port the service listens on, written as port: into the yml. 5672
httpPort no The one HTTP port that may leave the container. The proxy routes <workbench>-<service>.localhost to it, and monoceros share offers it. 15672
dataMount no The container path of the service’s data. Written as data:<path> into volumes:, so the data survives an apply. /var/lib/rabbitmq
healthcheck no test (a list, required), interval, timeout, retries, startPeriod. Compose semantics. test: [CMD, rabbitmq-diagnostics, -q, ping]
connectionEnv no Environment variables for the workspace container, by suffix. Tokens: ${host}, ${port} and ${<OPTION>}. URL on a service named rabbitmq is RABBITMQ_URL. URL: amqp://${host}:${port}
command no The process to run instead of the image’s default. start-dev --import-realm
user no Compose user:, for an image that must write its data directory as root. '0:0'
architectures no amd64, arm64. Set it for an image without an arm64 build, so init, add-service and apply warn on such a host. [amd64]
resources no Default memory and cpus. Enforced only where MONOCEROS_ENFORCE_DEFAULT_LIMITS=true, never written into the yml. memory: 512m
client no Client tools installed into the workspace: apt packages, npm packages. apt: [postgresql-client]
exampleVolumes no Mounts written as a commented volumes: block, for the builder to fill in. - projects/app/realm.json:/opt/import/realm.json:ro
exampleEnv no Keys written as a commented env: block, for the builder to fill in. SITE_ADDRESS: ${SITE_ADDRESS}
deferStart no Start the service after the repositories are cloned, for a service that mounts a file from one. true
vscodeExtensions no VS Code extensions recommended in the workbench. [mtxr.sqltools]

tools is for curated services only. An own service that lists it fails to load.

Each option is an environment variable of the service container. The workbench yml gets <OPTION>: ${<OPTION>} under env:, and <name>.env gets the default. An option without a default is left out.

Field Required What it does Example
type yes string, boolean or number. string
default yes The dev value seeded into <name>.env. monoceros
description no What the value is for. 'Login for the management UI.'
surface no Use env, as the curated services do. env

A list of lines for the agent in the workbench. apply reads them from the version in ref and writes them into the agent briefing.

Field Required What it does Example
text yes The line. Name the hosts and variables the agent uses. 'Connect over AMQP with $RABBITMQ_URL.'
whenOption no An option of this descriptor. The line appears only when it is truthy. ENABLE_UI

Your team runs RabbitMQ with its management UI in every project, and you want to add it by name like a curated service. Save this as ~/.monoceros/templates/services/rabbitmq.yml:

id: rabbitmq
category: service
version: 1
displayName: RabbitMQ
description: 'Message broker with the management UI. AMQP on `rabbitmq:5672`, the management UI on port 15672.'
service:
image: rabbitmq:4-management
defaultPort: 5672
httpPort: 15672
dataMount: /var/lib/rabbitmq
healthcheck:
test: [CMD, rabbitmq-diagnostics, -q, ping]
interval: 10s
retries: 5
connectionEnv:
URL: amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@${host}:${port}
HOST: ${host}
PORT: ${port}
options:
RABBITMQ_DEFAULT_USER:
type: string
default: monoceros
surface: env
RABBITMQ_DEFAULT_PASS:
type: string
default: monoceros
surface: env
briefing:
- text: 'Message broker, reached in-container as host `rabbitmq`. Connect over AMQP with `$RABBITMQ_URL`, which carries the user and password.'

Check that Monoceros reads it. It shows up marked (local):

Terminal window
monoceros list-components

Add it to a workbench (acme is a sample workbench name):

Terminal window
monoceros add-service acme rabbitmq

To change it later, run monoceros create-version rabbitmq first and edit rabbitmq.yml after that.

  • The block is copied, the briefing is read. The service block lands in the workbench yml, where the builder can edit it. The briefing stays in the file and is read at every apply, from the version in ref.
  • A missing file is a hint. On a machine without the file, the service runs from its block in the yml without the briefing, and apply names the file.
  • A newer version reaches a workbench through monoceros upgrade. It merges the new block in and keeps the builder’s own edits.
  • A broken file stops init, add-service, apply and list-components with its path.