Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS-3497: Update deploy software #3980

Merged
merged 3 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/dev/reference/glossary/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
title: Module
id: module
full_link:
short_description: A module provides one or more modular resources, which add resource types or models that are not built into Viam.
short_description: A module is a code package which provides one or more modular resources, which add resource types or models that are not built into Viam.
---

A _module_ provides one or more {{< glossary_tooltip term_id="modular-resource" text="modular resources" >}}, which add {{< glossary_tooltip term_id="resource" text="resource" >}} {{< glossary_tooltip term_id="type" text="types" >}} or {{< glossary_tooltip term_id="model" text="models" >}} that are not built into Viam.
A _module_ is a code package which provides one or more {{< glossary_tooltip term_id="modular-resource" text="modular resources" >}}, which add {{< glossary_tooltip term_id="resource" text="resource" >}} {{< glossary_tooltip term_id="type" text="types" >}} or {{< glossary_tooltip term_id="model" text="models" >}} that are not built into Viam.
Modules run alongside `viam-server` as separate process, communicating with `viam-server` over UNIX sockets.

You can [create your own module](/operate/get-started/other-hardware/) or [add existing modules from the Viam Registry](/operate/get-started/supported-hardware/).
10 changes: 5 additions & 5 deletions docs/manage/fleet/reuse-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ languages: []
viamresources: []
platformarea: ["fleet"]
level: "Beginner"
date: "2024-08-09"
date: "2025-02-07"
# updated: "" # When the tutorial was last entirely checked
next: /manage/fleet/provision/setup/
cost: "0"
Expand All @@ -39,7 +39,7 @@ You must be an [organization owner](/manage/manage/rbac/) to create fragments fo
Start by configuring one of your machines.

In the [Viam app](https://app.viam.com), use the **CONFIGURE** tab to build a configuration for all resources you want to use on all your machines.
You can use all available resources except [triggers](/data-ai/data/advanced/alert-data/) in the configuration for your machine.
You can use all available resources in the configuration for your machine except [triggers](/data-ai/data/advanced/alert-data/) which aren't supported.
This means you can also use fragments inside a fragment.

{{<imgproc src="/how-tos/one-to-many/config.png" resize="800x" class="fill" style="width: 400px" declaredimensions=true alt="Configuration builder UI">}}
Expand All @@ -48,7 +48,7 @@ This means you can also use fragments inside a fragment.
{{% tablestep %}}
**2. Copy the raw JSON**

In your machine's **CONFIGURE** tab, switch to **JSON** and copy the raw JSON.
In your machine's **CONFIGURE** tab, switch to **JSON** and copy the raw JSON configuration object.

{{<imgproc src="/how-tos/one-to-many/raw-json.png" resize="700x" class="fill" style="width: 400px" declaredimensions=true alt="JSON subtab of the CONFIGURE tab">}}

Expand Down Expand Up @@ -79,7 +79,7 @@ If you want to edit the fragment later, do it from this screen.
**4. Delete the original configuration (optional)**

Now that the configuration is saved as a fragment, you can delete each resource in the original config from your machine and _replace the config with the fragment_ in the next step.
By using the new fragment, all your machines will use the exact same configuration.
By using the new fragment, this and every other machine you add the fragment to will use the exact same configuration.

{{% /tablestep %}}
{{< /table >}}
Expand All @@ -88,7 +88,7 @@ By using the new fragment, all your machines will use the exact same configurati

With your fragment created, you can add it to all machines that should have it.

In the following, you will see how to add a fragment manually. If you are working in a factory setting and need to set up devices before they reach the end user, you can also fragments while [provisioning](/manage/fleet/provision/setup/) your fleet.
In the following steps, you will see how to add a fragment manually. If you are working in a factory setting and need to set up devices before they reach the end user, you can also use fragments to [provision](/manage/fleet/provision/setup/) your machines.

{{< table >}}
{{% tablestep %}}
Expand Down
37 changes: 19 additions & 18 deletions docs/manage/software/deploy-software.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ weight: 30
layout: "docs"
type: "docs"
images: ["/registry/module-puzzle-piece.svg"]
description: You can use a fragment to deploy software packages and ML models to many machines, as well as to update deployed versions of those software packages and ML models.
description: "Deploy code packages with machine control logic to one or more machines."
languages: []
viamresources: []
platformarea: ["registry", "fleet"]
Expand All @@ -18,26 +18,27 @@ aliases:
cost: "0"
---

To deploy code or other software to individual machines:
{{< glossary_tooltip term_id="module" text="Modules" >}} are code packages that provide most of the functionality on your machines: drivers, integrations, and control logic.

The following steps show you how to create modules with control logic and how to deploy and manage all of your machine's modules over the air (OTA):

1. [Create a module with machine control logic](#create-a-module-with-machine-control-logic)
2. [Create a fragment with the configuration for your machines](#create-a-fragment)
3. [Add the fragment to your machines](#add-the-fragment-to-your-machines)
2. [Create a configuration fragment with the modules for your machine](#create-a-fragment)
3. [Add the fragment to one or more machines](#add-the-fragment-to-your-machines)

## Prerequisites

This guide assumes that you have [at least one machine](/operate/get-started/setup/) with [configured hardware and software resources](/operate/get-started/supported-hardware/).
Start by [setting up one machine](/operate/get-started/setup/).
Then, [configure any hardware and software resources](/operate/get-started/supported-hardware/) that you will use with your machine and that you want to drive with your control logic.

## Create a module with machine control logic

You can operate devices by running control logic on another device, for example using an app, or on the machine itself using a {{< glossary_tooltip term_id="module" text="module" >}}.
If all your machine control logic runs on another device or server, move on to [Create a fragment](#create-a-fragment).

If at least some of your machine control logic should run on your machine, place the control logic in a module by following these steps:
One method of operating your machine is by running control logic on another device, such as an app.
With {{< glossary_tooltip term_id="module" text="modules" >}}, you can run your control logic on the machine itself.

{{% alert title="OTA updates for microcontrollers" color="note" %}}
The following steps do not cover how to create a module with machine control logic for microcontrollers.
For microcontrollers, see [Micro-RDK modules](/operate/get-started/other-hardware/micro-module/) and [Over-the-air firmware updates](/operate/get-started/other-hardware/micro-module/#over-the-air-updates) instead.
The following steps cover how to create a module for machines running `viam-server`.
For microcontrollers, see [Micro-RDK modules](/operate/get-started/other-hardware/micro-module/) and [Over-the-air firmware updates](/operate/get-started/other-hardware/micro-module/#over-the-air-updates).
{{% /alert %}}

{{< table >}}
Expand Down Expand Up @@ -79,7 +80,7 @@ When your new model gets added to your machine, its `reconfigure()` method gets
If you want your control logic to run in a loop in the background, you can start this loop here.
Be sure to also implement logic to handle subsequent calls to the reconfigure method gracefully.

For example, in Python, start your logic in <FILE>src/main.py</FILE>:
For example, in Python, start your logic in the `reconfigure()` method of <FILE>src/main.py</FILE>:

```python {class="line-numbers linkable-line-numbers" data-line="20-28"}
# Add these imports
Expand Down Expand Up @@ -168,7 +169,7 @@ For complete examples that implement control logic, see:
- [`event-manager`](https://github.com/viam-modules/event-manager)
- [`refill-controller`](https://github.com/viam-devrel/refill-controller)
- [`re-id-object-tracking`](https://github.com/viam-modules/re-id-object-tracking)
- [`detectio-dock`](https://github.com/viam-labs/detection-dock)
- [`detection-dock`](https://github.com/viam-labs/detection-dock)

{{% /tablestep %}}
{{% tablestep link="/operate/get-started/other-hardware/manage-modules/#update-an-existing-module-using-a-github-action" %}}
Expand All @@ -189,18 +190,18 @@ Your module will now be built, packaged and pushed to the Viam Registry.
## Create a fragment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on the exact line here but line 172 has a typo - says "detectio-dock" (missing an n)


Viam has a built-in tool called _{{< glossary_tooltip term_id="fragment" text="fragments" >}}_ for using the same configuration on multiple machines.
When deploying or updating software on many machines, you should use fragments.
When deploying or updating software on many machines, you should use fragments to deploy your modules OTA to your machines.

The following example creates a fragment with a camera and a servo, as well as with the [control logic module](#create-a-module-with-machine-control-logic).
The following example starts with a machine with a camera and a servo and adds the [control logic module](#create-a-module-with-machine-control-logic).
The resulting machine configuration gets used to create the fragment for reuse on other machines.

{{< table >}}
{{% tablestep link="/operate/get-started/supported-hardware/" %}}
**1. Configure your software**

Go to your [machine](#prerequisites) in the [Viam app](https://app.viam.com).
Ensure all hardware and other resources your machine uses are configured.

Add your control logic module.
Then add your control logic module.

{{<imgproc src="/how-tos/deploy-packages/add-package.png" resize="800x" class="fill aligncenter" style="width: 500px" declaredimensions=true alt="Configuration builder UI">}}

Expand Down Expand Up @@ -265,7 +266,7 @@ We only created this machine to easily generate the JSON config for the fragment

## Add the fragment to your machines

Generally, you will use [provisioning](/manage/fleet/provision/setup/) to add this fragment to your machines.
Generally, fragments are used with [provisioning](/manage/fleet/provision/setup/) to deploy and manage softwareon many machines.

You can also add the fragment manually to the machines that need it:

Expand Down
Loading