Install an Operations runner¶
An Operations runner is a small process beside a container destination. It asks Weave for authorized work over an outgoing connection, checks its own local policy, and calls the destination's existing tools. Studio never runs provider commands or receives provider credentials.
Start with Manage container deployments to create the target and grant its dedicated application identity access. This page explains what to install on the runner host and how to configure each adapter.
1. Choose where the runner will live¶
Use a dedicated Linux or macOS host, VM, or container with network access to both the Weave API and the destination. The runner uses POSIX process ownership and file locks. Windows users can run it in a Linux VM or container; Studio and the ordinary CLI remain available on Windows.
Install the same Weave package version as the API, including its client extra.
Follow the CLI installation guide first.
The client extra supplies the HTTP and OAuth client used by the runner.
Install and authenticate the appropriate provider tool on that host:
| Destination | Local tool | What the pinned identity means |
|---|---|---|
| Docker Compose, including on-premises hosts | Docker CLI with Compose v2 | Docker daemon ID; boundary is a Compose project name |
| Kubernetes, including existing AKS, EKS, and GKE clusters | kubectl |
Namespace UID; boundary is that namespace |
| Azure Container Apps | Azure CLI with Container Apps support | Managed environment ARM resource ID; boundary is a resource group |
The cloud's name does not change the Kubernetes adapter. A namespace in an existing EKS or GKE cluster uses the same contracts and checks as another Kubernetes namespace. Creating a cloud account, cluster, network, or database remains an infrastructure provisioning step.
For Docker, use an explicitly named context. Access to a Docker socket grants
substantial host authority: isolate the runner and keep its provider permissions
within the destination it operates. For Kubernetes, grant only the namespace and
resource permissions needed by the allowed deployments. API-component updates
also require reading that namespace's horizontal pod autoscalers so the runner
can reject a conflicting scaling policy. To report where worker pods run, the
runner also lists the namespace's pods (list on pods); without that read,
observations leave the worker's members out. Upgrade the API server before its
runners: an older server refuses the members a newer runner reports, so its
observe jobs fail and its applies end in reconciliation. Grant the read after
the server upgrade and before the runner upgrade.
To remove exactly the reviewed pods in a scale-down, a Kubernetes runner also
patches the worker pods (get and patch on pods, since kubectl patch
reads a pod first) to set their deletion cost. Grant them before you upgrade a
Kubernetes runner to a release that registers adapter version 2, together with
the list read. Without them, every scale-down that
runner takes fails before any change, because the runner checks each pod patch
with a server-side dry run first; the change request can be planned again once
the grant is in place.
2. Copy the destination's actual identity¶
Run the relevant read-only command on the runner host. Replace the illustrative names with your own context, namespace, subscription, and environment.
# Record the daemon identity, not just the context's display name.
docker --context team-runtime info --format '{{.ID}}'
# A namespace UID changes when someone deletes and recreates the namespace.
# That change must invalidate the old runner binding.
kubectl --context team-cluster get namespace weave \
-o jsonpath='{.metadata.uid}'
# Register this environment resource ID as the ACA target's external identity.
az containerapp env show --subscription YOUR_SUBSCRIPTION_UUID \
--resource-group team-weave --name team-environment --query id --output tsv
Register the target in Studio → Operate › Clusters → Register target using that exact identity. Keep the returned target ID for the local setup wizard. Target registration records intent; an observation from the runner verifies access.
3. Prepare a dedicated Weave machine identity¶
The runner's Weave identity and provider identity serve different purposes. The first authorizes jobs in one Weave workspace; the second authorizes the local Docker, Kubernetes, or Azure command. Neither is a person's Studio login.
Create an application principal and link the verified machine identity using
People and access. Grant deployment_runner
with the target ID in its resource list. Use your identity provider's OAuth
client-credentials endpoint; this is not tied to Keycloak.
A private OAuth configuration file looks like this:
{
"token_endpoint": "https://identity.example.com/oauth2/token",
"client_id": "weave-operations-runner",
"scope": "weave.operations",
"client_secret_file": "/run/secrets/weave-runner-client-secret"
}
Use the actual scope accepted by your identity provider and Weave audience configuration. Mount the secret at the referenced path. Do not put its value in this file, a workflow, an image, or a Studio form. The client reads the secret again when acquiring a new token and renews tokens before expiry.
For an operator-managed short-lived token, use token_file instead of
oauth_file in the runner configuration. It is read again for every API request,
so your credential agent can rotate it. Supply exactly one method. The runner
does not fall back to an interactive profile or keychain.
4. Run the setup wizard¶
# Create a new private file. Setup never overwrites an existing configuration.
weave operations runner setup --output /opt/weave/private/runner.json
# Verify the local policy and read the provider, without claiming any jobs.
weave operations runner check --config /opt/weave/private/runner.json
# Start outgoing polling. Only authorized jobs matching this policy can run.
weave operations runner run --config /opt/weave/private/runner.json
The wizard asks for four groups of information: the Weave workspace, the pinned destination, allowed components and image repositories, and machine credentials. It starts with observation only. Enable mutation capabilities only when that host is ready to manage the specified resources.
Run the last command under your service supervisor or container restart policy.
Use a stable configuration and mount the required local files. Keep the process
in the foreground; the supervisor owns its lifecycle. --once is available for
diagnostics: it registers, claims at most one job, and exits. It does not wait
for a future job to arrive.
While the API restarts, the runner keeps running: a claim that can't reach the
API is made again after a wait that doubles up to 10 seconds, as a worker's
does; the first wait is 0.25 to 0.5 seconds. Any other failure stops it, such as
401, 403, a redirect, a server certificate the runner can't verify, or an answer
outside the API contract. The runner then reports WV-RUNNER-STOPPED, which
names the failure's kind, its code, and the error it came from, but never its
text: for example, WV-TRANSPORT (HTTP 503) from ConnectError
(SSLCertVerificationError) for a certificate it can't verify. The exit code is
3 when the API couldn't be reached or failed, and 1 when it refused the runner
or the failure is on this host.
5. Understand the local policy¶
The API's approved plan is checked again against the runner's private policy. A target grant alone cannot expand that local allowlist. This Kubernetes example allows only one existing worker deployment:
{
"base_url": "https://weave.example.com",
"scope": {
"tenant_id": "00000000-0000-0000-0000-000000000001",
"project_id": "00000000-0000-0000-0000-000000000002",
"environment_id": "00000000-0000-0000-0000-000000000003"
},
"oauth_file": "/opt/weave/private/oauth.json",
"poll_seconds": 2,
"destination": {
"target_id": "00000000-0000-0000-0000-000000000004",
"adapter": "kubernetes",
"external_identity": "YOUR_NAMESPACE_UID",
"boundary": "weave",
"executable": "/usr/local/bin/kubectl",
"context": "team-cluster",
"capabilities": ["observe", "update", "scale_workers"],
"components": [
{
"name": "integration-worker",
"kind": "worker",
"container": "worker",
"configuration": "production",
"max_replicas": 10,
"max_cpu_millis": 4000,
"max_memory_mib": 8192
}
],
"image_repositories": ["registry.example.com/weave/integration-worker"]
}
}
Replace every illustrative ID. Image repositories are exact repository names,
not wildcards; plans must use immutable @sha256: images. A component's
configuration is an operator-owned alias, not a file path from the browser.
The runner does not accept shell commands, arbitrary Kubernetes manifests, or
credential values from a plan.
capabilities must include observe, and every adapter accepts update and
scale_workers. A Kubernetes policy may also list restart_workers and
read_logs, and a Compose policy deploy, restart_workers and read_logs;
the runner refuses any other. read_logs also needs the target to hold it: see
Read container logs.
The default local ceilings are ten replicas, 4,000 CPU millicores, and 8,192 MiB per component. Lower them for smaller destinations. Raising desired capacity in Studio cannot bypass these ceilings. They are separate from workflow quotas, worker task slots, and provider account limits.
6. Prepare the selected adapter¶
Docker Compose¶
Set compose_file to an absolute operator-owned Compose file and lock_file to
an absolute private path shared by every runner process for this destination.
The file must contain exactly the services listed in components. Define
networks, mounts, configuration, and secrets locally; the API cannot add them.
Provision dependencies before using a plan, since changes use --no-deps.
The runner keeps a private <lock_file>.compose.json override alongside the
lock. Preserve it across restarts: it records the accepted images, resources,
labels, and replica counts, including services scaled to zero. Back up this
file with the local deployment configuration. Keep those files out of Git.
Before a mutation, the runner validates the rendered configuration, runs a Compose dry run, and rechecks the observation under the destination lock. It then applies only the named services and waits for container readiness. Add meaningful health checks to your Compose services; without one, a running process is the only readiness evidence Docker provides.
For a worker service, the observation also lists its live containers as
members: the container ID prefix, which is the container's default hostname,
and its Compose number. Exited, dead, and removing containers are left out. With
more than 100 live containers, or a container whose details cannot be read, the
observation leaves the members out (placement unknown) and still succeeds. A
service that sets its own hostname gets no placement.
Scale-downs and restarts. Any plan that lowers a worker service's replicas
names the containers it removes: exited containers first, then the highest
Compose numbers. The runner checks that each named container is one live
container of the service, stops them together with a 240-second grace period
(they were drained first), removes them, and only then scales, so Compose never
picks which workers go. A restart (restart_workers) recreates every container
of the service at the same count and succeeds only when no old container is
left. The Compose runner registers adapter version 2, which the platform
requires before it hands the runner a scale-down; runners of earlier releases
never get one.
Kubernetes¶
Kubernetes runners register adapter version 2 too. Before a scale-down lowers
the replicas, the runner clears any earlier deletion cost from the pods it
keeps and gives each reviewed pod the lowest
controller.kubernetes.io/pod-deletion-cost, so the ReplicaSet removes those
pods first. Deletion cost is a preference: if a kept pod stops being ready
before the ReplicaSet acts, Kubernetes may remove it instead, and the change
request's receipt warns that a reviewed worker is still there. A restart sets
the firefly.weave/restarted-at annotation on the pod template, keeps the
image and replicas, and succeeds only when every pod is new and ready.
Container Apps runners register adapter version 1: they take no plan that lowers a worker component's replicas, because their adapter does not yet remove exactly the reviewed members. Such a job waits unclaimed and is cancelled at its deadline; the change request gives its drained workers back and can be planned again. Scale those components down outside Weave until then.
The adapter manages existing deployments, not arbitrary resources. Each allowed deployment must have the matching local configuration alias in its pod template:
# This is part of the operator-owned Deployment, not a workflow definition.
spec:
template:
metadata:
annotations:
firefly.weave/configuration: production
Every patch tests the deployment UID and resource version. The runner asks the
API server to dry-run all patches before applying them, then checks the
admission result and rollout. API components must keep one replica and
Recreate; a matching horizontal pod autoscaler blocks the update. Maintain
that singleton rule in your cluster admission and operator policies too.
The adapter changes only the selected container's image/resources, replicas, and its ownership label. A worker scaling plan does not change the image. Objects already labeled as belonging to another Weave target are rejected.
For a worker component, the observation also lists the deployment's live pods
as members, inside the pinned namespace and through the deployment's own
selector: matchLabels become key=value and matchExpressions become
set-based requirements (key in (a,b), key notin (a,b), key, !key). The
runner reads only the few pod fields it needs. A pod counts only when its
controlling ReplicaSet is named after the deployment and its pod template hash;
terminating, finished, failed, and evicted pods are left out. A pod whose
readiness is unknown, for example on an unreachable node, is listed as not
ready. Members are placement only and never fail an observation or an apply:
with more than 100 live pods, a selector kubectl cannot express exactly, a label
that is not valid Kubernetes syntax, or a listing that fails, the observation
leaves the members out (placement unknown) instead of reporting part of them,
and it never lists the whole namespace.
Azure Container Apps¶
Set context to the subscription UUID, boundary to the resource group,
external_identity to the managed environment resource ID, lock_file to a
shared private path, and each component's container to its existing container
name. Use the Azure public cloud management endpoint.
Observation supports API, worker, and Weave AI components. Configure new Azure
targets and runner policies with observe only. After environment-specific
acceptance, enable update for existing worker and Weave AI apps in Single
revision mode. Keep scale_workers disabled in both policies for alpha12
Azure deployments. The implemented scaling path has not established an
all-revision physical shutdown guarantee.
The observation queries active revisions and sums their reported replicas;
ready_replicas counts replicas in healthy, provisioned active revisions. It
does not enumerate physical replicas belonging to inactive or historical
revisions. Even a settled stopped observation with zero replicas is therefore
an active-revision result, not proof that every previous process has exited.
Deactivating a revision and draining its replicas are separate checkpoints.
For updates, positive capacity sets both replica bounds to the reviewed value. Apps with custom scale rules and image updates at zero replicas are rejected. The adapter preserves the app's existing environment, mounts, and other template configuration while updating the requested fields. This update behavior does not make automatic scale-to-zero safe to enable.
API/scheduler upgrades and replacement of the runner itself require the Azure maintenance boundary. Single revision mode alone does not prove that API revisions cannot overlap during an upgrade.
Container Apps PATCH has no documented atomic resource-version precondition. The runner serializes its own operations and checks for drift immediately before writing, but external Azure operators still need to coordinate changes. See the official API contract.
Read container logs¶
A runner whose policy lists read_logs, registered for a target that holds
read_logs, answers container log requests: a person with
deployment_log_reader and deployment.read on the target asks for a snapshot
in Operate › Logs › Container logs or through the
API, and the runner
reads it. Log requests have their own queue beside the jobs, so a request is
answered while a job runs, and a log request never blocks a job.
The runner reads only a worker component its policy binds, and only containers or pods it observed itself. A request names up to five members (container ID prefixes or pod names, as the observation lists them), from 60 seconds to 24 hours back and 1 to 1,000 lines each; without members, it reads every member, up to five. Each command is a fixed argument list, run without a shell:
| Adapter | Command |
|---|---|
| Docker Compose | docker --context <context> logs --timestamps --since <n>s --tail <n> <full container ID> |
| Kubernetes | kubectl --context <context> --namespace <boundary> --request-timeout=20s logs <pod> -c <container> --timestamps --since=<n>s --tail=<n> |
Compose reads every container of the service, exited ones included, because
they show why a worker stopped before it claimed a task; it keeps stdout and
stderr apart. Kubernetes reads running pods of the deployment and reports both
streams as one output stream, as kubectl logs prints them. When a pod's
container has restarted, the runner also reads its previous container (the
same command with --previous), because a crash-looping pod's lines about the
crash are there; the member then shows the newest lines of both containers,
oldest first, and reports how many times the container restarted and how many
of its lines came from the previous one. A member the runner can't read, such as a container removed
since its inventory, is left out, and the snapshot says lines were left out;
when no member can be read, the request fails as unreadable. The runner
redacts each line, cuts it to 2 KiB, keeps the newest 256 KiB of the snapshot,
and never writes a line it read to its own log. The platform redacts every line
again, keeps the snapshot for one hour, and then deletes it.
On Kubernetes, the runner's Role needs get on pods/log in the workers
namespace. weave platform cluster connect grants exactly that, in the
target's own namespace only. A runner whose policy lists read_logs while its
target doesn't registers without it and keeps running its jobs; add read_logs
to the target (deployment_targets.update) and restart the runner to read its
logs.
7. Review a job's result¶
A queued job is not a completed deployment. Follow it until a terminal state and read its final observation. Provider readiness does not prove a workflow or AI model works: run the corresponding product acceptance check afterward.
If a runner loses authority or contact after an effect may have started, Weave keeps the job in Reconciliation required. Inspect the destination, stop any remaining external operation, request a fresh settled observation, and use the explicit reconciliation flow. It records the resolution; it does not roll back or automatically repeat the earlier change.
When the job belongs to a change request, the change ends in
reconciliation_required and the workers it let finish their tasks go back to
work at once, each resume audited; a worker someone drained again since stays
as they left it. Workers a scale-down was removing stay draining, because the
runner may still be stopping their containers; a drain-first restart gets all
its workers back.
Draining a worker and removing container replicas are different actions. In Operate › Workers, open the worker and select Drain to let its running tasks finish while it takes no new ones. Reducing container capacity can terminate tasks if those instances have not drained.