Skip to content

sotec-iot/hono-migration

Repository files navigation

Hono Migration Tool

Application migrates registries, devices, credentials and configs from Google's iot core to Hono.


Authentication

There are 2 methods to authenticate with the application:

  1. Running application on Google Cloud.

    If you’re running in a Google Virtual Machine Environment (Compute Engine, App Engine, Cloud Run, Cloud Functions), authentication should “just work”.

  2. Using Service Account json key.

    If you’re running your application elsewhere, you should download a service account JSON keyfile and point to it using an environment variable:

    $ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/keyfile.json"

    or use the --key argument to pass the key path to the service account.

    Account should have the roles:

    1. Cloud IoT Core Service Agent
    2. Cloud IoT Viewer
    3. Cloud Trace Agent
    4. IAP-secured Web App User (for the project to which the devices should be migrated to)
    5. Pub/Sub Editor
    6. Service Controller

Running the application


To run the application, use the output/hono_migration_tool.exe file.

EXE file was created with Pylancher.


Line Args

Line Args Mandatory Description
-p,
--project
Yes Google Cloud Project ID (migration source)
-k,
--key
Yes Service Account Json Key path
-u,
--api
Yes Hono device registry api url (migration target),
example https://my_hono_api/v1
-a,
--audience
Yes Target audience (OAuth 2.0 Client),
example 837927849228-js9djh3li9shfut7hfbcjjapsjf8d86s.apps.googleusercontent.com
-t, --tenant Yes The Hono tenant ID
-reg, --registry Yes The Google IoT Core registry to migrate
-r,
--region
No Google Cloud Region (migration source).
Valid regions are: {asia-east1,europe-west1,us-central1}
Default is europe-west1
--migrate_gateways No Boolean flag indicating whether to migrate gateways or not

Running the application examples


EXE file:

hono_migration_tool.exe
--project my-project  
--api https://my_hono_api/v1 
--region europe-west1 
--tenant test-1
--registry hono-registry-1
--audience 837927849228-js9djh3li9shfut7hfbcjjapsjf8d86s.apps.googleusercontent.com  --key .\hono-cloud-endpoint-manager.json


Python file:

python.exe app.py 
--project my-project
--api https://my_hono_api/v1 
--region europe-west1 
--tenant test-1
--registry hono-registry-1
--audience 837927849228-js9djh3li9shfut7hfbcjjapsjf8d86s.apps.googleusercontent.com  --key .\hono-cloud-endpoint-manager.json


Gateways migration


Gateways from IoT Core will be migrated as devices to Hono. To migrate gateways args flag --migrate_gateways should be set.

example:

python.exe app.py 
--project my-project 
--api https://my_hono_api/v1
--region europe-west1 
--audience 837927849228-js9djh3li9shfut7hfbcjjapsjf8d86s.apps.googleusercontent.com  --key .\hono-cloud-endpoint-manager.json
--migrate_gateways

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages