1_Installation

Last modified by Jan Brinkhaus on 2023/04/12 16:54

Create folders

sudo mkdir -p /var/bos/logs/datagate-1_docker /var/bos/settings/datagate-1_docker /var/bos/logs/datagate-2_docker /var/bos/settings/datagate-2_docker /var/bos/logs/dataswitch_docker /var/bos/settings/dataswitch_docker

Create a mosquitto.conf

echo "allow_anonymous true" > mosquitto.conf
echo "listener 1883" >> mosquitto.conf

docker-compose file

Create a docker-compose.yml from the below contents. As per the below example, 2 DataGate instances as well as the dataswitch application will be brought up. Via the containers, we can support any number of DataGate instances, as much as the hardware supports.

services:
  datagate-1:
    image: "brinkhausgmbh/datagate"
    container_name: "datagate-1"
    restart: unless-stopped
    ports:
      - "8081:8081"
      - "22101:22101"
    volumes:
      - settings-datagate-1:/var/bos/settings/datagate-1
      - logs-datagate-1:/var/bos/logs/datagate-1
     
  datagate-2:
    image: "brinkhausgmbh/datagate"
    container_name: "datagate-2"
    restart: unless-stopped
    ports:
      - "8082:8081"
      - "22102:22102"
    volumes:
      - settings-datagate-2:/var/bos/settings/datagate-1
      - logs-datagate-2:/var/bos/logs/datagate-1
     
  dataswitch:
    image: "brinkhausgmbh/dataswitch"
    container_name: "dataswitch"
    depends_on:
      - datagate-1
      - datagate-2
      - mosquitto

    restart: unless-stopped
    ports:
      - "8090:8090"
   
    volumes:
      - settings-dataswitch:/var/bos/settings/dataswitch
      - logs-dataswitch:/var/bos/logs/dataswitch

  mosquitto:
    image: "eclipse-mosquitto"
    container_name: "mosquitto"
    restart: unless-stopped
    ports:
      - "1883:1883"
    volumes:
      -  ./mosquitto.conf:/mosquitto/config/mosquitto.conf

# DataStore with backend CrateDB
  crate01:
    image: crate
    hostname: crate
    ports:
      - "4200:4200"
      - "4300:4300"
      - "5432:5432"
    volumes:
      - ./data/databaseBackend:/data

  datastore:
    image: brinkhausgmbh/datastore
    hostname: datastore
    environment:
      - MQTT_CONNECTION_TARGET=mosquitto
    ports:
      - "8089:80"
    depends_on:
      - crate01
      - mosquitto
    volumes:
      - ./data/datastore:/data/datastore

volumes:
  settings-datagate-1:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/var/bos/settings/datagate-1_docker'
  logs-datagate-1:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/var/bos/logs/datagate-1_docker'
  settings-datagate-2:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/var/bos/settings/datagate-2_docker'
  logs-datagate-2:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/var/bos/logs/datagate-2_docker'
  settings-dataswitch:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/var/bos/settings/dataswitch_docker'
  logs-dataswitch:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/var/bos/logs/dataswitch_docker'

Run the docker compose file to start up the container.

docker compose up -d

To check if the containers are up and running,

docker ps

Configuration of the sources (datagate-1 and datagate-2)

For configuration of the DataGate instances keep in mind that they are accessible at the ports 8081 and 8082 (as configured via the docker-compose.yml).

For datagate-1, navigate to

http://127.0.0.1:8081

For datagate-2, navigate to

http://127.0.0.1:8082

Navigate to "Settings > Sampling" and configure a data sampling. Press "Save".

Navigate to "Settings > Processing" and configure a data processing (data output) of DataGate to gRPC. Press "Save".

Configuration of DataSwitch

Navigate to "Settings > DataSwitch sources > DataSwitch Sources 0" and set the hostname to datagate-1, port 22101. If you want to configure a second source, do accordingly for "DataSwitch Sources 1" (with datagate-2 and port 22102). Press "Save" each time.

The DataSwitch and DataGate instances should now be set up and running.

Configuration of DataStore

As there was only the mosquitto server to be configured, DataStore was preconfigured in the docker-compose.yml .

Test

From now on the mosquitto server, configured in the docker-compose.yml will receive sensor values. You can test and see them with:

mosquitto_sub -t "#"

The output should look like

{"header": { "key": "EupgDataDescription","message_type": "MQTT","source_id": "EupgInput"},"body":{"uri": "dataswitch","normalizationOfTimeToSec": 0.000001,"channelDescriptions": [{"key": "ProgName","axis": "","signal": "ProgName","unit": "Name","min": 1.000000,"max": 10.000000},{"key": "blockNoStr","axis": "","signal": "blockNoStr","unit": "Name","min": 1.000000,"max": 10.000000}],"frequency": 10.000000}}
{"header": { "key": "EupgDataContent","message_type": "MQTT","source_id": "EupgInput"},"body":{"uri": "dataswitch","timestamp": [1681313357911747,1681313358007799,1681313358107282,1681313358219402,1681313358312129,1681313358408431,1681313358506504,1681313358607267,1681313358710570,1681313358810300],"dataValues":{"key": "ProgName","value": ["_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF","_N_TEST_BRINKHAUS_MPF"]}}}

 

You can login onto the cratedb on http://127.0.0.1:4300 and see the sensor data being inserted in the table "historicValues".