Skip to main content
Version: 0.15.1

An application

An application is a set of units the Core runs as separate processes, and a description of how they fit together. It is what a product built with Yoke is: an instrument's acquisition, its processing and its panel; a gateway's drivers and the tool that configures them. Yoke runs it, checks it before every start, keeps its state, and lets any number of interfaces reach it through the channels it declares.

It contains no code of its own. Every program in it runs as a unit, launched and supervised by the Core, and the application is the document that says which, how and in what order: readable, checkable and signable before anything runs.

What it is made of​

PartWhat it is
unitseach thing the deployment runs, under a name of its own, such as acquire or panel. A Plugin unit holds a Session with the Core; a unit that runs to completion does one job, such as preparing a store, and exits; a managed interface is a program serving a channel (vocabulary)
channelsthe ways in for an interface: a panel on the device's screen, a browser on a port, a tool over a socket. Each names its transport and who may attach, and two channels contending for control have a declared order (channels)
an order of startwhich unit depends on which, so that a store is prepared before the unit that reads it
needswhat a unit must reach on the host — a device, a directory to write, a secret — named by class, and supplied by whoever deploys the application (secrets)
parametersthe values that differ per site, declared with a type and a range, and chosen when an instance is created
an identity and a versioncom.example.hello at 0.1.0: what a host installs, and what an instance runs

The units come from Plugins, and the Plugins stay what they are. An application names a Plugin by its identity and pins its executable by digest; it does not change what the Plugin declares, and it cannot grant it anything. What a unit may do is still decided by the operator of the host it runs on (a Plugin).

From a project to a running instance​

An application exists as four things, and each has its own place.

The project is where it is written: a working directory that yoke-compose creates, checks and builds (a project).

hello/
├── yoke.yaml the descriptor: the only source of truth about the application
├── manifests/ one Manifest per Plugin the descriptor runs
├── components/ the executables, and image archives for an offline install
├── advisories.yaml advice waived, and why · never packaged
└── blocks.yaml where each placed block came from · never packaged

The package is how it travels: one file, com.example.hello-0.1.0.yoke, holding the descriptor, the Manifests and the executables, with a footer a host reads before it opens anything, and optionally a signature (the file, trust and sealing).

The bundle is the package installed: an unchanging directory under the host's install root, one per version, shared by the accounts allowed to use it. Versions sit side by side, and installing never overwrites (the install root).

/var/lib/yoke/apps/
└── com.example.hello/
└── 0.1.0/
├── bundle/ yoke.yaml · manifests/ · components/
└── install.yaml complete · who installed it · which key verified it

An instance is one copy that runs: a record naming the application and a version, beside the state that copy accumulates. An account can have as many as it creates, each with its own name, stores, sockets and log (instances).

~/.local/state/yoke/instances/dev/
├── instance.yaml the record: application, version, parameters, desired state
└── state/
├── registry.db what was authorised, for this instance
├── logs.db every event of this instance
├── version the version that last ran against these bytes
├── secrets/
└── storage/ one directory per declared storage need

Its life​

MomentWhat happensWho does it
writtenthe descriptor is edited by the composer's verbs, and each edit is checkedthe author, with yoke-compose
run while writtenthe working directory runs as an ephemeral instance, unverified and saying so, until it is interruptedthe author, with yoke app run --from
packagedthe gate runs over the project, then the three parts are archived, optionally signedthe author, with yoke-compose build
installedthe package's footer and signature are checked, the executables against their digests, then it is expanded; nothing runsan account allowed to install — a member of yoke-apps, or the account Yoke was installed for — with yoke app install
declareda record is written with a version pinned and the parameters checkedan operator, with yoke instance create
runningthe guardian checks the bundle again, runs the gate, and starts a Core; the Core launches and admits the unitsthe account's guardian, asked by yoke instance start
updateda newer version is installed beside the old, and the instance re-pointed to it; its state comes alongyoke app install, then yoke instance set-version (updating and removal)
removedthe instance's record and state go, then the bundle once no record points at ityoke instance remove, then yoke app remove

Everything that can be checked is checked again before every start, because a record and a bundle are files anyone with access may edit. A start the gate refuses reports every finding at once and starts nothing.

The guardian keeps each instance as its record says. One guardian runs per account; it starts what should be running, restarts a Core that fell, and at boot brings back the instances marked to start (the guardian).

A grant belongs to the instance. Authorising a Plugin in one instance authorises it there and nowhere else, and survives stopping and starting; a new instance starts with nothing granted (running it).

Granting is one act per capability, however many Plugins an application carries. Each yoke plugin grant names one Plugin and one capability, and each is the operator's decision about one thing that Plugin may do; nothing grants a Plugin all it declares at once, and nothing in an application can grant anything. For an application of several Plugins the operator reads what each declares in its Manifest, which the bundle carries under manifests/, grants what they decide to grant, and restarts the units, since a grant reaches a unit at its next admission:

# Every capability every Plugin of the bundle declares, in the instance `station`.
for manifest in "$bundle"/manifests/*.yaml; do
plugin="$(sed -n 's/^id: //p' "$manifest")"
for capability in $(sed -n 's/^ - name: //p' "$manifest"); do
yoke plugin grant "$plugin" "$capability" --instance station
done
done
yoke unit list --instance station

Then yoke unit restart <unit> --instance station for each unit already running. A loop like this one is still the operator granting every capability by name, and the Registry records each grant apart; yoke plugin show <plugin> says what is granted.

Where to go next​