Registering Yocto image
These guidelines explain how to insert Connect agent into a Yocto image build, in order to deploy Connect on a big scale of devices at once.

Yocto image requirements:

  1. 1.
    Systemd or init.d + Cron. *It is recommended to use Systemd DISTRO_FEATURES_append = " systemd" VIRTUAL-RUNTIME_init_manager = "systemd" DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" VIRTUAL-RUNTIME_initscripts = ""
  2. 2.
    OpenSSH: CORE_IMAGE_EXTRA_INSTALL_append = " openssh"

How to register a device by adding Connect agent software to the Yocto file system image build

Connect agent automatically recognizes new devices based on the "device_token" (generated by the Connect service) of the device. The next method can help you install Connect on a fleet of devices easily without the need to register each device separately.
This guide is specifically for building Yocto image with Connect agent inside:
  1. 1.
    Download Connect software zip file:
connect-agent.zip
2MB
Binary
2. Extract the zip file.
3. Open the file Connect -> service -> settings.json
4. Fill the values of "user_token" and "project_name" (can be found by clicking on 'Register Device' inside Connect platform). Colors: user_token - orange, project_name - green.
5. Save the file. Here is an example of a ready settings.json file:
{"user_token":"4aAT_NPRQsKLam2ryjzNRV_XKSK1nkkcVQ","project_name":"Demo","device_name":"","device_group":"","software_version":"","device_token":""}
*By default devices will register with automatic name - "New Device" to group - "Production".
6. Copy the next files and directories to your Yocto file system:
  1. 1.
    connect directory to /etc/
  2. 2.
    connect.service to /etc/systemd/system/
  3. 3.
    connect.service to /etc/systemd/system/multi-user.target.wants/
After copying the files, the next paths need to exist: directory -> /etc/connect
file -> /etc/systemd/system/connect.service
file -> /etc/systemd/system/multi-user.target.wants/connect.service
* In case Systemd service manager doesn't exist, please follow the next guide to install JFrog Connect on init.d or contact us at [email protected] to receive guidelines accordingly.
For some agent sub-versions, the branding and name of "connect" is defined as "upswift" if the directory/service name of Connect does not exist, make sure to check for "upswift" as well.

Set custom device name and group automatically at scale

As noted above, new devices will automatically be registered with "New Device" as the device name and into the "Production" group. After adding the Connect agent to the file-system image, you might want to add a unique 'Device name' and 'Group' to each of the devices that register themselves. You can choose any of these 2 options to do so.
Option A
The device name and group can be changed using the Connect REST API - change devices details.
By using the Connect REST API, the device can run a script to change the name and group after device registration.
Option B
In order to set a custom name and group for each deployed device, you will need to add a script that will run on the device boot. The script should pull a unique identifier for this device (For example - mac address or serial number). To insert the value as the device name and update the Connect agent settings JSON file, found at/etc/connect/service/settings.json and insert the value under the "device_name" key. You can also edit the "group" key to match the group you want the device to move into.