Skip to content

Latest commit

 

History

History
189 lines (154 loc) · 6.93 KB

README.md

File metadata and controls

189 lines (154 loc) · 6.93 KB

hzncli - container with Horizon CLI (Ubuntu)

This container may be run locally using Docker, pushed to a Docker registry, and published to any Open Horizon exchange.

Status

Supports amd64 Architecture Docker Pulls

Supports arm Architecture Docker Pulls

Supports arm64 Architecture Docker Pulls

Service discovery

Service variables

  • LOG_LEVEL - specify level of logging; default info; options include (debug and none)
  • DEBUG - force debug settings; boolean; default false

How To Use

Specify dcmartin/hzn-ubuntu:0.0.1 in service build.json

Building this continer

Copy this repository, change to the hzn-ubuntu directory, then use the make command; see below:

% mkdir ~/gitdir
% cd ~/gitdir
% git clone http://github.com/dcmartin/open-horizon
% cd open-horizon/hzn-ubuntu
% make
..
{
  "hzncli": {
    "nodes": null
  },
  "date": 1554314895,
  "hzn": {
    "agreementid": "",
    "arch": "",
    "cpus": 0,
    "device_id": "",
    "exchange_url": "http://exchange:3090/v1",
    "host_ips": [
      ""
    ],
    "organization": "",
    "ram": 0,
    "pattern": null
  },
  "config": {
    "log_level": "info",
    "debug": false,
    "period": "120",
    "services": null
  },
  "service": {
    "label": "hzncli",
    "version": "0.0.3"
  }
}

⛑ Service test

To test completely, the service requires instantiation on the development host; use the following commands to set the API key and organizational identifier, then start the service:

cd open-horizon/hzncli/
jq '.apiKey' ../apiKey.json > HZN_EXCHANGE_APIKEY
echo '"'${HZN_ORG_ID}'"' > HZN_ORG_ID
make service-start

Then a test of the service is performed using:

make test

The output of the test:

>>> MAKE -- 11:15:37 -- testing container: hzncli; tag: dcmartin/amd64_com.github.dcmartin.open-horizon.hzncli:0.0.3
./test.sh "dcmartin/amd64_com.github.dcmartin.open-horizon.hzncli:0.0.3"
--- INFO -- ./test.sh 55960 -- No host specified; assuming 127.0.0.1
+++ WARN ./test.sh 55960 -- No port specified; assuming port 80
+++ WARN ./test.sh 55960 -- No protocol specified; assuming http
--- INFO -- ./test.sh 55960 -- Testing hzncli in container tagged: dcmartin/amd64_com.github.dcmartin.open-horizon.hzncli:0.0.3 at Wed Apr 3 11:15:37 PDT 2019
{"hzncli":{"nodes":"null"},"date":"number","hzn":{"agreementid":"string","arch":"string","cpus":"number","device_id":"string","exchange_url":"string","host_ips":["string","string","string","string"],"organization":"string","ram":"number","pattern":"null"},"config":{"log_level":"string","debug":"boolean","period":"string","services":"null"},"service":{"label":"string","version":"string"}}
!!! SUCCESS -- ./test.sh 55960 -- test /Volumes/dcmartin/GIT/master/open-horizon/hzncli/test-hzncli.sh returned true
true

The resulting status JSON file may also be inspected; it will be named (or something similar):

test.amd64_com.github.dcmartin.open-horizon.hzncli:0.0.3.json

Example hzncli status

{
  "hzncli": {
    "nodes": null
  },
  "date": 1554315330,
  "hzn": {
    "agreementid": "1adcde3cb4a1609eee846b3cc07fed0ad60cbc43e5cbc653dbc41378922503dd",
    "arch": "amd64",
    "cpus": 1,
    "device_id": "davidsimac.local",
    "exchange_url": "http://exchange:3090/v1",
    "host_ips": [
      "127.0.0.1",
      "192.168.1.26",
      "192.168.1.27",
      "9.80.109.129"
    ],
    "organization": "[email protected]",
    "ram": 1024,
    "pattern": null
  },
  "config": {
    "log_level": "info",
    "debug": false,
    "period": "120",
    "services": null
  },
  "service": {
    "label": "hzncli",
    "version": "0.0.3"
  }
}

Changelog & Releases

Releases are based on Semantic Versioning, and use the format of MAJOR.MINOR.PATCH. In a nutshell, the version will be incremented based on the following:

  • MAJOR: Incompatible or major changes.
  • MINOR: Backwards-compatible new features and enhancements.
  • PATCH: Backwards-compatible bugfixes and package updates.

Authors & contributors

David C Martin ([email protected])