Deploy software to machines
Deploy modules (hardware drivers, control logic, or other custom code) to one machine or an entire fleet. You configure the module in a fragment, apply the fragment to your machines, and the machines download the module from the Viam registry automatically.
Prerequisites
- A module uploaded to the Viam registry. See deploy a module for how to upload.
- A fragment for your fleet configuration. If you don’t have one yet, create one first.
1. Add the module to a fragment
- Navigate to your fragment’s page at app.viam.com/fragments.
- Click + and select Configuration block.
- Search for your module in the registry and add it.
- Configure the module’s attributes as needed.
- Click Save.
2. Set the version strategy
Each module in the fragment has a version field. On the fragment card for the module, find the Update version section:
- Latest version: the machine downloads the newest version when it syncs. This is the default.
- Pin to version: the machine stays on a specific version and does not update automatically.
- Pin to tag: the machine uses whichever version the fragment tag points to. This option appears only when the fragment has tags. See reuse configuration for how to create tags.
Caution
For any version type other than pinning to a specific version, the module updates as soon as a matching version is available, which restarts the module. If the module cannot be safely interrupted, pin to a specific version and update manually.
To control when updates are applied, configure a maintenance window. See manage versions for details.
3. Apply the fragment to machines
Through the Viam app:
- Navigate to each machine’s CONFIGURE tab.
- Click + and select Configuration block.
- Search for your fragment and select it.
- Click Add fragment.
- Click Add fragment again to confirm, then Save.
Through provisioning:
Include the fragment ID in your viam-defaults.json file. New machines apply the fragment automatically on first boot. See provision devices.
Through the CLI:
viam machines part fragments add --part=<part-id> --fragment=<fragment-id>
To find your part ID, run viam machines part list --machine=<machine-id>. To find the fragment ID, copy it from the fragment’s page in the Viam app or run viam organizations list and check your fragments.
4. Verify the deployment
- Navigate to a machine’s CONFIGURE tab and confirm the module appears in the resource list.
- Go to the CONTROL tab and test the deployed components or services.
- Check the LOGS tab for any errors from the module.
On the fleet dashboard at app.viam.com/fleet/machines, confirm your machines are online and showing the expected viam-server version.
Related pages
- Reuse configuration for creating and managing fragments
- Deploy ML models for deploying trained ML models
- Manage versions for version pinning and maintenance windows
- Build and deploy modules for writing and uploading modules
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!