/open-horizon

Open Horizon Setup & Applications

Primary LanguageShellApache License 2.0Apache-2.0

⛰ Open Horizon example services and patterns

This repository contains a set of examples to demonstrate a CI/CD process for services and patterns.

Please see the "hello world" example for an introduction to developing for Open Horizon

Build Status Coverage Status

Supports amd64 Architecture Supports aarch64 Architecture Supports armhf Architecture

1. Introduction

These services and patterns are built and pushed to designated Docker registry & namespace as well as Open Horizon exchange and organization. The default build configuration is:

  • HZN_EXCHANGE_URL defaults to https://alpha.edge-fabric.com/v1
  • HZN_ORG_ID is unspecified (e.g. dcmartin@us.ibm.com)
  • DOCKER_NAMESPACE is unspecified (e.g. dcmartin)
  • DOCKER_REGISTRY is unset and defaults to docker.io

This repository works best on a  macOS computer. However, macOS need some additional software install the HomeBrew package manager and install the necessary software:

% brew install gettext
% cd /usr/local/bin && ln -s ../Cellar/gettext/0.19.8.1/bin/envsubst .

1.1 Variables

The HZN_ORG_ID and DOCKER_NAMESPACE should be specified appropriately prior to any build; substitute values appropriately, for example:

% export HZN_ORG_ID="dcmartin@us.ibm.com"
% export DOCKER_NAMESPACE="dcmartin"

To make those environment variables persistent, copy them into files with the same names:

% echo "${HZN_ORG_ID}" > HZN_ORG_ID
% echo "${DOCKER_NAMESPACE}" > DOCKER_NAMESPACE

An IBM Cloud Platform API key is required to publish any service or pattern; please refer to the IBM IAM service to download a JSON API key file. Then copy that file into the top-level directory of the forked or cloned repository; for example:

% cp ~/Downloads/apiKey.json ~/gitdir/open-horizon/

The API key will be automatically extracted and saved in a local APIKEY file for use in the build process.

1.2 Dependencies

Docker provides for build dependencies through the FROM directive in the Dockerfile; most services depend on the base service containers for base-ubuntu or base-alpine.

Build all services and containers from the top-level using the following command:

% make service-build

2. Services & Patterns

Services are defined within a directory hierarchy of this repository. All services in this repository share a common design.

Patterns include:

  • yolo2msghub - Pattern of yolo2msghub with yolo,hal,wan, and cpu
  • motion2mqtt - Pattern of motion2mqtt,yolo4motion and mqtt2kafka with mqtt,hal,wan, and cpu

Services include:

  • cpu - provide CPU usage as percentage (0-100)
  • wan - provide Wide-Area-Network information
  • hal - provide Hardware-Abstraction-Layer information
  • yolo - recognize entities from USB camera
  • mqtt - MQTT message broker service
  • hzncli - service container with hzn command-line-interface installed
  • herald - multi-cast data received from other heralds on local-area-network
  • yolo2msghub - transmit yolo, hal, cpu, and wan information to Kafka
  • motion2mqtt - transmit motion detected images to MQTT
  • yolo4motion - subscribe to MQTT topics from motion2mqtt, recognize entities, and publish results
  • mqtt2kafka - relay MQTT traffic to Kafka
  • fft - Perform FFT analysis on sound
  • noize - Capture noise from silence
  • mqtt2mqtt - Relay MQTT traffic
  • record - Record audio from a microphone
  • hznsetup - Setup new devices as nodes

There are also base containers that are used by the other services:

Finally, there are services specialized for the nVidia Jetson computers:

Further Information

See SERVICE.md and PATTERN.md for more information on building services and patterns. Refer to the following for more information on getting started and installation.

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 (github@dcmartin.com)

Language files blank comment code
Markdown 49 1986 0 12122
JSON 130 1 0 11538
Bourne Shell 105 1144 1335 7096
Dockerfile 26 311 191 1182
Bourne Again Shell 5 83 103 441
make 2 96 66 304
Python 6 84 108 293
YAML 1 0 39 148
awk 1 4 0 16
Expect 1 0 0 5
-------- -------- -------- -------- --------
SUM: 326 3709 1842 33145

MAP

map