Update omg utility
omg update
or npm i -g @ombori/ga-cli
Create a module
omg module create <orgName>.<moduleName>
A new directory will be created containing a template for a new module (in you language of choice: JS, C# and Python are currently supported). A new git repository will be initialised unless parent directory already a part of existing git repo.
orgName
is an identifier of your organisation, moduleName
is unique module identifier, a container name will have the same name (without orgName.
prefix)
NOTE: even though module names are only unique within an organisation, you cannot have 2 modules with the same moduleName
installed on a single device, e.g. acme.test-module
and evilcorp.test-module
cannot be installed together
Build a module
yarn build
The module image will be built. A working docker installation is required to build the module. The image will have registry.hostname/orgName.moduleName:version-platform
format. registry.hostname
, orgName.moduleName
and version
are taken from package.json
. platform
is taken from Dockerfile
suffix.
Publish the new version of a module
omg module publish [--overwrite]
The module image will be published in the module library. The module must be build beforehand. Registry credentials are taken from .env
file.
If no module exists in the library, it will be created automatically. If the version already exists in the library, the operation will fail. If old version must be overridden, a --overwrite
flag may be used.
NOTE: If you overwrite a module version that is already installed on a device, the device will not re-download it.
After the module version is published, it can be installed on the device via “Modules” tab of device settings page.
Directly deploy a module to a device
omg module deploy [--watch]
The module image will be rebuilt (a temporary version number will be used) and installed on the device. This feature is to be used for development purposes only.
NOTE: Before a module can be deployed to the device, it must be installed to the device via ‘Modules’ tab. That also means that for a new module you need to have at least one version published.
NOTE: When device settings are saved on device page in Grid Console, the device will revert to a module version specified in settings.
NOTE: Two modules cannot be deployed to a device at the same time. Imagine having a device with 2 modules: test.one v.1.0
and test.two v.1.0
If we deploy a development version of the fist one, the versions on the device will be test.one v.20210501.1122
and test.two v.1.0
. Now, if we deploy the second module, the first one will be reverted to the version in settings: test.one v.1.0
and test.two v.20210501.2233
.
If a --watch
option is specified, the module will be re-built and re-deployed after every file is changed in the repository.
List devices in my organisation
omg dev list <orgName> [--long]
Lists a devices you have access to. --long
option shows more information.
List modules installed on a device
omg dev modules <orgName>.<deviceName>
Shows module ids installed on the devices, their statuses and versions. If a module is about to be updated, two versions will be shown for it.
Show module logs
omg dev logs <orgName>.<deviceName> <moduleName> [--timestamps] [--follow]
Displays last 100 lines of logs for a given module. If --follow
option is specified, realtime logs will be streamed from the device.