Skip to main content
Documentation

Set Up Rugix Apps

Prepare devices and releases, so that you can install and update applications from Nexigon independently of the operating system. Rugix Apps installs each app from a bundle as a new generation and keeps earlier generations on the device for rollback. Nexigon Agent installs, updates, starts, stops, and removes apps as configured in Nexigon Hub, so app releases need neither a system update nor shell access to the device.

How Nexigon Agent manages apps explains the check cycle and the versions kept on the device. To deploy and manage apps once devices are set up, follow Deploy Applications.

Before You Start

You need:

The Nexigon CLI commands assume an organization API token. With a user token, add --organization <org-id> to each command, as Organization Selection describes.

Prepare the Image

Install Rugix Ctrl 1.4 or later, which can record where a generation came from and install a generation without activating it. Rugix Apps is experimental in this version, so its interface may still change. Also install and enable the two systemd services that restore apps after a reboot and recover from interruptions, as described under Reliability. The Debian packages of Rugix Ctrl install them.

Each app declares an orchestrator, the component of Rugix Apps that starts, stops, and checks its workload. Install what your apps’ orchestrators need, for example Docker and Docker Compose for the docker-compose orchestrator. Docker restarts the containers of a docker-compose app after a reboot only if their services set a restart policy, such as restart: unless-stopped. Without one, the app stays stopped until the agent’s next check starts it.

The agent runs rugix-ctrl apps commands as its own user, which needs the privileges to install and run apps. The systemd unit of the recipes runs the agent as root.

Configure Nexigon Agent

Enable the integration in the agent’s configuration, here with hash verification:

/etc/nexigon/agent.toml
[integrations.rugix.apps]
enabled = true
use-bundle-hash = true

With Rugix Bakery, add these settings to the extra_config parameter of the nexigon/nexigon-agent-config recipe. With Yocto, add them to NEXIGON_AGENT_EXTRA_CONF:

conf/local.conf
NEXIGON_AGENT_EXTRA_CONF = "[integrations.rugix.apps]\nenabled = true\nuse-bundle-hash = true"

In both cases, merge the settings into existing extra configuration.

The integration provides the nexigon.rugix-apps.check command, with which the web interface asks the device to apply each change that you make there right away. After changes made with Nexigon CLI, the device applies changes at its next check, by default within about four hours. App Management lists all settings.

Choose Bundle Verification

Rugix Ctrl verifies app bundles like system update bundles: with a signature that the image trusts or, with use-bundle-hash enabled, with a hash from the bundle’s metadata in Nexigon Hub. Choose Bundle Verification explains the trade-off. Without a trusted signature or a hash, every installation fails.

Select the Architecture

A release of an app can contain bundles for several architectures. A device installs the bundle named <app>-<arch>.rugixb, where <arch> is its architecture, and otherwise <app>.rugixb, which suits apps that run on every architecture.

The architecture defaults to the one that the agent was built for. The agent uses Rust’s names, such as x86_64 and aarch64, and arm for every 32-bit ARM architecture. Name bundles accordingly, even where other tools use other names; Rugix Bakery, for example, calls x86_64 and aarch64 amd64 and arm64. To tell apart variants that share a name, set the architecture explicitly, for example on a device that runs bundles built for ARMv7:

/etc/nexigon/agent.toml
[integrations.rugix.apps]
enabled = true
arch = "armv7"

The device then installs <app>-armv7.rugixb.

Verify the Integration

Build an image, boot a device with it, and wait for the agent to connect. Then read the status of the device’s apps on the device:

nexigon-agent device properties get dev.nexigon.rugix-apps.status

The command prints the status as value, for example on a device with one app installed in its image (shortened):

{
  "result": "Found",
  "name": "dev.nexigon.rugix-apps.status",
  "value": {
    "arch": "aarch64",
    "rugixCtrlVersion": "1.4.0",
    "apps": {
      "historian": { "managed": false, "workload": { "state": "running" } }
    }
  }
}

Check that arch is the architecture that you name bundles for and that rugixCtrlVersion is 1.4 or later. Once the status exists, the device’s page in Nexigon Hub shows an Applications tab. If the property is missing or reports an error in lastError, inspect the agent’s log with journalctl -u nexigon-agent -b.

Publish an App

Build an app bundle with Rugix Bundler, as described for your app’s orchestrator. The bundle’s manifest sets the name under which Rugix Ctrl installs the app, for example controller.

Publish each app as a package and each release as a version of that package, with one bundle for each architecture. For example, the following commands publish release 1.0 of controller for 64-bit ARM devices:

nexigon-cli repositories packages create my-repo controller --kind rugix-app
nexigon-cli repositories versions create my-repo/controller --tag 1.0,locked
nexigon-cli repositories assets upload my-repo controller-aarch64.rugixb
hash=$(rugix-bundler hash controller-aarch64.rugixb)
nexigon-cli repositories versions assets add <version-id> <asset-id> \
    controller-aarch64.rugixb --metadata "{\"rugix\": {\"bundleHash\": \"$hash\"}}"
nexigon-cli repositories versions tag <version-id> --tag stable,reassign

The first command creates the package, which is needed only once. Its kind rugix-app makes the web interface offer the package as an app. The second creates the version and prints its ID as versionId; devices do not install it before it reaches the tag that they follow. The third uploads the bundle and prints its ID as assetId. The next two compute the bundle’s hash and attach the bundle with the hash as metadata; with signed bundles, omit the hash. The last command moves the stable tag to the release. Publish Software explains these commands. To add a hash to a bundle that is already attached, use repositories versions assets set-metadata.

The web interface uses the package name as the app name. If they differ, set rugix.app.name in the package metadata, for example for a package named controller-bundle:

nexigon-cli repositories packages create my-repo controller-bundle \
  --kind rugix-app \
  --metadata '{"rugix": {"app": {"name": "controller"}}}'

To keep Rugix Ctrl from installing a bundle on the wrong architecture, declare a host.arch requirement in the bundle’s compatibility metadata. Rugix Ctrl also uses Rust’s names, so use arm, not armv7, for 32-bit ARM devices.

If the repository is private, link it to the devices’ project under Project Settings → Linked Repositories.

Test an Update

Add the app to the device. Its state passes through installing and activating and ends with completed and a running workload. On the device, rugix-ctrl apps info controller lists the new generation with the package version as its origin.

If the update does not complete, its status explains why:

SymptomWhat to Check
The update fails with version ... does not exist.The path names an existing tag or version ID, and a private repository is linked to the device’s project.
The update is blocked with the code no-asset.The release contains a bundle named for the arch that the device reports.
The update fails because Rugix Ctrl cannot verify the bundle.The bundle has a hash in its metadata and use-bundle-hash is enabled, or the bundle is signed with a certificate that the image trusts.
The update fails after the download, for example with the bundle did not install a generation of the app.The bundle’s manifest uses the app name of the configuration. Otherwise, Rugix Ctrl installs the bundle as another app, which then appears as not managed.
The status reports errors of rugix-ctrl, such as failed to inspect the app.The device runs Rugix Ctrl 1.4 or later, as rugixCtrlVersion shows.
The update fails during the activation.The workload’s logs. The new generation failed to start, so Rugix Apps has returned the app to its previous generation.