Skip to content

The compose OCF resource agent

In Pacemaker-managed deployments, each IsardVDI stack (a docker-compose file and the containers it defines) is managed by a resource agent. This agent translates cluster actions (start, stop, and monitor) into docker compose commands.

pcs resource create isard ocf:heartbeat:compose \
    conf=/opt/isard/src/docker-compose.yml \
    op monitor interval=30s

Parameters that affect behavior

Parameter Description
conf The compose file. The value is passed to the command line as-is, so more than one file can be chained: conf="/opt/isard/src/docker-compose.hypervisor.yml -f /opt/isard/src/docker-compose-open-ports.yml". This applies an overlay (extra published ports, per-node overrides) to a clustered stack.
mount_points Directories that must exist before the stack starts. The agent creates them.
env_path An alternative environment file for docker compose.
monitor_cmd A command used for the monitor action.

Do not quote conf

The parameter is deliberately expanded without quotes so the multi-file form works. Quoting it turns "a.yml -f b.yml" into a single, non-existent filename and the resource fails to start.

What the monitor action must report

The monitor action must distinguish three states. A deployment that collapses these states will hide outages:

  1. All containers in the file are running → The resource is healthy.
  2. No containers are running → The resource is stopped, and the cluster may recover it.
  3. Some containers are running, others are not → The stack is degraded. Reporting this state as healthy means a stack of thirty containers with twenty-nine dead is shown as Started.

A compose file that does not parse is not proof that the stack is down

If the file lives on shared storage and becomes unreadable or invalid, returning "not running" triggers a recovery whose stop fails for the same reason. With fencing enabled, this can restart nodes in a chain. The safe behavior is to report the error and to stop containers by name from the last known-good list rather than through a file that cannot be parsed.

Per-host variables

Resource agents used in HA deployments may inject a small set of per-host variables before calling docker compose up. These variables include the node's domain, its hypervisor ID, its storage endpoint, and its viewer ports. See Configuration variables in clusters for the precedence rules, which are the part that surprises people.