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:
- Configuration spec v2: every field.
- Docker Compose: import a compose file, export a configuration as one, and update it from one.
- Compose key reference: what each compose key becomes, and the
x-admrlextension. - Migrating to multi-service workloads: what happens to existing configurations, what older devices do, and agent features.
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,execanddebugare 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.
| State | Meaning |
|---|---|
RUNNING | Every service that should run is running, and healthy if it has a health check. |
CRASHING | At least one service is waiting in restart backoff after a failure. |
DEGRADED | A 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, ERROR | As 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.
| Value | Behaviour |
|---|---|
always (default) | Restart whenever the service exits. |
on-failure | Restart only when the service exits with a non-zero code. |
no | Never 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:
| Condition | The dependent service starts when | Agent feature |
|---|---|---|
service_started (default) | The target is running. | |
service_healthy | The target is healthy. Needs a healthcheck on the target. | deps.healthy |
service_completed_successfully | The 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
testis["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 thantimeoutis killed and fails.intervalis at least 5 seconds (default 30s).timeoutmust not exceedinterval(default 5s).retriesis the number of consecutive failures before the service is unhealthy (default 3). The first probe runs oneintervalafter the service starts. Failures insidestartPerioddo 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 tostarting. - The device only runs checks that you write. It does not use a
HEALTHCHECKbaked 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:
| Value | Behaviour |
|---|---|
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. |
none | Report 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.hostPortdefaults toport. options.hostHosts: trueappends 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
secretssees 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.memorycaps one service (for example512Mi). 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,ulimitsandsysctls. A service that uses one needs a device agent that reports the matching feature. - Each service can set
user,groupAdd,workingDir,hostname,labels,stopSignal,stopGracePeriodandinit. See the spec reference. privileged,capAdd,capDropanddevicesare set per service. A fleet must allow host access before a configuration that usesprivileged, a powerful capability or a device can be assigned to it.options.isolateDevicesstill 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.desiredStateapplies 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
- Open Configs and choose New Configuration.
- 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.
- 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.
- 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
| Tool | Multi-service behaviour |
|---|---|
get_device_workload | Returns set.state and a services list. |
change_workload_status | Takes service to start, stop, restart or recreate one service. Omit it to act on the set. |
get_device_logs | Takes service to filter logs. |
explain_workload_failure | Explains failures per service: exit codes, memory kills, health excerpts. |
edit_configuration | image, 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_versions | Flattens 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
| Limit | Value |
|---|---|
| Services per set | At least one. |
| Service name | ^[a-z][a-z0-9_-]{0,31}$; not ssh, exec or debug. |
Interactive (tty) services | One per set. |
| Host ports | Unique per (protocol, hostPort) in the set. In host network mode, container ports are unique too. |
| Health check interval | 5 seconds or more. |
| Concurrent health probes | One per service, four per device. |
| Per-service memory | 4Mi to 1Ti, below the set ceiling. |
| Host namespaces | Network only. |
| Replicas, per-service rollback | Not supported. |