Skip to main content

Multi-service Workloads

A configuration describes a set of services. Each service is one container image with its own command, environment, ports, mounts, registry credential and limits. The device runs every service as a separate container on one network, starts them in order, restarts them by policy, and lets them reach each other by service name.

Use a set when an appliance is several programs that you want to build, version, restart and diagnose separately: an application, a local database, a hardware daemon and a background worker, for example. A configuration with one service behaves as it always has.

This page covers the concepts and day-to-day use. The other pages in this group are:


Concepts​

Set and service​

  • A set is the workload of one device. It is identified by the configuration name and version, exactly as a single workload was. Fleets, rollouts, device documents and overrides all keep working on that pair.
  • A service is one container in the set. Its name is unique in the set, starts with a lowercase letter, and contains only lowercase letters, digits, _ and - (up to 32 characters). ssh, exec and debug are reserved, because EdgeWire uses them as targets.
  • Services are addressed by name everywhere: logs, terminal, restart, EdgeWire forwards, developer sessions and device overrides.

A set is applied and rolled back as a whole. There are no partial sets and no per-service rollback. When a new version changes only some services, the device restarts only the services whose own settings changed; a change to a set-level setting (network mode, volumes, options, signature policy) restarts the services it affects.

Set state​

The device reports one state for the set. Older tools that read a single workload state see this value.

StateMeaning
RUNNINGEvery service that should run is running, and healthy if it has a health check.
CRASHINGAt least one service is waiting in restart backoff after a failure.
DEGRADEDA service is down without restart backoff, and nothing is crashing. For example a restart: no service that exited with a non-zero code. The other services keep running.
STOPPED, STAGING, STAGED, ERRORAs for a single workload.

DEGRADED is the only new state. It raises the WorkloadDegraded condition on the device document and the workload.set.degraded webhook. The WorkloadReady condition follows the set state.

A service with restart: no that exits with code 0 is finished, not failed. It counts as converged, so one-shot jobs such as a database migration do not hold a rollout open or degrade the set.

Restart policy​

Set restart on each service.

ValueBehaviour
always (default)Restart whenever the service exits.
on-failureRestart only when the service exits with a non-zero code.
noNever restart. A non-zero exit leaves the set DEGRADED; exit code 0 counts as converged.

Restarts back off per service, so a failing service does not slow down its neighbours. While a service is in backoff the set is CRASHING.

With on-failure, restartMaxAttempts limits the consecutive failed restarts. After that many, the service stays down and the set is DEGRADED. 0, the default, means no limit. It is valid only with on-failure, and written as on-failure:3 in a compose file.

Start order: dependsOn​

dependsOn lists the services a service starts after, each with a condition:

ConditionThe dependent service starts whenAgent feature
service_started (default)The target is running.
service_healthyThe target is healthy. Needs a healthcheck on the target.deps.healthy
service_completed_successfullyThe target has exited with code 0. The target must have restart: on-failure or restart: no, because a service that always restarts never completes. Use it for one-shot jobs such as a database migration.deps.completed

The device starts services in dependency order and stops them in reverse. Dependencies must exist and must not form a cycle; the configuration is rejected otherwise.

A dependent waits for the condition. If the target becomes unhealthy, exits with a non-zero code for service_completed_successfully, or the wait runs out, applying the set fails and the normal rollback applies. The wait for a dependency lasts 60 seconds, longer when the target's start period, retries and check interval need more. After the set is running, the same conditions are checked again whenever the device restarts a dependent. Restarting a dependency does not restart the services that depend on it.

A service without dependsOn can start before its peers have an address, so it should tolerate a missing peer and retry, as with compose.

Health checks​

A healthcheck runs inside the service on the device:

healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/healthz"]
interval: 30s
timeout: 5s
retries: 3
startPeriod: 20s
onUnhealthy: restart
  • test is ["CMD", "program", "arg"], or ["CMD-SHELL", "command"] to run through /bin/sh -c. The probe runs in the service's namespaces and cgroup, as the service's user, with its environment and working directory. Exit code 0 passes and anything else fails. A probe that runs longer than timeout is killed and fails.
  • interval is at least 5 seconds (default 30s). timeout must not exceed interval (default 5s). retries is the number of consecutive failures before the service is unhealthy (default 3). The first probe runs one interval after the service starts. Failures inside startPeriod do not count, and the first success ends it.
  • All durations are whole seconds.
  • A service runs one probe at a time, and a device runs at most four probes at once.
  • The device keeps the latest probe result per service: health status (starting, healthy, unhealthy), failing streak, check time and the probe output, capped at 1 KB. It reports a service's health when the status changes. A restart resets the status to starting.
  • The device only runs checks that you write. It does not use a HEALTHCHECK baked into the image.

A service with a health check counts as up only while it is healthy. The set is RUNNING when every service with a check is healthy. While a service is starting, the set stays in its transition.

onUnhealthy decides what the device does when a service becomes unhealthy:

ValueBehaviour
restart (default)Restart the service through its restart policy, with the usual backoff. Each restart counts toward restartMaxAttempts. With restart: no the service is only reported.
noneReport only. The service keeps running and the set is DEGRADED, as in Docker.

Using healthcheck at all needs the agent feature health. A device whose agent lacks it refuses the configuration. See Agent features.

Probation and rollback​

A new set runs on probation like a single workload (see automatic workload rollback), with the set as the unit:

  • The set passes probation when every service has been running, and healthy where it has a health check, for the probation window.
  • A service that enters restart backoff, or becomes unhealthy, during probation fails it. The device then re-applies the whole previous set. Services that are identical in both sets are not restarted.
  • Custom volumes are not rolled back, as for a single workload.

Networking: names resolve to peers​

By default (network.mode: bridge) every service has its own network namespace and its own address on the device bridge. Services reach each other, and the internet, directly.

  • Each service sees the other services by name through /etc/hosts. There is no DNS server on the device. Resolution covers service names only: no SRV records, and no aliases other than the service name.
  • The device rewrites the hosts file after every service start and stop. Open connections to a service that restarted are broken, and the service's address can change, so connect by name and reconnect on failure rather than caching an address. Stable addresses across restarts are not provided.
  • Container ports can repeat across services, because each has its own namespace. Published host ports cannot: each (protocol, hostPort) is unique in the set. hostPort defaults to port.
  • options.hostHosts: true appends the host's hosts file to the set's.

With network.mode: host every service shares the host network namespace and every service name resolves to 127.0.0.1. Services then share one port space, so each container port must be unique across the whole set. Host mode is allowed for sets of more than one service. Of the host namespaces, only network is shared; the others stay private to the workload.

Named volumes​

Volumes are declared once, at set level, by name, and attached to services:

volumes:
data: { backup: { enabled: true } }
services:
db:
image: docker.io/library/postgres:16
volumes: [{ name: data, destination: /var/lib/postgresql/data }]
backup:
image: ghcr.io/example/backup:1.2
volumes: [{ name: data, destination: /data, readOnly: true }]

Two services can attach the same volume at different paths, one of them read-only. A volume is in use while any service attaches it, and backups are per named volume. The Volumes tab and admrl cp address volumes by name.

Secret files​

Secret files are still attached to the configuration or the device. Each service lists the files it can see in secrets:

  • A service with no secrets sees no secret files. This is the default for every new service.
  • secrets: ["/admrl/secrets/db.env"] exposes only those files, under /admrl/secrets/ in that service.
  • secrets: ["*"] exposes every file in scope. Configurations migrated from a single workload get ["*"] on their one service, which keeps what that workload could already see.

A path that matches no file in scope yet is a warning, not an error, because device-scoped files can be added later. If a service cannot find a secret, check that its secrets list names the path.

One interactive service​

tty: true gives a service the device screen and keyboard, as Interactive Mode does for a single workload. At most one service per set can set it. The display returns to the status console only when that service stops.

Limits​

  • resources.memory caps one service (for example 512Mi). It must be at least 4Mi and at most 1Ti, and below the set's memory ceiling.
  • The set's memory ceiling is sized from the host, as it is for a single workload. Per-service limits only narrow it; they cannot raise it.
  • Each service can also set resources.cpus (for example "1.5"), resources.pids, resources.memoryReservation, shmSize, ulimits and sysctls. A service that uses one needs a device agent that reports the matching feature.
  • Each service can set user, groupAdd, workingDir, hostname, labels, stopSignal, stopGracePeriod and init. See the spec reference.
  • privileged, capAdd, capDrop and devices are set per service. A fleet must allow host access before a configuration that uses privileged, a powerful capability or a device can be assigned to it. options.isolateDevices still sets the default device access for the whole set.
  • There are no user namespaces.
  • A set runs on one device. There is no replica count.
  • There is no per-service desiredState. desiredState applies to the whole set. A service command such as stop is runtime-only: the configuration still lists the service, so a later configuration push can start it again.

Create a set​

Dashboard​

  1. Open Configs and choose New Configuration.
  2. Start from an image (a set with one service) or, where offered, choose Import docker-compose.yml. The import shows warnings and errors per compose path before it creates anything.
  3. In the editor, each service has its own pages: Container, Environment, Ports, Storage, Secrets and Health. Set-level pages cover Network, Volumes, Options and Signatures. The YAML view shows the whole spec, and Manage > Compose shows it as a compose file you can download, edit and save back.
  4. Add, rename and remove services from the service selector.

The compose option appears only when your Admiral backend offers it.

CLI​

Documents are plain YAML, so the existing commands work unchanged: admrl get configuration <name> -o yaml, admrl edit, admrl diff and admrl apply. Compose files work in both directions:

admrl apply --compose -f docker-compose.yml --name edge-stack # create or update from a compose file
admrl get configuration edge-stack -o compose # export as a compose file

Admiral converts the file, the CLI prints the warnings and errors, and nothing is assigned to a fleet until you assign it. See Docker Compose.

A two-service example, applied with admrl apply -f:

spec:
version: 2
services:
web:
image: ghcr.io/example/web:1.4
ports:
- { port: 8080, protocol: tcp, hostPort: 80 }
environment:
DB_HOST: db
dependsOn:
db: { condition: service_healthy }
db:
image: docker.io/library/postgres:16
environment:
POSTGRES_PASSWORD_FILE: /admrl/secrets/pg
volumes:
- { name: data, destination: /var/lib/postgresql/data }
secrets: ["/admrl/secrets/pg"]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
restart: always
volumes:
data: { backup: { enabled: true } }

MCP​

create_configuration accepts a version 2 spec or the text of a compose file:

create_configuration(name="edge-stack", compose_yaml="<contents of docker-compose.yml>")
create_configuration(name="edge-stack", spec={"version": 2, "services": {"web": {"image": "ghcr.io/example/web:1.4"}}})

Pass one of image, spec or compose_yaml, not a mix. Warnings come back in the result. Assign the configuration to a fleet afterwards with assign_fleet_configuration.


Operate a set​

Dashboard​

The device Workload card shows the set state and one row per service: state, image, address and process ID. Each row has its own start, stop, restart and recreate actions, next to the set-level actions. Other pages gain a service control:

  • Terminal has a service picker. With one service it is hidden; with several you choose the service to open a shell in.
  • Logs has a Services filter.
  • The rollout dialog's workload restart has an optional Service field.

Devices on an older agent keep the single-row view.

CLI​

# Shell or command in one service
admrl shell edge-1 --service web
admrl exec edge-1 --service db -- psql -U postgres

# Developer session on one service; the other services keep running
admrl dev start edge-1 ./out:/opt/web --service web

# Watch per-service state
admrl watch device edge-1

# Per-device override of one service
admrl override device edge-1 --set services.web.environment.LOG_LEVEL=debug --expires 2h

With one service, --service is optional. With several, admrl exec and admrl shell need it unless an EdgeWire grant already names a target; without it the API answers 400 service_required. Exec permission is unchanged: Open workload terminal applies to the device, not to a service.

EdgeWire services in a set must name their container with service:

edgewire:
services:
- { name: web, protocol: tcp, port: 8080, service: web }

Overrides​

A device override addresses a service under services.<name>.:

spec:
workload:
override:
services:
web:
environment:
LOG_LEVEL: debug
image: ghcr.io/example/web:1.4.1

A service override can change image, command, environment, ports, mounts, volumes, registryCredentialId, tty, readOnlyRoot and ephemeralRoot. Set-level network, volumes and options can be overridden at the top of the override. Restart policy, dependsOn, healthcheck, secrets and resources change through a new configuration version. Overrides written for a single workload keep working: they apply to the service named app. See Device documents.

MCP​

ToolMulti-service behaviour
get_device_workloadReturns set.state and a services list.
change_workload_statusTakes service to start, stop, restart or recreate one service. Omit it to act on the set.
get_device_logsTakes service to filter logs.
explain_workload_failureExplains failures per service: exit codes, memory kills, health excerpts.
edit_configurationimage, image_tag, env_set and env_unset act on one service; service is required when the set has more than one. merge_patch edits the version 2 spec directly.
diff_configuration_versionsFlattens differences to services.<name>.<field> paths.

API​

PUT /v1/devices/{deviceId}/workload/cmd takes an optional service (up to 32 characters) next to action. The response echoes it. Agents without multi-service support ignore it and act on the whole workload.

Rollouts​

A rollout of a set is judged by configuration version and set state, not by comparing image strings. A device counts as converged when it runs the target version and the set is RUNNING. A one-shot service that exited with code 0 does not prevent that. See Rollouts.

If you assign or roll out a set to devices whose agents cannot run it, or to a fleet whose security policy does not allow the host access it uses, Admiral refuses the request. See Agent features and Workload host access.


Webhooks​

The workload.started, workload.stopped, workload.restarted and workload.crashed payloads carry a service field when the event is about one service of a set. Two events are new: workload.set.ready and workload.set.degraded. See Webhooks.


Limits at a glance​

LimitValue
Services per setAt least one.
Service name^[a-z][a-z0-9_-]{0,31}$; not ssh, exec or debug.
Interactive (tty) servicesOne per set.
Host portsUnique per (protocol, hostPort) in the set. In host network mode, container ports are unique too.
Health check interval5 seconds or more.
Concurrent health probesOne per service, four per device.
Per-service memory4Mi to 1Ti, below the set ceiling.
Host namespacesNetwork only.
Replicas, per-service rollbackNot supported.