Giter VIP home page Giter VIP logo

service-anylog's Introduction

EdgeLake Service for OpenHorizon

EdgeLake is a decentralized network to manage IoT data. Nodes in the network are compute instances that execute the EdgeLake Software. Joining a network requires the following steps:

  1. Install the EdgeLake Software on one or more computer instances.
  2. Configure each installed node (compute instance) such that:
    1. The node joins an exiting network (or creates a new network).
    2. The node offers data management and monitoring services.

Table of Content:

General Configuration of Network

A basic network setup consists of a master node, 2 or more operator nodes and a query node - as shown in the image below. These nodes can be deployed either on the same physical machine, or unique machines.

Demo Diagram

Usage

The make command allows deploying an EdgeLake node based on a user-define node type (Master, Operator or Query).

All Makefile targets

  • default - shows help for both OpenHorizon and docker-compose deployment

  • build - Pull the docker image

  • help-docker - Show this help message

  • help-open-horizon - Show this help message

  • up - Start the containers

  • attach - Attach to EdgeLake instance

  • test - Using cURL validate node is running

  • exec - Attach to shell interface for container

  • down - Stop and remove the containers

  • logs - View logs of the containers

  • clean - Clean up volumes and network

  • publish-service - Publish service to OpenHorizon

  • remove-service - Remove service from OpenHorizon

  • publish-service-policy - Publish service policy to OpenHorizon

  • remove-service-policy - Remove service policy from OpenHorizon

  • publish-deployment-policy - Publish deployment policy to OpenHorizon

  • remove-deployment-policy - Remove deployment policy from OpenHorizon

  • agent-run - Start service via OpenHorizon

  • agent-stop - Stop service via OpenHorizon

  • deploy-check - Check status of machine against OpenHorizon

Examples

Docker-based Deployment:

# deploy container 
make up EDGELAKE_TYPE=[NODE_TYPE]

# attach to container (ctrl-d to detach) 
make attach EDGELAKE_TYPE=[NODE_TYPE]

# bring down container
make down EDGELAKE_TYPE=[NODE_TYPE]

# clean container from system
make clean EDGELAKE_TYPE=[NODE_TYPE]

OpenHorizon-based Deployment

# Publish Service 
make publish-service EDGELAKE_TYPE=[node_type]

# Publish Service Policy 
make publish-service-policy EDGELAKE_TYPE=[node_type]

# Publish Deployment Policy 
make publish-deployment-policy EDGELAKE_TYPE=[node_type]

# Start container (deploy agent) 
make agent-run EDGELAKE_TYPE=[node_type]

# Unregister Node / takedown container 
make agent-stop EDGELAKE_TYPE=[node_type]

Review Deploy EdgeLake for farther details and specific examples - Docker-based and OpenHorizon-Based

service-anylog's People

Watchers

Joe Pearson avatar Ben Courliss avatar Bruce Potter avatar Ori Shadmon avatar

Forkers

joewxboy oshadmon

service-anylog's Issues

Failure to create a new token during install of OpenHorzion

I attempted to deploy a second EdgeLake instance on a different machine, however, learned the hard way that when the HZN_DEVICE_ID name on the second node is the same as the first, the the first EdgeLake instances goes down.

When trying to us a different HZN_DEVICE_ID, I get invalid-input error (directions shown below).

Steps:

  1. Update hzn related information in profile (Ubuntu bashrc)
export HZN_ORG_ID=alog
# export HZN_DEVICE_TOKEN= # specify a string value for a token
export HZN_DEVICE_ID=edgelake-demo
...
  1. Attempt to install using hello world
curl -sSL https://raw.githubusercontent.com/open-horizon/anax/v2.30/agent-install/agent-install.sh | bash -s -- -i anax: -c css: -p IBM/pattern-ibm.helloworld -w '*' -T 120 

Expect: Success
Actual: failed to create node with new Device ID

Node alog/edgelake-demo does not exist in the Exchange with the specified token, creating/updating it...
Error: bad HTTP code 400 from PUT http://132.177.125.232:3090/v1/orgs/alog/nodes/edgelake-demo?noheartbeat=true: invalid-input, Unrecognized field "isNamespaceScoped" (class com.horizon.exchangeapi.PutNodesRequest), not marked as ignorable (12 known properties: "pattern", "softwareVersions", "jsonFormats", "msgEndPoint", "token", "name", "nodeType", "userInput", "registeredServices", "heartbeatIntervals", "publicKey", "arch"])
 at [Source: (String)"{"token":"goYck5og-VccN7uRhIqPTLb18lVtGFN0_UaAYT9I2AfQhsb4OI1in7vk8aTeFhcsGqHj0XKEwrh75TYUKGV05yJ0","name":"edgex-demo","nodeType":"device","isNamespaceScoped":false,"pattern":"","registeredServices":null,"msgEndPoint":"","softwareVersions":{},"publicKey":"","arch":"amd64","userInput":null}"; line: 1, column: 292] (through reference chain: com.horizon.exchangeapi.PutNodesRequest["isNamespaceScoped"])

`agent-run` behavior fails to execute anything

Commit: os-dev branch in oshadmon/service-anylog fork commit # d374ab8

Steps:

  1. connect to the enterprise version for OpenHorizon
  • export params
  • install agent / start hello-world
  • Unregister
  1. Clone EdgeLake service
git clone -b os-dev https://github.com/oshadmon/service-anylog service-edgelake
  1. Create Service and Service-Policy
make publish-service EDGELAKE_TYPE=master
make publish-service-policy EDGELAKE_TYPE=master
  1. Create Deployment Policy
make publish-deployment-policy EDGELAKE_TYPE=master
  1. Start Agent
make agent-run EDGELAKE_TYPE=master

Expect: Success
Actual: Fails – On the OpenHorizon Web Application it looks like all the policies are there, and the image did download. However, deployment isn’t starting

root@anylog-openhorizon-test:~/service-edgelake# hzn agreement list 
[]

root@anylog-openhorizon-test:~/service-edgelake# docker image ls 
REPOSITORY                         TAG       IMAGE ID       CREATED        SIZE
anylogco/edgelake                  latest    ddb4eac2c953   37 hours ago   767MB
openhorizon/ibm.helloworld_amd64   <none>    472029755049   3 years ago    5.62MB

root@anylog-openhorizon-test:~/service-edgelake# hzn eventlog list 
  "2024-03-27 16:24:08:   Start node configuration/registration for node anylog-openhorizon-test.",
  "2024-03-27 16:24:09:   Complete node configuration/registration for node anylog-openhorizon-test."

Note: @t-fine and @joewxboy should have a copy the full documentation in their email

single service on multiple machines issue

brach os-dev

Steps:

  1. On Machine A start master node
make publish-service EDGELAKE_TYPE=master
make publish-deployment-policy EDGELAKE_TYPE=master
make agent-run EDGELAKE_TYPE=master
  1. On Machine B start operator node
make publish-service EDGELAKE_TYPE=operator
make publish-deployment-policy EDGELAKE_TYPE=operator
make agent-run EDGELAKE_TYPE=operator

Expect: Success
Actual: Master node drops when operator node gets deployed
Notes:

  • make sure to update LEDGER_CONN value in deployment.policy.XXX.json
  • we can have unique service d definition files, however ideally it'd be 1 file and have users updaate the deployment.node.json files

pattern-based deployment doesn't connect to agent when looking at `hzn agreement list`

OpenHorzon Version: v2.30.0-1476_amd64
Machine: Ubuntu 22.04 LTS (jammy) on amd64

Prepare Machine:

  1. Add params to ~/.bashrc & execute ~/.bashrc & execute
export HZN_ORG_ID=alog
# export HZN_DEVICE_TOKEN= # specify a string value for a token
export HZN_DEVICE_ID=alog-edgelake-node 
export HZN_EXCHANGE_USER_AUTH=
export HZN_EXCHANGE_URL=http://132.177.125.232:3090/v1
export HZN_FSS_CSSURL=http://132.177.125.232:9443/
export HZN_AGBOT_URL=http://132.177.125.232:3111/
export HZN_SDO_SVC_URL=http://132.177.125.232:9008/api
source ~/.bashrc
  1. create agent-install.cfg
HZN_EXCHANGE_URL=http://132.177.125.232:3090/v1
HZN_FSS_CSSURL=http://132.177.125.232:9443/
HZN_AGBOT_URL=http://132.177.125.232:3111/
HZN_SDO_SVC_URL=http://132.177.125.232:9008/api
HZN_FDO_SVC_URL=http://132.177.125.232:9008/api 
  1. Install Agent - Timeouts, however service does get installed
    Look at HelloWorld Issue for details
curl -sSL https://github.com/open-horizon/anax/releases/latest/download/agent-install.sh | bash -s -- -i anax: -k ./agent-install.cfg -c css: -p IBM/pattern-ibm.helloworld -w '*' -T 120
  1. Install make and clone repo
sudo apt-get -y install make 
git clone https://github.com/open-horizon-services/service-anylog/
  1. Unregister node
hzn unregister -f

Deploy EdgeLake: The following steps are found in Deploy via OpenHorizon Pattern

  1. cd into service-anylog

  2. Publish service

make publish-service EDGELAKE_TYPE=master 

Expect / Actual: Success

  1. Publish service policy
make publish-service-policy EDGELAKE_TYPE=master 

Expect / Actual: Success

  1. Publish deployment policy
make publish-deployment-policy EDGELAKE_TYPE=master 

Expect / Actual: Success

  1. agent-run
make agent-run EDGELAKE_TYPE=master 

Expect: Success
Actual: Everything looks correct, but nothing is happening as part of the agreement list - waited for over an hour

root@alog-edgelake-node:~/service-anylog# make agent-run EDGELAKE_TYPE=master 
================
REGISTERING NODE
================
Note: No properties and constraints are specified under 'deployment' attribute in the node policy file hzn/node.policy.master.json. The top level properties and constraints will be used.
Horizon Exchange base URL: http://132.177.125.232:3090/v1
Using node ID 'alog-edgelake-node' from the Horizon agent
Generated random node token
Updating node token...
Will proceed with the given node policy.
Updating the node policy...
Initializing the Horizon node with node type 'device'...
Note: no input file was specified. This is only valid if none of the services need variables set.
However, if there is 'userInput' specified in the node already in the Exchange, the userInput will be used.
Changing Horizon state to configured to register this node with Horizon...
Horizon node is registered. Workload agreement negotiation should begin shortly. Run 'hzn agreement list' to view.

root@alog-edgelake-node:~/service-anylog# hzn agreement list
[]

policy-based deployment fails with error: `Registration failed because service config for version 1.0.0 of alog/edgelake is missing`

OpenHorzon Version: v2.30.0-1476_amd64
Machine: Ubuntu 22.04 LTS (jammy) on amd64
Extends On: HelloWorld Timesout when using agent-install.sh

Steps:

  1. Copy content (including Makefile) from HelloWorld into EdgeLake & update content to match EdgeLake - hzn-hello

    • In Makefile, change Docker Hub and Image params
    • In service.json update file to include EdgeLake related userInput values
  2. Register service and pattern

make publish-service
make publish-pattern

Expect : Success
Actual: Sucess

  1. run agent
make agent-run

Expect: Success
Actual: Registration failed because service config for version 1.0.0 of alog/edgelake is missing
Reason: I believe there’s a confusion between the Docker Hub ID (anylogco) and OpenHorizon user (alog).

The node is not registered.
Horizon Exchange base URL: http://132.177.125.232:3090/v1
Using node ID 'alog-edgelake-node' from the Horizon agent
Generated random node token
Updating node token...
Will proceed with the given pattern alog/edglake-service.
Initializing the Horizon node with node type 'device'...
Note: no input file was specified. This is only valid if none of the services need variables set.
However, if there is 'userInput' specified in the node already in the Exchange, the userInput will be used.
Changing Horizon state to configured to register this node with Horizon...
Error setting node state to configured: Registration failed because service config for version 1.0.0 of alog/edgelake is missing.. Please create an input file, define variables for service alog/edgelake. Run 'hzn unregister' and then 'hzn register...' again with the -f flag to specify the input file.
Critical error encountered in registration. Attempting to undo registration steps to leave node in the unregistered state.

Waiting for Horizon node unregister to complete: Timeout in 885 seconds ...

Waiting for agent service to restart and checking the node configuration state...
Error: Registration failed. Node successfully returned to unregistered state.

HelloWorld Timesout when using agent-install.sh

OpenHorzon Version: v2.30.0-1476_amd64
Machine: Ubuntu 22.04 LTS (jammy) on amd64

Steps:

  1. Expose params
export HZN_ORG_ID=alog
# export HZN_DEVICE_TOKEN= # specify a string value for a token
export HZN_DEVICE_ID=alog-edgelake-node 
export HZN_EXCHANGE_USER_AUTH=XXXX
export HZN_EXCHANGE_URL=http://132.177.125.232:3090/v1
export HZN_FSS_CSSURL=http://132.177.125.232:9443/
export HZN_AGBOT_URL=http://132.177.125.232:3111/
export HZN_SDO_SVC_URL=http://132.177.125.232:9008/api
  1. Install OpenHorizon debian

  2. Create agent-install.cfg

HZN_EXCHANGE_URL=http://132.177.125.232:3090/v1
HZN_FSS_CSSURL=http://132.177.125.232:9443/
HZN_AGBOT_URL=http://132.177.125.232:3111
HZN_SDO_SVC_URL=http://132.177.125.232:9008/api
HZN_FDO_SVC_URL=http://132.177.125.232:9008/api
  1. Download agent-install.sh - Note I've tried multiple version of agent-install.sh

  2. Attempt to install IBM/pattern-ibm.helloworld running

  • Option A: bash ./agent-install.sh -i . -p IBM/pattern-ibm.helloworld -w '*' -T 120
  • Option B: bash ./agent-install.sh -k ./agent-install.cfg -i . -p

Expect: Success
Actual: Timeout error – it doesn’t even look like hello world downloaded to my machine
Note: I then installed using pattern-based policy for web-helloworld-python and that worked like a charm

IBM/pattern-ibm.helloworld -w '*' -T 120

Status of the services you are watching:
        IBM/ibm.helloworld      Progress so far: no agreements formed yet
Timeout waiting for some services to successfully start. Analyzing possible reasons for the timeout...
The following services are not deployed to the node, continuing analysis:
        IBM/ibm.helloworld

Currently, there are no active agreements on this node.

Currently, there are no errors recorded in the node's event log.
Using the 'hzn deploycheck all -p' command to verify that node, service configuration and pattern are compatible.
Command output:
Neither node id nor node policy is specified. Getting node policy from the local node.
Neither node id nor node user input file is specified. Getting node user input from the local node.
{
  "compatible": true,
  "reason": {
    "IBM/ibm.helloworld_1.0.0_amd64": "Compatible"
  }
}

Analysis complete.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.