An application as a service
The service form is the same application delivered to a device whose purpose is to run it. It is not a third kind of thing beside a Plugin and an application: the units, the channels, the Core and everything below it are identical. What changes is who describes the deployment, who starts it, and where its files are. The form's name is Yoke Service.
There is no package and no instance. A distribution's packages, or an image built with the Yocto Project, put each Plugin's executable and Manifest where the Core looks for them; the administrator of the host writes a composition document saying what runs; and the init system starts it at boot, with nobody present. One deployment runs per host, and it has no name to give it.
What it is made of
| The application form | The service form |
|---|---|
yoke.yaml, inside a bundle, written by the author | a composition document, /etc/yoke/deployments/<name>.yaml, written for one host |
| the Plugins' executables and Manifests, inside the bundle | each Plugin's executable at /usr/lib/yoke/plugins/<plugin> and its Manifest in /etc/yoke/plugins.d/<plugin>/, delivered by the Plugin's own package |
| parameters, chosen when an instance is created | none: a composition carries the site's values written in, as literals |
| an instance record, written by the manager | none: the init system's unit is the only desired state |
A composition says the same things a descriptor does, for one host. It names the units, the channels and the order of start, with one difference: a Plugin unit names no executable, because the Core finds it from the Plugin's identity. It has no head — no identity, no version — since which composition is in force is said by the path that links to it. It is configuration of the host: not shipped by an author, not signed, and kept across upgrades of the packages around it.
yoke-compose writes and checks a composition as it does a project: its authoring verbs take
--file, naming the composition to write, and --manifests, a directory holding each Plugin's Manifest
as plugins.d/ does, which every edit is checked against
(a project). The file has to exist first:
: > hello.yaml
yoke-compose add unit greeter --kind plugin --plugin com.example.greeter --file hello.yaml --manifests manifests
yoke-compose add channel cli --transport local --clients multiple --file hello.yaml --manifests manifests
wrote units.greeter in hello.yaml
wrote channels.cli in hello.yaml
units:
greeter:
kind: plugin
plugin: com.example.greeter
channels:
cli:
transport: local
clients: multiple
Where its files are
/etc/yoke/
├── core.yaml the Core's configuration: the process, not the deployment
├── deployment.yaml -> deployments/hello.yaml the composition in force
├── deployments/
│ └── hello.yaml a composition document
└── plugins.d/
└── com.example.greeter/
└── manifest.yaml the Plugin's Manifest, delivered by its package
/usr/lib/yoke/
├── plugins/com.example.greeter the Plugin's executable, found from its identity
└── interfaces/ a managed interface's executable, named by the composition
/var/lib/yoke/ the deployment's state, at fixed paths
├── registry.db
├── logs.db
└── secrets/
/run/yoke/ the sockets, made by the Core at each start
Adding a Plugin is adding a package, and changing what runs is changing the composition: neither
rewrites the other's file. Several compositions may sit in deployments/, and the link
/etc/yoke/deployment.yaml says which one is in force
(the layer).
Its life
| Moment | What happens | With |
|---|---|---|
| put in place | the Plugins' packages are installed, the composition written and linked; on a device, the image does all three when it is built | the distribution's package manager, or the image's recipes |
| checked | the gate runs over the composition in force, against what is on the host | yoke service check |
| started | the init system runs the manager, which runs the gate and then becomes the Core: nothing starts unchecked, even at boot with nobody present | yoke.service, enabled; yoke service start by hand |
| authorised | the operator enables each Plugin and grants what it needs, once for the host | yoke plugin grant, with no instance to name |
| changed | a new composition is linked, or a Plugin's package upgraded, and the deployment restarted | yoke service restart |
| stopped | the init system stops the Core, which stops the units | yoke service stop |
yoke service acts on the one deployment the init system activates, through systemctl and the unit
yoke.service; a start the gate refuses is said to whoever asked, and the init system is not asked at all
(the command line). An interface client reaches a channel
of the service with the same library as in the application form, naming the service instead of an
instance (an interface client).
The state does not follow the composition. It lives at fixed paths, so a host that switches composition keeps the Registry it had, including authorisations granted to Plugins nothing composes any more.
What differs from the application form
| Yoke Service | Yoke Application | |
|---|---|---|
| the description | a composition document in /etc/yoke/deployments/, and each Plugin's Manifest in /etc/yoke/plugins.d/ | yoke.yaml, inside the package, the only source of truth about the application |
| who starts the Core | the init system, through the manager, which checks first | the guardian, from the instance's record, checking first |
| how many | one deployment per host | as many instances per account as are created |
| state | /var/lib/yoke/ | $XDG_STATE_HOME/yoke/instances/<name>/state/ |
| sockets | /run/yoke/ | $XDG_RUNTIME_DIR/yoke/<name>/ |
| installing | the distribution's package manager, or the image | yoke app install, from a .yoke file |
| integrity | the distribution's package manager vouched for the files | the package's signature and digests, checked again before every start |
| who may reach a socket | members of a dedicated group | the account that started the instance |
What never differs
The two forms differ above the Core and never below it. The sockets are the same tree with the same names; only the directory they sit in and its owner change. No unit can tell which form it runs in, and none needs to:
- a Plugin is launched by the Core, admitted by the Core and supervised by the Core;
- its Manifest is the same file in both forms;
- nothing its author writes changes between them.
Interfaces are the same: a channel, its projection and the contract it carries are identical in both, and a panel written for one runs unchanged in the other. The guarantee a channel gives is a property of the channel, not of the form: a service that serves one open network port is weaker at that port than an instance that serves only local sockets (a routable channel).
What a site supplies is named the same way in both. A device, a directory or a secret a program needs
is declared as a need, and the deployment supplies the particular one: in the composition here, in the
instance's parameters there. A secret is given to the running deployment with yoke service set-secret,
and never written into a description (secrets).
An application moves from one form to the other unchanged. The worked example of the reference runs the same station as an instance on a bench, and then as the service on the instrument (a walk through the example); and on an embedded device builds an image in either form.