Creating Schemas
Config Types
Applications have various configurations serving different purposes. Below are some config types for a fictional robot. Each config type is responsible for a particular aspect of the robot’s behavior.
Every config type has a history of config schemas as well as a history of config instances deployed to robots. Below are the config schemas for the Mobility
config type.
Config Schemas
Miru requires the use of config schemas. These schemas validate config instances before deployment, preventing runtime application errors.
Config schemas live in a git repository for streamlined development and versioning with git.
As an example, say an application has the following directory structure.
This is just an example structure - schemas and instances can be located anywhere and named anything.
mobility.schema.yaml
specifies the possible values for the mobility.instance.yaml
config
instance.
Miru SDK
Config instances defined in a git repository are for development use only. In production, config instances 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.instance.yaml
supplies config instance values via the local file system for quick iteration. mobility.instance.yaml
is never uploaded to the cloud or deployed to production robots.
Miru provides an SDK to support both development and production scenarios. Below is a code snippet of the SDK in development.
In production, the SDK retrieves config instances from the Miru agent running on the
robot. The agent is a lightweight systemd
service that serves config instances to the SDK over a Unix socket.
Below is a code snippet of the SDK in production.
More will be said about the Miru agent in the coming sections. The key takeaway is that the development workflow leverages the local file system to consume config instances, while the production workflow leverages the Miru agent.
Pushing a Schema
When ready to deploy new config instances to production, config schemas are uploaded to Miru using the Miru CLI.
The CLI collects some git information to aid versioning and tracking config schemas from the Miru dashboard. Miru does not have access to your git repository; git information is extracted from the local git repository where the CLI is run.
After executing miru schema push
, the 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.