From 262959d22ac50949b76956dab8fd71f4ed718db8 Mon Sep 17 00:00:00 2001 From: Joseph Pearson Date: Sat, 16 May 2020 19:22:58 -0400 Subject: [PATCH 1/2] added device-service per issue-41 Signed-off-by: Joseph Pearson --- .../separate-device/device-service.json | 51 ++++++++ hub/configs/separate-device/pattern.json | 35 +++++ hub/configs/separate-device/service.json | 121 ++++++++++++++++++ 3 files changed, 207 insertions(+) create mode 100644 hub/configs/separate-device/device-service.json create mode 100644 hub/configs/separate-device/pattern.json create mode 100644 hub/configs/separate-device/service.json diff --git a/hub/configs/separate-device/device-service.json b/hub/configs/separate-device/device-service.json new file mode 100644 index 0000000..6e22c48 --- /dev/null +++ b/hub/configs/separate-device/device-service.json @@ -0,0 +1,51 @@ +{ + "org": "${HZN_ORG_ID}", + "label": "edgex", + "description": "EdgeX Foundry device random service", + "documentation": "", + "url": "com.github.joewxboy.horizon.edgex.device", + "version": "1.0.2", + "arch": "amd64", + "public": true, + "sharable": "singleton", + "requiredServices": [ + { + "url": "com.github.joewxboy.horizon.edgex.core", + "org": "testorg", + "versionRange": "[1.0.2,INFINITY)", + "arch": "amd64" + } + ], + "userInput": [ + { "name": "EXPORT_DISTRO_CLIENT_HOST", "label": "", "type": "string", "defaultValue": "export-client" }, + { "name": "EXPORT_DISTRO_DATA_HOST", "label": "", "type": "string", "defaultValue": "edgex-core-data" }, + { "name": "EXPORT_DISTRO_CONSUL_HOST", "label": "", "type": "string", "defaultValue": "edgex-config-seed" }, + { "name": "EXPORT_DISTRO_MQTTS_CERT_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "EXPORT_DISTRO_MQTTS_KEY_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "LOG_LEVEL", "label": "logging level", "type": "string", "defaultValue": "info" }, + { "name": "LOGTO", "label": "where to log", "type": "string", "defaultValue": "" } + ], + "deployment": { + "services": { + "edgex-device-random": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/device-random-config.toml:/res/configuration.toml:ro", + "/root/res/device-random.yaml:/res/device-random.yaml:ro" + ], + "specific_ports": [ + { "HostPort": "49988/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-device-random-go:1.0.0", + "privileged": true + } + } + }, + "sync": true, + "tmpfs": { + "size": 8192000 + } + } diff --git a/hub/configs/separate-device/pattern.json b/hub/configs/separate-device/pattern.json new file mode 100644 index 0000000..db04b1c --- /dev/null +++ b/hub/configs/separate-device/pattern.json @@ -0,0 +1,35 @@ +{ + "name": "pattern-edgex-amd64-separate-device", + "label": "Edgex on IBM Edge Computing for Devices, on amd64.", + "description": "Pattern for Edgex on IBM Edge Computing for Devices, on amd64, with devices as a separate service.", + "services": [ + { + "serviceUrl": "com.github.joewxboy.horizon.edgex.core", + "serviceOrgid": "testorg", + "serviceArch": "amd64", + "serviceVersions": [ + { + "version": "1.0.2" + } + ] + } + ], + "userInput":[ + { + "serviceOrgId": "testorg", + "serviceUrl": "com.github.joewxboy.horizon.edgex.device", + "serviceArch": "amd64", + "serviceVersionRange": "[1.0.2,INFINITY)", + "inputs": [ + {"name":"EXPORT_DISTRO_CLIENT_HOST","value":"export-client"}, + {"name":"EXPORT_DISTRO_DATA_HOST","value":"edgex-core-data"}, + {"name":"EXPORT_DISTRO_CONSUL_HOST","value":"edgex-config-seed"}, + {"name":"EXPORT_DISTRO_MQTTS_CERT_FILE","value":"none"}, + {"name":"EXPORT_DISTRO_MQTTS_KEY_FILE","value":"none"}, + {"name":"LOG_LEVEL","value":"info"}, + {"name":"LOGTO","value":""} + ] + } + ] +} + diff --git a/hub/configs/separate-device/service.json b/hub/configs/separate-device/service.json new file mode 100644 index 0000000..7fb9d05 --- /dev/null +++ b/hub/configs/separate-device/service.json @@ -0,0 +1,121 @@ +{ + "org": "${HZN_ORG_ID}", + "label": "edgex", + "description": "EdgeX Foundry service without devices", + "documentation": "", + "url": "com.github.joewxboy.horizon.edgex.core", + "version": "1.0.2", + "arch": "amd64", + "public": true, + "sharable": "singleton", + "requiredServices": [], + "userInput": [ + { "name": "EXPORT_DISTRO_CLIENT_HOST", "label": "", "type": "string", "defaultValue": "export-client" }, + { "name": "EXPORT_DISTRO_DATA_HOST", "label": "", "type": "string", "defaultValue": "edgex-core-data" }, + { "name": "EXPORT_DISTRO_CONSUL_HOST", "label": "", "type": "string", "defaultValue": "edgex-config-seed" }, + { "name": "EXPORT_DISTRO_MQTTS_CERT_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "EXPORT_DISTRO_MQTTS_KEY_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "LOG_LEVEL", "label": "logging level", "type": "string", "defaultValue": "info" }, + { "name": "LOGTO", "label": "where to log", "type": "string", "defaultValue": "" } + ], + "deployment": { + "services": { + "edgex-files": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data" + ], + "image": "edgexfoundry/docker-edgex-volume:1.0.0", + "privileged": true + }, + "edgex-mongo": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data" + ], + "specific_ports": [ + { "HostPort": "27017/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-edgex-mongo:1.0.1", + "privileged": true + }, + "edgex-support-logging": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/logging-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48061/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-support-logging-go:1.0.1", + "privileged": true + }, + "edgex-core-metadata": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/metadata-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48081/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-metadata-go:1.0.1", + "privileged": true + }, + "edgex-core-data": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/data-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48080/tcp", "HostIP": "0.0.0.0" }, + { "HostPort": "5563/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-data-go:1.0.1", + "privileged": true + }, + "edgex-core-command": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/command-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48082/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-command-go:1.0.1", + "privileged": true + } + } + }, + "sync": true, + "tmpfs": { + "size": 8192000 + } + } From 6b8348b802a41d5afcd7328e55f9e95b216e3775 Mon Sep 17 00:00:00 2001 From: Joseph Pearson Date: Sun, 17 May 2020 18:08:58 -0400 Subject: [PATCH 2/2] added Signed-off-by: Joseph Pearson --- hub/05-view-device-data.md | 2 +- hub/06-separate-core-from-devices.md | 381 ++++++++++++++++++ hub/configs/core/horizon/.gitignore | 1 + .../core/horizon/dependencies/.gitignore | 1 + hub/configs/core/horizon/hzn.json | 8 + .../core/horizon/pattern-all-arches.json | 38 ++ hub/configs/core/horizon/pattern.json | 18 + .../core/horizon/service.definition.json | 117 ++++++ hub/configs/core/horizon/service.policy.json | 9 + hub/configs/core/horizon/userinput.json | 9 + hub/configs/device/horizon/.gitignore | 1 + .../device/horizon/dependencies/.gitignore | 1 + hub/configs/device/horizon/hzn.json | 8 + .../device/horizon/pattern-all-arches.json | 38 ++ hub/configs/device/horizon/pattern.json | 18 + .../device/horizon/service.definition.json | 47 +++ .../device/horizon/service.policy.json | 9 + hub/configs/device/horizon/userinput.json | 9 + .../separate-device/device-service.json | 51 --- hub/configs/separate-device/pattern.json | 35 -- hub/configs/separate-device/service.json | 121 ------ 21 files changed, 714 insertions(+), 208 deletions(-) create mode 100644 hub/06-separate-core-from-devices.md create mode 100644 hub/configs/core/horizon/.gitignore create mode 100644 hub/configs/core/horizon/dependencies/.gitignore create mode 100644 hub/configs/core/horizon/hzn.json create mode 100644 hub/configs/core/horizon/pattern-all-arches.json create mode 100644 hub/configs/core/horizon/pattern.json create mode 100644 hub/configs/core/horizon/service.definition.json create mode 100644 hub/configs/core/horizon/service.policy.json create mode 100644 hub/configs/core/horizon/userinput.json create mode 100644 hub/configs/device/horizon/.gitignore create mode 100644 hub/configs/device/horizon/dependencies/.gitignore create mode 100644 hub/configs/device/horizon/hzn.json create mode 100644 hub/configs/device/horizon/pattern-all-arches.json create mode 100644 hub/configs/device/horizon/pattern.json create mode 100644 hub/configs/device/horizon/service.definition.json create mode 100644 hub/configs/device/horizon/service.policy.json create mode 100644 hub/configs/device/horizon/userinput.json delete mode 100644 hub/configs/separate-device/device-service.json delete mode 100644 hub/configs/separate-device/pattern.json delete mode 100644 hub/configs/separate-device/service.json diff --git a/hub/05-view-device-data.md b/hub/05-view-device-data.md index 2283412..101b935 100644 --- a/hub/05-view-device-data.md +++ b/hub/05-view-device-data.md @@ -121,4 +121,4 @@ Potential ways forward include refactoring the example so that individual EXF mi # Next -[Add the SMA to the Service Definition](06-add-the-sma.md). +[Separate EdgeX Foundry Core from Devices](06-separate-core-from-devices.ms). diff --git a/hub/06-separate-core-from-devices.md b/hub/06-separate-core-from-devices.md new file mode 100644 index 0000000..e3a21f5 --- /dev/null +++ b/hub/06-separate-core-from-devices.md @@ -0,0 +1,381 @@ +# Separate EdgeX Foundry Core from Devices + +First, let's go to the `configs` folder and stub out the core and device services: + +``` bash +cd ~/open-horizon-integration/hub/configs +``` + +NOTE: this assumes that the git repo you started with was cloned into your home directory (`~/`). Please adjust accordingly. + +Then, let's create separate folders for the `core` and `device` services, and stub them out: + +``` bash +mkdir core && cd $_ +hzn dev service new +cd .. +mkdir devices && cd $_ +hzn dev service new +``` + +This will create a folder structure with the following files and subdirectories: + +``` +core +> horizon + > dependencies + .gitignore + .gitignore + hzn.json + pattern-all-arches.json + pattern.json + service.definition.json + service.policy.json + userinput.json +``` + +## Create the `core` Service + +Let's first fill out the `core` Service Definition file. Go to the appropriate folder and edit `service.definition.json`: + +``` bash +cd ../core/horizon +vi service.definition.json +``` + +Let's fill in the appropriate values: + +|| Property | Value +| description | EdgeX Foundry service without devices +| sharable | singleton +| userInput | ``` { "name": "EXPORT_DISTRO_CLIENT_HOST", "label": "", "type": "string", "defaultValue": "export-client" }, + { "name": "EXPORT_DISTRO_DATA_HOST", "label": "", "type": "string", "defaultValue": "edgex-core-data" }, + { "name": "EXPORT_DISTRO_CONSUL_HOST", "label": "", "type": "string", "defaultValue": "edgex-config-seed" }, + { "name": "EXPORT_DISTRO_MQTTS_CERT_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "EXPORT_DISTRO_MQTTS_KEY_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "LOG_LEVEL", "label": "logging level", "type": "string", "defaultValue": "info" }, + { "name": "LOGTO", "label": "where to log", "type": "string", "defaultValue": "." } +``` +| deployment > services | ``` + "edgex-files": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data" + ], + "image": "edgexfoundry/docker-edgex-volume:1.0.0", + "privileged": true + }, + "edgex-mongo": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data" + ], + "specific_ports": [ + { "HostPort": "27017/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-edgex-mongo:1.0.1", + "privileged": true + }, + "edgex-support-logging": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/logging-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48061/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-support-logging-go:1.0.1", + "privileged": true + }, + "edgex-core-metadata": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/metadata-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48081/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-metadata-go:1.0.1", + "privileged": true + }, + "edgex-core-data": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/data-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48080/tcp", "HostIP": "0.0.0.0" }, + { "HostPort": "5563/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-data-go:1.0.1", + "privileged": true + }, + "edgex-core-command": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/command-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48082/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-command-go:1.0.1", + "privileged": true + } +``` + +Then let's navigate back to the `core` subdirectory and validate the Service Definition file: + +``` bash +cd .. +export SERVICE_NAME="com.github.joewxboy.horizon.edgex.core" +export SERVICE_VERSION="1.0.2" +hzn dev service verify +``` + +If all goes well and there were no typos, you should see output similar to the following: + +``` +Service project open-horizon-integration/hub/configs/core/horizon verified. +``` + +Then let's start the service to confirm that it works before publishing to the exchange: + +``` bash +docker pull edgexfoundry/docker-edgex-volume:1.0.0 +docker pull edgexfoundry/docker-edgex-mongo:1.0.1 +docker pull edgexfoundry/docker-support-logging-go:1.0.1 +docker pull edgexfoundry/docker-core-metadata-go:1.0.1 +docker pull edgexfoundry/docker-core-data-go:1.0.1 +docker pull edgexfoundry/docker-core-command-go:1.0.1 + +docker volume create db-data +docker volume create log-data +docker volume create consul-data +docker volume create consul-config + +mkdir -p /var/run/edgex/logs +mkdir -p /var/run/edgex/data +mkdir -p /var/run/edgex/consul/data +mkdir -p /var/run/edgex/consul/config +mkdir -p /root/res +chmod -R a+rwx /var/run/edgex +chmod -R a+rwx /root/res +# copy the files from res to /root/res + +hzn dev service start +``` + +NOTE: If something goes wrong and you need to debug, try adding `-v` flag to the end of `hzn dev service start` to get more debugging information. + +NOTE: If you are running on OSX, you may need to substitute a different path for `/root/res`, in which case you should modify the bind paths in the Service Definition files to point to the actual location. + +Once you confirm that it runs properly, stop the service: + +``` bash +hzn dev service stop +``` + +## Publish the `core` Service + +Set your environment variables so you can connect to the exchange: + +NOTE: Replace x.x.x.x with the actual IP address of the machine running the Open Horizon Hub Services. + +``` bash +export HZN_EXCHANGE_URL=http://x.x.x.x:3090/v1 +export ORG_ID=testorg +export HZN_ORG_ID=testorg +export HZN_EXCHANGE_USER_AUTH=admin:adminpw +echo "export HZN_EXCHANGE_USER_AUTH='admin:adminpw'" >> ~/.bashrc +hzn exchange user list +``` + +You should get a response like this, if you can connect to the exchange: + +``` json +{ + "testorg/admin": { + "admin": true, + "email": "admin@testorg", + "lastUpdated": "2020-05-16T21:26:49.460Z[UTC]", + "password": "********", + "updatedBy": "root/root" + } +} +``` + +Next, generate an RSA key pair: + +``` bash +hzn key create -l 4096 testorg joe@everywhere.com +``` + +Then publish the `core` service to the exchange: + +``` bash +hzn exchange service publish --json-file=horizon/service.definition.json -P +``` + +Then verify with: + +``` bash +hzn exchange service list +``` + +## Create the `device` Service + +Then, let's change to the device service directory and edit the device Service Definition file: + +``` bash +cd ../device/horizon +vi service.definition.json +``` + +Set the following properties: + +|| Property | Value +| description | EdgeX Foundry device random service +| sharable | singleton +| requiredServices | ``` + { + "url": "com.github.joewxboy.horizon.edgex.core", + "org": "testorg", + "versionRange": "[1.0.2,INFINITY)", + "arch": "amd64" + } +``` +| userInput | ``` + { "name": "EXPORT_DISTRO_CLIENT_HOST", "label": "", "type": "string", "defaultValue": "export-client" }, + { "name": "EXPORT_DISTRO_DATA_HOST", "label": "", "type": "string", "defaultValue": "edgex-core-data" }, + { "name": "EXPORT_DISTRO_CONSUL_HOST", "label": "", "type": "string", "defaultValue": "edgex-config-seed" }, + { "name": "EXPORT_DISTRO_MQTTS_CERT_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "EXPORT_DISTRO_MQTTS_KEY_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "LOG_LEVEL", "label": "logging level", "type": "string", "defaultValue": "info" }, + { "name": "LOGTO", "label": "where to log", "type": "string", "defaultValue": "." } +``` +| deployment > services > $SERVICE_NAME | ``` + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/root/res/device-random-config.toml:/res/configuration.toml:ro", + "/root/res/device-random.yaml:/res/device-random.yaml:ro" + ], + "specific_ports": [ + { "HostPort": "49988/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-device-random-go:1.0.0", + "privileged": true +``` + +Then let's navigate back to the `device` subdirectory and validate the Service Definition file: + +``` bash +cd .. +export SERVICE_NAME="com.github.joewxboy.horizon.edgex.device" +export SERVICE_VERSION="1.0.2" +hzn dev service verify +``` + +If all goes well and there were no typos, you should see output similar to the following: + +``` +New dependency created: url: com.github.joewxboy.horizon.edgex.core, org: testorg, version: [1.0.2,INFINITY), arch: amd64 . +Service project /Users/josephpearson/dev/open-horizon-integration/hub/configs/device/horizon verified. +``` + +Then let's start the service to confirm that it works before publishing to the exchange: + +``` bash +docker pull edgexfoundry/docker-device-random-go:1.0.0 + +hzn dev service start +``` + +Once you confirm that it runs properly, stop the service: + +``` bash +hzn dev service stop +``` + +## Publish the `device` Service + +Publish the `device` service to the exchange: + +``` bash +hzn exchange service publish --json-file=horizon/service.definition.json -P +``` + +Then verify with: + +``` bash +hzn exchange service list +``` + +You should now see: + +``` json +[ + "testorg/com.github.joewxboy.horizon.edgex.device_1.0.2_amd64", + "testorg/com.github.joewxboy.horizon.edgex.core_1.0.2_amd64" +] +``` + +## Consume the Services with a Pattern + +You should be able to use the default `pattern.json` file in the `horizon` subdirectory. Publish that to the exchange: + +``` bash +hzn exchange pattern publish -f horizon/pattern.json +``` + +The exchange should respond with: + +``` +Creating pattern-com.github.joewxboy.horizon.edgex.device-amd64 in the exchange... +``` + +And then confirm that it's available: + +``` bash +hzn exchange pattern list +``` + +And you should see it: + +``` json +[ + "testorg/pattern-com.github.joewxboy.horizon.edgex.device-amd64" +] +``` + +## End diff --git a/hub/configs/core/horizon/.gitignore b/hub/configs/core/horizon/.gitignore new file mode 100644 index 0000000..db45d9d --- /dev/null +++ b/hub/configs/core/horizon/.gitignore @@ -0,0 +1 @@ +/.hzn.json.tmp.mk diff --git a/hub/configs/core/horizon/dependencies/.gitignore b/hub/configs/core/horizon/dependencies/.gitignore new file mode 100644 index 0000000..4a43ab9 --- /dev/null +++ b/hub/configs/core/horizon/dependencies/.gitignore @@ -0,0 +1 @@ +*.service.definition.json diff --git a/hub/configs/core/horizon/hzn.json b/hub/configs/core/horizon/hzn.json new file mode 100644 index 0000000..7a2f089 --- /dev/null +++ b/hub/configs/core/horizon/hzn.json @@ -0,0 +1,8 @@ +{ + "HZN_ORG_ID": "testorg", + "MetadataVars": { + "DOCKER_IMAGE_BASE": "", + "SERVICE_NAME": "", + "SERVICE_VERSION": "" + } +} \ No newline at end of file diff --git a/hub/configs/core/horizon/pattern-all-arches.json b/hub/configs/core/horizon/pattern-all-arches.json new file mode 100644 index 0000000..24447e7 --- /dev/null +++ b/hub/configs/core/horizon/pattern-all-arches.json @@ -0,0 +1,38 @@ +{ + "name": "pattern-$SERVICE_NAME", + "label": "Edge $SERVICE_NAME Service Pattern for all architectures", + "description": "Pattern for $SERVICE_NAME", + "public": false, + "services": [ + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "amd64", + "serviceVersions": [ + { + "version": "$SERVICE_VERSION" + } + ] + }, + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "arm", + "serviceVersions": [ + { + "version": "$SERVICE_VERSION" + } + ] + }, + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "arm64", + "serviceVersions": [ + { + "version": "$SERVICE_VERSION" + } + ] + } + ] +} \ No newline at end of file diff --git a/hub/configs/core/horizon/pattern.json b/hub/configs/core/horizon/pattern.json new file mode 100644 index 0000000..c36f13a --- /dev/null +++ b/hub/configs/core/horizon/pattern.json @@ -0,0 +1,18 @@ +{ + "name": "pattern-${SERVICE_NAME}-$ARCH", + "label": "Edge $SERVICE_NAME Service Pattern for $ARCH", + "description": "Pattern for $SERVICE_NAME for $ARCH", + "public": false, + "services": [ + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "$ARCH", + "serviceVersions": [ + { + "version": "$SERVICE_VERSION" + } + ] + } + ] +} \ No newline at end of file diff --git a/hub/configs/core/horizon/service.definition.json b/hub/configs/core/horizon/service.definition.json new file mode 100644 index 0000000..bb8a5d7 --- /dev/null +++ b/hub/configs/core/horizon/service.definition.json @@ -0,0 +1,117 @@ +{ + "org": "$HZN_ORG_ID", + "label": "$SERVICE_NAME for $ARCH", + "description": "EdgeX Foundry service without devices", + "public": true, + "documentation": "", + "url": "$SERVICE_NAME", + "version": "$SERVICE_VERSION", + "arch": "$ARCH", + "sharable": "singleton", + "requiredServices": [], + "userInput": [ + { "name": "EXPORT_DISTRO_CLIENT_HOST", "label": "", "type": "string", "defaultValue": "export-client" }, + { "name": "EXPORT_DISTRO_DATA_HOST", "label": "", "type": "string", "defaultValue": "edgex-core-data" }, + { "name": "EXPORT_DISTRO_CONSUL_HOST", "label": "", "type": "string", "defaultValue": "edgex-config-seed" }, + { "name": "EXPORT_DISTRO_MQTTS_CERT_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "EXPORT_DISTRO_MQTTS_KEY_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "LOG_LEVEL", "label": "logging level", "type": "string", "defaultValue": "info" }, + { "name": "LOGTO", "label": "where to log", "type": "string", "defaultValue": "." } + ], + "deployment": { + "services": { + "edgex-files": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data" + ], + "image": "edgexfoundry/docker-edgex-volume:1.0.0", + "privileged": true + }, + "edgex-mongo": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data" + ], + "specific_ports": [ + { "HostPort": "27017/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-edgex-mongo:1.0.1", + "privileged": true + }, + "edgex-support-logging": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/Users/josephpearson/dev/open-horizon-integration/hub/res/logging-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48061/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-support-logging-go:1.0.1", + "privileged": true + }, + "edgex-core-metadata": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/Users/josephpearson/dev/open-horizon-integration/hub/res/metadata-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48081/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-metadata-go:1.0.1", + "privileged": true + }, + "edgex-core-data": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/Users/josephpearson/dev/open-horizon-integration/hub/res/data-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48080/tcp", "HostIP": "0.0.0.0" }, + { "HostPort": "5563/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-data-go:1.0.1", + "privileged": true + }, + "edgex-core-command": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/Users/josephpearson/dev/open-horizon-integration/hub/res/command-config.toml:/res/docker/configuration.toml:ro" + ], + "command": [ + "--registry=false" + ], + "specific_ports": [ + { "HostPort": "48082/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-core-command-go:1.0.1", + "privileged": true + } + } + } +} \ No newline at end of file diff --git a/hub/configs/core/horizon/service.policy.json b/hub/configs/core/horizon/service.policy.json new file mode 100644 index 0000000..f7cdeaa --- /dev/null +++ b/hub/configs/core/horizon/service.policy.json @@ -0,0 +1,9 @@ +{ + "properties": [ + { + "name": "prop1", + "value": "value1" + } + ], + "constraints": [] +} \ No newline at end of file diff --git a/hub/configs/core/horizon/userinput.json b/hub/configs/core/horizon/userinput.json new file mode 100644 index 0000000..b8f6cb1 --- /dev/null +++ b/hub/configs/core/horizon/userinput.json @@ -0,0 +1,9 @@ +{ + "services": [ + { + "org": "$HZN_ORG_ID", + "url": "$SERVICE_NAME", + "variables": {} + } + ] +} \ No newline at end of file diff --git a/hub/configs/device/horizon/.gitignore b/hub/configs/device/horizon/.gitignore new file mode 100644 index 0000000..db45d9d --- /dev/null +++ b/hub/configs/device/horizon/.gitignore @@ -0,0 +1 @@ +/.hzn.json.tmp.mk diff --git a/hub/configs/device/horizon/dependencies/.gitignore b/hub/configs/device/horizon/dependencies/.gitignore new file mode 100644 index 0000000..4a43ab9 --- /dev/null +++ b/hub/configs/device/horizon/dependencies/.gitignore @@ -0,0 +1 @@ +*.service.definition.json diff --git a/hub/configs/device/horizon/hzn.json b/hub/configs/device/horizon/hzn.json new file mode 100644 index 0000000..7a2f089 --- /dev/null +++ b/hub/configs/device/horizon/hzn.json @@ -0,0 +1,8 @@ +{ + "HZN_ORG_ID": "testorg", + "MetadataVars": { + "DOCKER_IMAGE_BASE": "", + "SERVICE_NAME": "", + "SERVICE_VERSION": "" + } +} \ No newline at end of file diff --git a/hub/configs/device/horizon/pattern-all-arches.json b/hub/configs/device/horizon/pattern-all-arches.json new file mode 100644 index 0000000..24447e7 --- /dev/null +++ b/hub/configs/device/horizon/pattern-all-arches.json @@ -0,0 +1,38 @@ +{ + "name": "pattern-$SERVICE_NAME", + "label": "Edge $SERVICE_NAME Service Pattern for all architectures", + "description": "Pattern for $SERVICE_NAME", + "public": false, + "services": [ + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "amd64", + "serviceVersions": [ + { + "version": "$SERVICE_VERSION" + } + ] + }, + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "arm", + "serviceVersions": [ + { + "version": "$SERVICE_VERSION" + } + ] + }, + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "arm64", + "serviceVersions": [ + { + "version": "$SERVICE_VERSION" + } + ] + } + ] +} \ No newline at end of file diff --git a/hub/configs/device/horizon/pattern.json b/hub/configs/device/horizon/pattern.json new file mode 100644 index 0000000..c36f13a --- /dev/null +++ b/hub/configs/device/horizon/pattern.json @@ -0,0 +1,18 @@ +{ + "name": "pattern-${SERVICE_NAME}-$ARCH", + "label": "Edge $SERVICE_NAME Service Pattern for $ARCH", + "description": "Pattern for $SERVICE_NAME for $ARCH", + "public": false, + "services": [ + { + "serviceUrl": "$SERVICE_NAME", + "serviceOrgid": "$HZN_ORG_ID", + "serviceArch": "$ARCH", + "serviceVersions": [ + { + "version": "$SERVICE_VERSION" + } + ] + } + ] +} \ No newline at end of file diff --git a/hub/configs/device/horizon/service.definition.json b/hub/configs/device/horizon/service.definition.json new file mode 100644 index 0000000..18d0a06 --- /dev/null +++ b/hub/configs/device/horizon/service.definition.json @@ -0,0 +1,47 @@ +{ + "org": "$HZN_ORG_ID", + "label": "$SERVICE_NAME for $ARCH", + "description": "EdgeX Foundry device random service", + "public": true, + "documentation": "", + "url": "$SERVICE_NAME", + "version": "$SERVICE_VERSION", + "arch": "$ARCH", + "sharable": "singleton", + "requiredServices": [ + { + "url": "com.github.joewxboy.horizon.edgex.core", + "org": "testorg", + "versionRange": "[1.0.2,INFINITY)", + "arch": "amd64" + } + ], + "userInput": [ + { "name": "EXPORT_DISTRO_CLIENT_HOST", "label": "", "type": "string", "defaultValue": "export-client" }, + { "name": "EXPORT_DISTRO_DATA_HOST", "label": "", "type": "string", "defaultValue": "edgex-core-data" }, + { "name": "EXPORT_DISTRO_CONSUL_HOST", "label": "", "type": "string", "defaultValue": "edgex-config-seed" }, + { "name": "EXPORT_DISTRO_MQTTS_CERT_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "EXPORT_DISTRO_MQTTS_KEY_FILE", "label": "", "type": "string", "defaultValue": "none" }, + { "name": "LOG_LEVEL", "label": "logging level", "type": "string", "defaultValue": "info" }, + { "name": "LOGTO", "label": "where to log", "type": "string", "defaultValue": "." } + ], + "deployment": { + "services": { + "$SERVICE_NAME": { + "binds": [ + "db-data:/data/db", + "log-data:/edgex/logs:rw", + "consul-config:/consul/config", + "consul-data:/consul/data", + "/Users/josephpearson/dev/open-horizon-integration/hub/res/device-random-config.toml:/res/configuration.toml:ro", + "/Users/josephpearson/dev/open-horizon-integration/hub/res/device-random.yaml:/res/device-random.yaml:ro" + ], + "specific_ports": [ + { "HostPort": "49988/tcp", "HostIP": "0.0.0.0" } + ], + "image": "edgexfoundry/docker-device-random-go:1.0.0", + "privileged": true + } + } + } +} \ No newline at end of file diff --git a/hub/configs/device/horizon/service.policy.json b/hub/configs/device/horizon/service.policy.json new file mode 100644 index 0000000..f7cdeaa --- /dev/null +++ b/hub/configs/device/horizon/service.policy.json @@ -0,0 +1,9 @@ +{ + "properties": [ + { + "name": "prop1", + "value": "value1" + } + ], + "constraints": [] +} \ No newline at end of file diff --git a/hub/configs/device/horizon/userinput.json b/hub/configs/device/horizon/userinput.json new file mode 100644 index 0000000..b8f6cb1 --- /dev/null +++ b/hub/configs/device/horizon/userinput.json @@ -0,0 +1,9 @@ +{ + "services": [ + { + "org": "$HZN_ORG_ID", + "url": "$SERVICE_NAME", + "variables": {} + } + ] +} \ No newline at end of file diff --git a/hub/configs/separate-device/device-service.json b/hub/configs/separate-device/device-service.json deleted file mode 100644 index 6e22c48..0000000 --- a/hub/configs/separate-device/device-service.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "org": "${HZN_ORG_ID}", - "label": "edgex", - "description": "EdgeX Foundry device random service", - "documentation": "", - "url": "com.github.joewxboy.horizon.edgex.device", - "version": "1.0.2", - "arch": "amd64", - "public": true, - "sharable": "singleton", - "requiredServices": [ - { - "url": "com.github.joewxboy.horizon.edgex.core", - "org": "testorg", - "versionRange": "[1.0.2,INFINITY)", - "arch": "amd64" - } - ], - "userInput": [ - { "name": "EXPORT_DISTRO_CLIENT_HOST", "label": "", "type": "string", "defaultValue": "export-client" }, - { "name": "EXPORT_DISTRO_DATA_HOST", "label": "", "type": "string", "defaultValue": "edgex-core-data" }, - { "name": "EXPORT_DISTRO_CONSUL_HOST", "label": "", "type": "string", "defaultValue": "edgex-config-seed" }, - { "name": "EXPORT_DISTRO_MQTTS_CERT_FILE", "label": "", "type": "string", "defaultValue": "none" }, - { "name": "EXPORT_DISTRO_MQTTS_KEY_FILE", "label": "", "type": "string", "defaultValue": "none" }, - { "name": "LOG_LEVEL", "label": "logging level", "type": "string", "defaultValue": "info" }, - { "name": "LOGTO", "label": "where to log", "type": "string", "defaultValue": "" } - ], - "deployment": { - "services": { - "edgex-device-random": { - "binds": [ - "db-data:/data/db", - "log-data:/edgex/logs:rw", - "consul-config:/consul/config", - "consul-data:/consul/data", - "/root/res/device-random-config.toml:/res/configuration.toml:ro", - "/root/res/device-random.yaml:/res/device-random.yaml:ro" - ], - "specific_ports": [ - { "HostPort": "49988/tcp", "HostIP": "0.0.0.0" } - ], - "image": "edgexfoundry/docker-device-random-go:1.0.0", - "privileged": true - } - } - }, - "sync": true, - "tmpfs": { - "size": 8192000 - } - } diff --git a/hub/configs/separate-device/pattern.json b/hub/configs/separate-device/pattern.json deleted file mode 100644 index db04b1c..0000000 --- a/hub/configs/separate-device/pattern.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "pattern-edgex-amd64-separate-device", - "label": "Edgex on IBM Edge Computing for Devices, on amd64.", - "description": "Pattern for Edgex on IBM Edge Computing for Devices, on amd64, with devices as a separate service.", - "services": [ - { - "serviceUrl": "com.github.joewxboy.horizon.edgex.core", - "serviceOrgid": "testorg", - "serviceArch": "amd64", - "serviceVersions": [ - { - "version": "1.0.2" - } - ] - } - ], - "userInput":[ - { - "serviceOrgId": "testorg", - "serviceUrl": "com.github.joewxboy.horizon.edgex.device", - "serviceArch": "amd64", - "serviceVersionRange": "[1.0.2,INFINITY)", - "inputs": [ - {"name":"EXPORT_DISTRO_CLIENT_HOST","value":"export-client"}, - {"name":"EXPORT_DISTRO_DATA_HOST","value":"edgex-core-data"}, - {"name":"EXPORT_DISTRO_CONSUL_HOST","value":"edgex-config-seed"}, - {"name":"EXPORT_DISTRO_MQTTS_CERT_FILE","value":"none"}, - {"name":"EXPORT_DISTRO_MQTTS_KEY_FILE","value":"none"}, - {"name":"LOG_LEVEL","value":"info"}, - {"name":"LOGTO","value":""} - ] - } - ] -} - diff --git a/hub/configs/separate-device/service.json b/hub/configs/separate-device/service.json deleted file mode 100644 index 7fb9d05..0000000 --- a/hub/configs/separate-device/service.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "org": "${HZN_ORG_ID}", - "label": "edgex", - "description": "EdgeX Foundry service without devices", - "documentation": "", - "url": "com.github.joewxboy.horizon.edgex.core", - "version": "1.0.2", - "arch": "amd64", - "public": true, - "sharable": "singleton", - "requiredServices": [], - "userInput": [ - { "name": "EXPORT_DISTRO_CLIENT_HOST", "label": "", "type": "string", "defaultValue": "export-client" }, - { "name": "EXPORT_DISTRO_DATA_HOST", "label": "", "type": "string", "defaultValue": "edgex-core-data" }, - { "name": "EXPORT_DISTRO_CONSUL_HOST", "label": "", "type": "string", "defaultValue": "edgex-config-seed" }, - { "name": "EXPORT_DISTRO_MQTTS_CERT_FILE", "label": "", "type": "string", "defaultValue": "none" }, - { "name": "EXPORT_DISTRO_MQTTS_KEY_FILE", "label": "", "type": "string", "defaultValue": "none" }, - { "name": "LOG_LEVEL", "label": "logging level", "type": "string", "defaultValue": "info" }, - { "name": "LOGTO", "label": "where to log", "type": "string", "defaultValue": "" } - ], - "deployment": { - "services": { - "edgex-files": { - "binds": [ - "db-data:/data/db", - "log-data:/edgex/logs:rw", - "consul-config:/consul/config", - "consul-data:/consul/data" - ], - "image": "edgexfoundry/docker-edgex-volume:1.0.0", - "privileged": true - }, - "edgex-mongo": { - "binds": [ - "db-data:/data/db", - "log-data:/edgex/logs:rw", - "consul-config:/consul/config", - "consul-data:/consul/data" - ], - "specific_ports": [ - { "HostPort": "27017/tcp", "HostIP": "0.0.0.0" } - ], - "image": "edgexfoundry/docker-edgex-mongo:1.0.1", - "privileged": true - }, - "edgex-support-logging": { - "binds": [ - "db-data:/data/db", - "log-data:/edgex/logs:rw", - "consul-config:/consul/config", - "consul-data:/consul/data", - "/root/res/logging-config.toml:/res/docker/configuration.toml:ro" - ], - "command": [ - "--registry=false" - ], - "specific_ports": [ - { "HostPort": "48061/tcp", "HostIP": "0.0.0.0" } - ], - "image": "edgexfoundry/docker-support-logging-go:1.0.1", - "privileged": true - }, - "edgex-core-metadata": { - "binds": [ - "db-data:/data/db", - "log-data:/edgex/logs:rw", - "consul-config:/consul/config", - "consul-data:/consul/data", - "/root/res/metadata-config.toml:/res/docker/configuration.toml:ro" - ], - "command": [ - "--registry=false" - ], - "specific_ports": [ - { "HostPort": "48081/tcp", "HostIP": "0.0.0.0" } - ], - "image": "edgexfoundry/docker-core-metadata-go:1.0.1", - "privileged": true - }, - "edgex-core-data": { - "binds": [ - "db-data:/data/db", - "log-data:/edgex/logs:rw", - "consul-config:/consul/config", - "consul-data:/consul/data", - "/root/res/data-config.toml:/res/docker/configuration.toml:ro" - ], - "command": [ - "--registry=false" - ], - "specific_ports": [ - { "HostPort": "48080/tcp", "HostIP": "0.0.0.0" }, - { "HostPort": "5563/tcp", "HostIP": "0.0.0.0" } - ], - "image": "edgexfoundry/docker-core-data-go:1.0.1", - "privileged": true - }, - "edgex-core-command": { - "binds": [ - "db-data:/data/db", - "log-data:/edgex/logs:rw", - "consul-config:/consul/config", - "consul-data:/consul/data", - "/root/res/command-config.toml:/res/docker/configuration.toml:ro" - ], - "command": [ - "--registry=false" - ], - "specific_ports": [ - { "HostPort": "48082/tcp", "HostIP": "0.0.0.0" } - ], - "image": "edgexfoundry/docker-core-command-go:1.0.1", - "privileged": true - } - } - }, - "sync": true, - "tmpfs": { - "size": 8192000 - } - }