Skip to content

Commit 1c57f10

Browse files
authored
Merge pull request #4 from industrial-edge/dev-branch-v1-2
updates for V1.2 and layout changes
2 parents 3f2a21f + 0587005 commit 1c57f10

File tree

10 files changed

+411
-512
lines changed

10 files changed

+411
-512
lines changed

README.md

Lines changed: 82 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,101 @@
1-
# Databus Ping Pong implementation in Javascript
1+
# Databus Ping Pong Node.js
2+
3+
This application example contains the source files to build a Databus Ping Pong application implemented in Node.js.
4+
5+
- [Databus Ping Pong Node.js](#databus-ping-pong-node-js)
6+
- [Description](#description)
7+
- [Overview](#overview)
8+
- [General task](#general-task)
9+
- [Requirements](#requirements)
10+
- [Used components](#used-components)
11+
- [Further requirements](#further-requirements)
12+
- [Installation](#installation)
13+
- [Usage](#usage)
14+
- [Documentation](#documentation)
15+
- [Contribution](#contribution)
16+
- [Licence and Legal Information](#licence-and-legal-information)
217

18+
## Description
319

20+
### Overview
421

5-
- [Databus Ping Pong implementation in Javascript](#databus-ping-pong-implementation-in-javascript)
6-
* [Description](#description)
7-
+ [Overview](#overview)
8-
* [Installation](#installation)
9-
* [Usage](#usage)
10-
* [Documentation](#documentation)
11-
* [Contribution](#contribution)
12-
* [Licence and Legal Information](#licence-and-legal-information)
22+
This application example shows how to connect to the IE Databus via MQTT and how to publish and subscribe data using an implementation in Node.js.
23+
The IE Flow Creator is used to exchange data between different topics within the IE Databus.
1324

14-
## Description
15-
This repository contains the source files to build the Databus Ping Pong application example implemented in Javascript. Please refer to the [main repository](https://github.com/industrial-edge/pingpong-python) for more information about this application example.
25+
![Use Case](graphics/DataFlow.png)
1626

17-
### Overview
27+
This implementation example uses the ``node:14.17.1-alpine`` image as the base layer and runs the provided script after installing all necessary dependencies.
28+
29+
This example also shows two ways of configuring the application:
30+
31+
- configuration via file upload (fix configuration file)
32+
- configuration via system app Configuration Service (custom configuration UI with JSON Forms)
33+
34+
### General task
35+
36+
The application includes a MQTT client to subscribe to one topic of the IE Databus and waits to receive data. When data arrives, it publishes a corresponding answer to a second topic of the IE Databus. If it receives the string "Ping", it will answer with "Pong" and the other way around.
37+
38+
![Use Case](graphics/Usecase.png)
39+
40+
The names of the IE Databus topics as well as the credentials used by the application can be configured via different options, otherwise environmental variables included in the docker-compose file are used.
41+
42+
## Requirements
1843

19-
This implementation of the Databus Ping Pong application example uses the ``node:10.16.3-alpine`` image as the base layer and runs the provided script after installing all necessary dependencies.
44+
### Used components
2045

46+
- Industrial Edge Management (IEM) V1.2.0-36 / V1.2.14
47+
- IE Databus Configurator V1.2.23
48+
- IE Databus V1.2.16
49+
- IE Flow Creator V1.1.2
50+
- IE App Configuration Service V1.0.5
51+
- Industrial Edge Device (IED) V1.2.0-56
52+
- Industrial Edge App Publisher V1.2.7
53+
- Docker Engine V20.10.3
54+
- Docker Compose V1.28.5
55+
56+
### Further requirements
57+
58+
- IED is onboarded to a IEM
59+
- IE Databus Configurator is deployed to the IEM
60+
- IE Configuration Service is deployed to the IEM
61+
- IE Databus is deployed to the IED
62+
- IE Flow Creator is deployed to the IED
2163

2264
## Installation
2365

24-
Please refer to the [Installation](https://github.com/industrial-edge/pingpong-python/blob/main/docs/Installation.md) section of the main repository on how to build and deploy the application to a Industrial Edge Device.
25-
When creating a configuration for the application in the Industrial Edge Management System, you can use the the [mqtt-config.json](cfg-data/mqtt-config.json) file from this repository.
66+
Please refer to the [Installation](https://github.com/industrial-edge/pingpong-csharp/blob/main/docs/Installation.md#installation) section of the *Ping Pong in C#* repository on how to build and deploy the application to an IED. Just use the source files from this repository and follow the instructions.
67+
68+
- [Build application](https://github.com/industrial-edge/pingpong-csharp/blob/main/docs/Installation.md#build-application)
69+
- [Configuring the Industrial Edge Databus](https://github.com/industrial-edge/pingpong-csharp/blob/main/docs/Installation.md#configuring-the-industrial-edge-databus)
70+
- [Create configuration for the application](https://github.com/industrial-edge/pingpong-csharp/blob/main/docs/Installation.md#create-configuration-for-the-application)
71+
- [Upload the application to the Industrial Edge Management](https://github.com/industrial-edge/pingpong-csharp/blob/main/docs/Installation.md#upload-the-application-to-the-industrial-edge-management)
72+
- [Configuring and deploying the application to a Industrial Edge Device](https://github.com/industrial-edge/pingpong-csharp/blob/main/docs/Installation.md#configuring-and-deploying-the-application-to-a-industrial-edge-device)
2673

2774
## Usage
2875

29-
Please refer to the [Testing](https://github.com/industrial-edge/pingpong-python/blob/main/docs/Installation.md#testing-the-application-using-simatic-flow-creator) section of the main repository on how to build and deploy the application to a Industrial Edge Device.
76+
Once the application is successfully deployed to the IED, it can be tested using the IE Flow Creator.
3077

31-
## Documentation
78+
On the IED restart the PingPong application, to ensure the right configuration is used. Then open the app IE Flow Creator and set it up as following:
79+
80+
- Connect an "inject" node with a "mqtt out" node
81+
- Connect a "mqtt in" node with a "debug" node
82+
- Configure the mqtt-nodes to connect to the databus (mqtt broker, username, password)
83+
- Set the topics of the mqtt-nodes according to the configuration of the application (here: "topic1" to publish to, "topic2" to subscribe to)
3284

85+
Deploy the flow and test by injecting a string payload into the mqtt in node. If the string is "Ping", the application will answer with "Pong". If the string is "Pong" the application will answer with "Ping".
86+
87+
The finished flow is available [here](src/Flow_Pingpong_Test.json) and can be imported into the IE Flow Creator.
88+
89+
![Flow Creator](graphics/FlowCreator.png)
90+
91+
## Documentation
3392

34-
You can find further documentation and help in the following links
35-
- [Industrial Edge Hub](https://iehub.eu1.edge.siemens.cloud/#/documentation)
36-
- [Industrial Edge Forum](https://www.siemens.com/industrial-edge-forum)
37-
- [Industrial Edge landing page](https://new.siemens.com/global/en/products/automation/topic-areas/industrial-edge/simatic-edge.html)
38-
- [Industrial Edge GitHub page](https://github.com/industrial-edge)
93+
You can find further documentation and help in the following links:
94+
95+
- [Industrial Edge Hub](https://iehub.eu1.edge.siemens.cloud/#/documentation)
96+
- [Industrial Edge Forum](https://www.siemens.com/industrial-edge-forum)
97+
- [Industrial Edge landing page](https://new.siemens.com/global/en/products/automation/topic-areas/industrial-edge/simatic-edge.html)
98+
- [Industrial Edge GitHub page](https://github.com/industrial-edge)
3999

40100
## Contribution
41101

cfg-data/json_schema/mqtt-config.json

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"uischema":{
3+
"type": "Group",
4+
"elements": [
5+
{
6+
"type": "Group",
7+
"elements": [
8+
{
9+
"type": "Control",
10+
"scope": "#/properties/MQTT_IP"
11+
},
12+
{
13+
"type": "HorizontalLayout",
14+
"elements": [
15+
{
16+
"type": "Control",
17+
"scope": "#/properties/MQTT_USER"
18+
},
19+
{
20+
"type": "Control",
21+
"scope": "#/properties/MQTT_PASSWORD"
22+
}
23+
]
24+
}
25+
],
26+
"label": "IE Databus credentials"
27+
},
28+
{
29+
"type": "Group",
30+
"elements": [
31+
{
32+
"type": "HorizontalLayout",
33+
"elements":[
34+
{
35+
"type": "Control",
36+
"scope": "#/properties/TOPIC_1"
37+
},
38+
{
39+
"type": "Control",
40+
"scope": "#/properties/TOPIC_2"
41+
}
42+
]
43+
}
44+
],
45+
"label": "IE Databus topics"
46+
}
47+
]
48+
},
49+
"dataschema":{
50+
"type": "object",
51+
"properties": {
52+
"TOPIC_1": {
53+
"title": "Topic 1",
54+
"default": "topic1",
55+
"type": "string"
56+
},
57+
"TOPIC_2": {
58+
"title": "Topic 2",
59+
"default": "topic2",
60+
"type": "string"
61+
},
62+
"MQTT_IP": {
63+
"title": "MQTT Broker",
64+
"default": "ie-databus",
65+
"type": "string"
66+
},
67+
"MQTT_USER": {
68+
"title": "Username",
69+
"type": "string"
70+
},
71+
"MQTT_PASSWORD": {
72+
"title": "Password",
73+
"type": "string"
74+
}
75+
},
76+
"required": ["TOPIC_1", "TOPIC_2", "MQTT_IP", "MQTT_USER", "MQTT_PASSWORD"]
77+
}
78+
}

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
pingpong_nodejs:
55
build:
66
context: ./src
7-
image: pingpong_nodejs:1.1.0
7+
image: pingpong_nodejs:1.2.0
88
networks:
99
- proxy-redirect
1010
environment:

graphics/DataFlow.png

63.3 KB
Loading

graphics/FlowCreator.png

113 KB
Loading

graphics/Usecase.png

52 KB
Loading

src/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ FROM node:14.17.1-alpine
33
# Create app directory
44
WORKDIR /usr/src/app
55

6-
# Install app dependencies
6+
# Add source files to filesystem of container
77
COPY package*.json ./
88

9+
# Install app dependencies (all modules listed in package.json)
910
RUN npm install
1011

1112
# Bundle app source
1213
COPY . .
1314

15+
#Run application
1416
CMD ["node", "server.js"]

0 commit comments

Comments
 (0)