Device Provisioning

Provisioning your device is the first step in the process to manage your applications, models, and devices remotely. Once you have completed the provisioning process on a device, that device will be visible on your devices table, which you can view on the Devices tab of the alwaysAI Console. Visit the Device Overview page to learn more about the details of the devices that are available to you. To learn how to deploy and manage your applications and models to a device visit the Deploying Your Application page.

Add Images

Provision Device

System Requirements & Prerequisites

  • Supported OS:

    • Debian Bookworm, Bullseye

    • Ubuntu 23.10, 22.04, 20.04, 18.04

    • NVIDIA Jetpack 5.1, 4.6.x

  • Supported target architecture

    • amd64

    • aarch64

  • docker >= 19.03

  • docker-compose >= 1.29.0; < 2.0.0

  • curl installed (required to download provisioning scripts)

  • Passwordless sudo for npm if using pm2

  • Passwordless sudo for /sbin/shutdown for device restart functionality

To enable passwordless sudo for npm and sbin/shutdown for the current user, run sudo visudo and add the following lines to the end of the file:

<username> <hostname> = (root) NOPASSWD: /usr/bin/npm
<username> <hostname> = (root) NOPASSWD: /sbin/shutdown

On a linux system username can be obtained by typing whoami into the terminal. Similarly, if you don’t know your hostname you can simply type hostname.

Install the alwaysAI Device Agent and dependencies

On the target device, run:

$ curl -fsSL https://artifacts.alwaysai.co/device-agent/install-device-agent.sh | sudo -E bash -

The Device Agent will be available in the terminal as aai-agent.

Provision the device

Provisioning the device performs the following:

  1. Create the device in the alwaysAI Cloud

  2. Obtain device credentials to connect to alwaysAI Cloud

  3. Run the alwaysAI Device Agent in the background

Run the following command on the target device to provision it:

$ curl -fsSL https://artifacts.alwaysai.co/device-agent/provision.sh | bash -s -- --email <email> --password <password> [--device-name <device_name>]

Where:

  • email is the email associated with your alwaysAI account.

  • password is the password for your alwaysAI account.

  • device_name is an optional device name, which will be displayed on the devices page of the alwaysAI Dashboard. If a device name is not provided, one will be generated for you and logged to the console for reference.

Important note: If your password contains one or more special characters and you receive an error message that your password does not match your username but you are sure that it is correctly entered, please try preceding every special character in your password with a backslash, and re-running the provisioning command. You can also reset your password at https://console.alwaysai.co/dashboard by logging out, navigating to the sign in page, and clicking ‘Forgot Password?’.

Confirm the Device Agent is running with the following command:

$ pm2 list
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id  name                mode           status     cpu       memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0   aai-agent           fork      15    online     0%        2.8mb    │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘

To restart and update the Device Agent run the following command:

$ pm2 restart aai-agent
Use --update-env to update environment variables
[PM2] Applying action restartProcessId on app [aai-agent](ids: [ 0 ])
[PM2] [aai-agent](0) ✓
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id  name                mode           status     cpu       memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0   aai-agent           fork      16    online     0%        2.6mb    │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘

If you’d like to only provision the device, but not start the Device Agent in the background (skip step 3), run with the --provision-only flag:

$ curl -fsSL https://artifacts.alwaysai.co/device-agent/provision.sh | bash -s -- --email <email> --password <password> [--device-name <device_name>] --provision-only

When the script completes, the device will be provisioned but the Device Agent will not be running in the background.

At the completion of the provisioning process, you can view your device in the device table on the Devices tab of the alwaysAI console.

Device Cleaning and Uninstalling

In order to fully clean the device and uninstall the agent, use the following steps:

Stop PM2 instance of the device agent

Using pm2 list, display the list of current pm2 instances. The output should look like this:

$ pm2 list
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id  name                mode           status     cpu       memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0   aai-agent           fork      15    online     0%        2.8mb    │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘

Run the following commands where <id> is the ID for aai-agent.

$ pm2 stop <id>
$ pm2 delete 0
$ pm2 flush
$ pm2 unstartup

Remove the device configuration

Open a new terminal and run aai-agent device clean.

Uninstall the Device Agent from the device

Run sudo npm uninstall -g @alwaysai/device-agent. Verify successful removal by running aai-agent. You should see a response similar to -bash:/usr/bin/aai-agent: No such file or directory.

Remove the device from the alwaysAI Dashboard

Go to the Devices tab, find the device in question, and remove the device using the trashcan icon.