Registering devices at scale

When scaling to production, provisioning each and every device is a very time-consuming task. Therefore, JFrog Connect allows you to register devices automatically by embedding it into your own Image.

How to register devices at scale

The next guide can help you install Connect on a fleet of devices easily without the need to register each device manually.

Option B: Freeze image

Using this guide you will be able to register devices by duplicating an existing OS image that has the Connect Agent installed inside it.
  1. 1.
    Install Connect agent on a single device and make sure the device has been registered at the dashboard.
  2. 2.
    Disconnect the device from the internet.
  3. 3.
    Delete the file: /etc/connect/service/settings.json
  4. 4.
    Create a new file: /etc/connect/service/settings.json and enter the next content to it:
    {"user_token":"<user_token>", "project_name":"<project_name>", "device_name":"", "device_group":"", "software_version":"", "device_token":""} Make sure to change the <user_token> to your account token. You can find it on Connect dashboard in the Settings category (click on the "Show Account Token" button). Also, change the <project_name> to the project you want this device to be registered to. You can find your projects on Connect dashboard in the Settings category under the Project tab.
  5. 5.
    Save the file (from now on, don't connect the device to the internet until duplicating the image).
  6. 6.
    Duplicate this device image, and burn it on other SD cards or eMMC flashes.
  7. 7.
    Boot a new device with the duplicated image, Connect agent will automatically recognize that it is running on new hardware and will register that device as a new device.
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

Option A The device name and group can be changed using Connect REST API - change devices details.
By using Connect REST API, the device can run a script to change the name and group after device registration.
Option B You can set the default group and device name by modifying the settings.json file. Before the device registers to the platform, you can modify the file /etc/connect/service/settings.json with the values of the keys device_name and device_group. Make sure the group you set exists on Connect dashboard.
In case of using option B, please consider adding the next steps in order to set the device name and group correctly:
  1. 1.
    Run a script on the device boot using crontab or init.d.
  2. 2.
    check if /etc/connect/service/settings.json already exists, if exists, finish the script.
  3. 3.
    if it doesn't, generate the device name (by any method you would like).
  4. 4.
    Create the /etc/connect/service/settings.json file and insert into it the needed parameters as seen above including the values.
  5. 5.
    change file permissions by running chmod 777 /etc/connect/service/settings.json
By default, if no device name or group has been defined, Connect will register the device with a generic name - New device to the group Production.
Please note! After the device registers to the platform, the settings.json file is encrypted and you will not be able to modify it anymore. To receive the device token, you can run the agent binary with the flag --print-token. The command is:/etc/connect/service/ConnectAgent --print-token

Explanation of Connect device registration algorithm

By default, Connect is capable of registering new devices by duplicating an image that has Connect agent installed inside it. Connect device registration algorithm recognizes new devices if they don't have a device token yet. The device token is generated when the device registers for the first time and is saved encrypted in the settings.json file on the device.