An app is a piece of software that ORC8R installs and runs on your nodes. Instead of logging into each machine and setting things up by hand, you attach an app to a pool and ORC8R installs it on every node for you. This page explains how to use existing apps and how to build your own. Apps that serve traffic have a page of their own: Serving traffic from an app.

How apps get onto nodes

You choose apps when you request nodes. In the Choose apps step of the request wizard (see Pools):

  1. Click Add Application.
  2. Pick an app from the catalog.
  3. Choose a version, and fill in any settings the app asks for.

Every node created for that pool then installs the apps you selected. If you add none, nodes start with just the agent. Some apps run a task once and finish (for example, installing a package); others run continuously as a service.

Configuring apps for a project or organization

You can set defaults for an app so that everyone requesting nodes gets sensible values without filling them in each time. Open a project and go to Project Apps (or an organization and go to Organization Apps). For each app you can:

  • Pin a version so new nodes always use a known-good release.
  • Set default values for the app's settings.
  • Lock settings so users cannot change them at request time. Settings the platform fills in (see Values the platform fills in) start out locked; uncheck Lock to let requests set their own value.
  • Disable the app so it does not appear in the catalog for that project or organization.

Settings flow from broad to narrow: an organization's defaults apply to all its projects, and a project can add its own on top. If your organization disables an app, a project inside it cannot turn it back on.

Authoring your own app

An app is packaged as a standard OCI artifact (the kind of package used for container images), so it can be stored in an ordinary registry. You describe the app in a file called artifact.yaml and build it with orc build, which checks the file and tells you about mistakes while packaging rather than at deploy time. This page describes format v2, the format new apps use.

A first app

This app installs Debian or Ubuntu packages. It has one setting, and its install phase runs one script:

artifactType: application/vnd.orc8r.app.v2
annotations:
  org.opencontainers.image.title: apt
  org.opencontainers.image.description: Install Debian/Ubuntu packages via apt-get
config:
  params:
    type: object
    required: [packages]
    properties:
      packages:
        type: string
        title: Packages
        description: Space-separated package names (e.g. git curl htop)
  install:
    command: ["./install-apt.sh", "--packages=${packages}"]
files:
  - install-apt.sh
platforms:
  - {os: linux, arch: amd64}
  - {os: linux, arch: arm64}

The script is an ordinary program that takes its settings as flags:

#!/bin/sh
set -eu
packages=
for arg; do
	case $arg in
	--packages=*) packages=${arg#--packages=} ;;
	--help) echo "Usage: install-apt.sh --packages=LIST"; exit 0 ;;
	*) echo "unknown argument $arg" >&2; exit 2 ;;
	esac
done
apt-get update
# Word splitting is wanted here: the value is a list of package names.
# shellcheck disable=SC2086
DEBIAN_FRONTEND=noninteractive apt-get install -y $packages

When someone adds this app to a pool and types curl git vim into Packages, every node runs install-apt.sh with one argument, --packages=curl git vim: a value is always one argument, whatever it holds. The rest of this page is the reference behind those two files.

The shape of artifact.yaml

KeyWhat it holds
artifactTypeapplication/vnd.orc8r.app.v2, which marks the package as an ORC8R app.
annotationsThe app's name and description (org.opencontainers.image.title, …description).
configHow the app behaves: its settings, endpoints and lifecycle phases.
filesThe scripts and binaries the package ships.
platformsThe {os, arch} pairs the app supports.

Only artifactType is required. Set org.opencontainers.image.title too: it names your app in the catalog.

Shipping files

files lists what the package carries, each entry a path relative to the recipe's directory. The files land in the app's working directory, where every phase runs. An entry may also be an object that fetches its bytes at build time:

files:
  - install-widget.sh
  - path: bin/widget
    url: https://example.com/widget/2.4.0/widget-linux-amd64
    sha256: "9f2c…"

The fetch happens once, at build time, and the bytes are embedded in the package, so nodes never reach out to that URL. A digest mismatch fails the build. Paths must be relative and normalized: .. and absolute paths are refused. On Unix the execute bit is recorded and restored on the node, so commit your scripts executable.

One package, many platforms

platforms lists the {os, arch} pairs the app supports. orc build builds the package once per platform, and on each it fills ${os}, ${arch} and the names in that platform's vars anywhere in the recipe, files included:

files:
  - path: bin/widget-${arch}
    url: https://example.com/widget/2.4.0/widget-${target}
    sha256: ${widget_sha256}
platforms:
  - {os: linux, arch: amd64, vars: {target: x86_64-linux, widget_sha256: "9f2c…"}}
  - {os: linux, arch: arm64, vars: {target: aarch64-linux, widget_sha256: "41ab…"}}

Any field of config whose value is a string or a list may instead be a map keyed by operating system: linux, darwin, windows, unix (Linux and macOS) or default. The most specific key for the platform wins:

cmd:
  type: string
  description: {unix: "Command to run (POSIX shell)", windows: "Command to run (cmd.exe)"}
  contentMediaType: {unix: text/x-sh, windows: text/plain}

These are resolved at build time, so a published package holds plain values only. A command must resolve on every platform the app lists; to skip a phase on one platform, say so with an empty list (windows: []). Leave platforms out and you get one platformless package, held to the Unix rules.

Settings: the params block

config.params describes the settings an operator fills in: required lists the names that must be set, and properties maps each name to how it behaves. The form shows fields alphabetically; an x-ui-order list beside properties puts the ones it names first, in that order.

FieldMeaning
typeThe value's type, usually string.
titleThe field's label in the request form.
descriptionHelp text under the field.
placeholderExample text in the empty field.
enumA fixed list of choices, shown as a dropdown.
contentMediaTypeThe value's media type, such as application/x-pem-file. Makes it a file.
sensitivetrue stores the value securely and never shows it again. Makes it a file.
lifetimestartup (removed once the app has started) or runtime (kept for the whole run).
x-sourceFilled in by the platform; see Serving traffic.

A setting reaches your program only where a command names it, as ${name}. A sensitive setting, or one with a contentMediaType, is never passed by value: it is written to a file only your app can read (mode 0600), and ${name_file} is that file's path. lifetime decides when the file is removed; when unset, an operator secret is startup and everything else runtime.

Lifecycle phases

The rest of config is the app's lifecycle, as named phases. Include only the ones you need. A phase runs something only when it declares a command.

PhaseRunsFields
installonce, when the app is set up on a nodecommand, timeout
startto launch the appcommand, service, restart, gui
stopwhile the app still runs, to wind it downcommand, signal, timeout, grace
stoppedafter the app has exited, however it exitedcommand, timeout
uninstallwhen the app is removed from the nodecommand, timeout

A start command that keeps running is the app's service. One that exits 0 is reported completed, not failed: that is how a run-to-completion app works, with nothing else to declare. Exiting non-zero is a failure. Timeouts are written <integer>(s|m|h); the defaults are 600s for install, 30s for stop (plus a 10s grace), 60s for stopped and 300s for uninstall.

Running as a system service

Add service to start and the app becomes a managed system service (a systemd unit on Linux, a service entry on Windows) instead of a child of the agent. The name is a plain identifier — jenkins-agent, never jenkins-agent.service. With a command as well, the node writes the service definition for you from restart, the stop signal and grace; with service alone, your install phase registers the service under that name and your uninstall phase removes it.

restart is never (the default), on-failure or always; the service manager honors it, never the agent. Do not enable boot auto-start: after a reboot the node restores run state itself, so an app an operator stopped stays stopped. Prefer a service for anything long-lived: it keeps running while the agent restarts or upgrades. Put ${version} in the name to give each installed version a service of its own.

An app runs as the user the agent runs as. To run as another account, drop privileges in the start command with setpriv --reuid=svc --regid=svc --init-groups (Linux) or sudo -u svc (macOS), never su or runuser: they move your app to a new session the stop signal cannot reach.

The commands, the values they are given, and how an app stops are on App commands and values.

Tracking upstream versions

One package serves every release of the software it installs. config.versions declares where those releases are published, and config.default_version names the one selected by default. Your install command passes the chosen version on with a token, as in --version=${version}. See App versions.

Building and publishing

orc build reads artifact.yaml from the directory you point it at, defaulting to the current one:

$ orc build -t widget:default --push
Resolved reference: orc8r.com/widget:default
sha256:2f9c…
FlagEffect
-t, --tagThe reference to publish under; repeat or comma-separate for several.
--pushPublish after building, instead of only caching locally.
-o, --output <DIR>Write a portable OCI layout directory instead (not with --push).
--format plainWhole-blob layers, required for registries outside ORC8R.

Omit -t and the reference comes from your annotations: the title, and the tag default. A reference with no registry goes to the built-in one. Publishing under default is the usual choice: it is what an app reference with no version resolves to. Every build also attaches your artifact.yaml verbatim, so orc clone recovers the exact recipe.

orc build, orc push and the server check the manifest before they accept it, and refuse it, naming the platform, phase, element and token, when:

  • a token names nothing it can mean where it is used, or a ${ is never closed;
  • two values share a name, or a param's _file form collides with another name;
  • a sensitive or contentMediaType param is used by value instead of as ${name_file};
  • a param filled by a sensitive platform value (such as tls.key) is not marked sensitive;
  • a per-OS map uses a key other than the OS keys, or sits on a field that is not a string or a list;
  • a command is not an argv list, or does not resolve on a platform the app lists;
  • a Unix command's ./name is not a packaged file marked executable.

Packaging gotchas

files is a top-level key, a sibling of config, not inside it.

Values go under params. In a request, an app's values live under params; vars is the recipe's build-time map and nothing else, so a request that sets vars is refused.

Stop the distribution from starting your service for you. On Debian and Ubuntu, installing a package starts its service at once, on the distribution's configuration and port, before yours exists. Refuse it during the install:

printf '#!/bin/sh\nexit 101\n' > /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql
rm -f /usr/sbin/policy-rc.d
systemctl mask --now postgresql || true  # your start phase runs it, with your configuration