Skip to content

Commit

Permalink
Merge pull request #4 from eclipse-leda/node-red
Browse files Browse the repository at this point in the history
add Node-RED example container
  • Loading branch information
mikehaller authored Oct 30, 2023
2 parents 98edf59 + f3ca301 commit fdac227
Show file tree
Hide file tree
Showing 8 changed files with 5,624 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/docker-build-publish-node-red.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# /********************************************************************************
# * Copyright (c) 2023 Contributors to the Eclipse Foundation
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License 2.0 which is available at
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/

name: Node-RED

on:
workflow_dispatch:
workflow_call:
pull_request:
paths:
- ".github/workflows/docker-build-publish-node-red.yml"
- "node-red/**"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/leda-example-node-red

jobs:
build:
name: "Build multi-arch image"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup QEMU buildx
uses: docker/setup-qemu-action@v2

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
push: true
context: ./node-red/
file: ./node-red/Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ The **[Kuksa CarSim](kuksa-carsim)** example is based on [Kuksa.VAL Services](ht
It provides simulated physical motion telemetry of a moving vehicle to the [Databroker](https://github.com/eclipse/kuksa.val/tree/master/kuksa_databroker).
The databroker is an in-vehicle, in-memory database for signal information. Signal formats are standardized in the [Vehicle Signal Specification](https://github.com/COVESA/vehicle_signal_specification).

### Node-RED

The **[Node-RED](node-red/)** example presents some flows based on the [Node-RED](https://nodered.org/) programming environment to demonstrate how the various service running on a [Leda](https://eclipse-leda.github.io/) distribution can be accessed via a graphical user interface.

## Contributing

If you want to contribute bug reports or feature requests, please use *GitHub Issues*.
Expand Down
41 changes: 41 additions & 0 deletions node-red/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# /********************************************************************************
# * Copyright (c) 2023 Contributors to the Eclipse Foundation
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License 2.0 which is available at
# * https://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/


FROM nodered/node-red
# FROM nodered/node-red:latest-debian

LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.opencontainers.image.url="https://github.com/eclipse-leda/leda-example-applications"
LABEL org.opencontainers.image.documentation="https://eclipse-leda.github.io/leda/docs/app-deployment/node-red/"
LABEL org.opencontainers.image.source="https://github.com/eclipse-leda/leda-example-applications/node-red"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.vendor="Eclipse Foundation"
LABEL org.opencontainers.image.title="Eclipse Leda Node-RED Example"
LABEL org.opencontainers.image.description="A Node-RED example with preconfigured nodes, flows and dashboard for the Eclipse Leda distribution."

COPY package.json .
RUN npm install --unsafe-perm --no-update-notifier --no-fund --omit=dev

ENV MQTT_ADDR="mosquitto"
ENV MQTT_PORT="1883"
ENV BROKER_ADDR="databroker"
ENV BROKER_PORT="55555"

# Copy _your_ Node-RED project files into place
# NOTE: This will only work if you DO NOT later mount /data as an external volume.
# If you need to use an external volume for persistence then
# copy your settings and flows files to that volume instead.
COPY settings.js /data/settings.js
# COPY flows_cred.json /data/flows_cred.json
COPY flows.json /data/flows.json
32 changes: 32 additions & 0 deletions node-red/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Node-RED example application

## Overview

The Node-RED setup requires:

- Eclipse Mosquitto
- Eclipse Kuksa.VAL Databroker
- Eclipse Kuksa.VAL Seat Service example
- Eclipse Velocitas Seat Adjuster example
- Eclipse Kanto Container Management
- Eclipse Leda Quickstart image

## Integration

The containers are integrated with deployment descriptors in the Leda Quickstart image.
Please see [meta-leda/meta-leda-components/recipes-sdv/eclipse-leda/kanto-containers/example](https://github.com/eclipse-leda/meta-leda/tree/main/meta-leda-components/recipes-sdv/eclipse-leda/kanto-containers/example) for details.

## Usage

You can access the graphical user interface with any web browser on the port 1881, e.g. http://leda-host:1881/.
The generated dashboard is available on http://leda-host:1881/ui/.

Describing how to use the UI is out of the scope of this document. Please consult the excellent [Node-RED documentation](https://nodered.org/docs/).

## Data sources

To make full use of the dashboard example you have to feed some data into the system.
If you don't have real data, some possible sources could be:

- [Kuksa CarSim](../kuksa-carsim/)
- [FeederGPS](https://eclipse-leda.github.io/leda/docs/general-usage/gps-configuration/)
Loading

0 comments on commit fdac227

Please sign in to comment.