Creating Schemas
Configs
Applications have a variety of configurations serving different purposes. Below are some configs for a fictional robot. Each config is responsible for a particular aspect of the robot’s behavior.
Every config has a history of config schemas
and a history of concrete configs deployed
to robots. Below are the config schemas for the Mobility
config.
Config Schemas
Miru requires the use of config schemas. These schemas validate concrete configs before deployment, preventing runtime application errors.
Config schemas live in a git repository (preferably in the same repository as the code consuming the config to minimize versioning errors between code and configurations).
As an example, let’s say our application has the following directory structure.
This is just an example structure - schemas and configs can be located anywhere.
mobility.schema.yaml
specifies the possible values for the mobility.yaml
concrete
config. On the other hand, mobility.yaml
defines actual concrete config values.
Miru SDK
However, concrete configs defined in a git repository are for development use only. In production, concrete configs are defined in the cloud and retrieved from the Miru Agent running on the robot (more on this later) .
In development, quickly defining and editing configurations is essential.
mobility.yaml
supplies concrete config values via the local file system for
quick iteration. mobility.yaml
is never uploaded to the cloud or deployed to production robots.
To support both development and production scenarios, Miru provides an SDK. Below is a code snippet of the SDK in development.
In production, the SDK retrieves the concrete config from the Miru agent running on the
robot. The agent is a lightweight systemd
service that provides the SDK with the
concrete configs over a unix socket.
Below is a code snippet of the SDK in production.
More will be said about the Miru agent in coming sections. For now, the key takeaway is that the development workflow leverages the local file system for consuming concrete configs via the Miru SDK.
Pushing a Schema
Once ready to deploy new configurations to production, config schemas are uploaded to the cloud using the Miru CLI.
The CLI collects some git information to help version and track config schemas when viewing them in the Miru dashboard. Miru does not have access to your git repository. The git information is extracted from the git repository where the CLI is run.
After executing miru schema push
, config schemas are available in the dashboard.
We recommend using the miru schema push
command in your CI pipeline to upload your
config schemas automatically. Miru will know if a config schema has changed and will
not create a new config schema if it has already been uploaded in a previous commit.