Skip to main content

Setting up Node Development Template

Requirements

  • Java 17+
  • Gradle 7.3+
  • Git

The Code

The following clones the OpenSensorHub node development template.

git clone --recursive https://github.com/opensensorhub/osh-node-dev-template.git
note

The --recursive flag is required because the repository contains submodules.

What's Included

Below is everything included in osh-node-dev-template, along with a table explaining each file/directory. osh-node-dev-template repository

File/DirectoryPurpose
.github/ISSUE_TEMPLATEIssue templates to create GitHub issues.
dist/configConfig files required in a build. All config files from here will be output in the build's config directory as specified in the root build.gradle
dist/scriptsScripts to launch the built node (and perform other setup). These will be included in the build at the built node's root directory.
gradle/wrapperConfiguration for using Gradle Wrapper, which is used for building an OSH node. Here you may update the Gradle Wrapper version to use Java 21+.
include/osh-addonsAdditional OSH modules that can be used as dependencies for your modules or built with the OSH node. These include drivers, processes, services, etc.
include/osh-coreCore modules required for an OSH node to work. These modules include the source code for an OSH node, and APIs for creating additional modules.
processingLocal processing modules. A template for a SensorML process is included in this directory.
sensorsLocal sensor driver modules. A template for a simulated sensor driver is included in this directory.
tools/sensorhub-testA test module to be used with a debugger, for running a node and any drivers, processes, or other modules in debug mode. Please see Debugging
webStatic web files to be served by the built OSH node. This directory will be included in the built node under web.
build.gradleGradle build configuration. This is where you will define what submodules to build, the distribution structure, and other basic configuration.
settings.gradleThis is where you declare all dependencies to be used by submodules and modules built by build.gradle.
gradlewExecutable for performing Gradle tasks. To build (without running tests), use ./gradlew build -x test.
tip

When creating a sensor driver, process, or other module, be sure to move your module to include/osh-addons and create pull requests targeting OpenSensorHub/osh-addons on the master branch. Please refer to the Contribution Guide.

Building

Use Gradle Wrapper to build.

./gradlew build -x test

This will build an OSH node in osh-node-dev-template/build/distributions/osh-node-*.*.*.zip.

Upon unzipping you will find configuration files in /config, launch scripts, all built modules as JAR files in /lib, static web files in /web, and a few more files included in a build.