Go tool that migrates devices from source ClearBlade device table to a destination ClearBlade device table.
This tool is designed to migrate devices between ClearBlade instances. If you haven’t configured your source and destination instances yet, refer to the following documents:
This tool allows multiple CLI flags for starting the migration. See the below chart for available start options as well as their defaults.
| Name | CLI flag | Default | Required |
|---|---|---|---|
| Path to Destination ClearBlade Service Account File (see here for more info) | cbServiceAccount |
N/A | Yes |
| Destination ClearBlade Registry Name | cbRegistryName |
N/A | Yes |
| Destination ClearBlade Registry Region | cbRegistryRegion |
<cbSourceRegion> |
No |
| Source ClearBlade Registry Name | cbSourceRegistryName |
N/A | Yes |
| Source ClearBlade Registry Region | cbSourceRegion |
N/A | Yes |
| Path to Source ClearBlade Service Account File | cbSourceServiceAccount |
N/A | Yes |
| Device to migrate CSV file path | devicesCsv |
N/A | No |
| Update public keys for existing devices | updatePublicKeys |
true |
No |
| Store Config Version History | configHistory |
true |
No |
| Skip Migrating Latest Config | skipConfig |
false |
No |
| Non-Interactive (silent) Mode | silentMode |
false |
No |
| Cleanup existing CB registry | cleanupCbRegistry |
false |
No |
| Instead of migrating devices, export device ids to file | exportBatchSize |
N/A | No |
Create a service account by following this guide.
Install & run the latest binary from https://github.com/ClearBlade/clearblade-iot-core-migration/releases.
clearblade-iot-core-migration -cbServiceAccount <JSON_FILE_PATH> -cbRegistryName <CB_IOT_CORE_REGISTRY> -cbRegistryRegion <CB_PROJECT_REGION> -cbSourceServiceAccount <JSON_FILE_PATH> -cbSourceRegistryName <SOURCE_CB_IOT_CORE_REGISTRY> -cbSourceRegion <SOURCE_CB_PROJECT_REGION>
You will be prompted to enter a device's CSV file path that will be used to migrate devices specified in the CSV file. You can skip this step by pressing enter; by default, all the registry's devices will be migrated. Alternatively, you can set the --silentMode flag to run the tool in non-interactive mode.
Note: if providing a CSV file, the file must have column headers defined in row 1. In addition, the column specifying device IDs must have a column header of deviceId
Note: We recommend you use Linux or Darwin binaries. It's unlikely, but something could fail during the migration. A failed_devices CSV file will be created at the end of this migration. Please submit this file to ClearBlade Support, and we will ensure 100% success.
Running this tool close to your ClearBlade instances (e.g., same cloud region) will improve migration speed.
When migrating gateways, the tool checks that bound devices exist, creates those devices if they don't exist, and binds them to the gateways.
Rerunning the tool against previously migrated devices and gateways will update them, if needed, and skip them if not. This includes updating gateway to device associations (bindings).
The tool was written in Go and therefore requires Go to be installed (https://golang.org/doc/install). To compile the tool for execution, the following steps need to be performed:
- Retrieve the migration tool source code.
git clone [email protected]:ClearBlade/clearblade-iot-core-migration.git
- Navigate to the clearblade-iot-core-migration directory.
cd clearblade-iot-core-migration
- Compile the tool for your needed architecture and OS.
GOARCH=arm GOARM=5 GOOS=linux go build
To release a new version, the following steps need to be performed:
- Commit and push your changes to the master branch.
- Add a new tag to the new commit.
git tag -m "Release v1.0.0" v1.0.0 <commit_id>
- Push tags.
git push --tags
- GoReleaser and GitHub actions will take care of releasing new binaries.
If you have any questions or errors using this tool, please feel free to open tickets on our IoT Core Support Desk.