Sample Files

docker-compose.yml

The following sample file determines how to deploy the Cloud Gateway Edge App.
Note: The config environment variable must specify the file path to the configuration file inside the Docker container that will be deployed. If the file name does not match the configuration file applied to the Edge App, the Cloud Gateway will be unable to find it.
version: "3"

services:
  cloud-gateway:
    image: "dtr.predix.io/predix-edge/cloud-gateway:amd64-1.1.0"
    environment:
      config: "/config/config-cloud-gateway.json"
    env_file:
      - /etc/environment
    deploy: 
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 5
        window: 30s
    networks:
      - predix-edge-broker_net

networks:
  predix-edge-broker_net:
    external: true

config.json

The following sample configuration file can be used to configure the Cloud Gateway to send data to both Predix Time Series and Predix Event Hub.

In this example, data received from the Predix Edge Broker on the MQTT topic timeseries_data will be ingested into the Time Series instance with Zone ID xxx-xxx-xxx. Data received from the MQTT topics eventhub_data/osipi_data, eventhub_data/opc_ua_data, eventhub_data/modbus_data, and eventhub_data/egd_data will be published to the Event Hub topic topic in the Event Hub instance with Zone ID yyy-yyy-yyy.

{
    "blocks": {
        "time_series_sender": {
            "type": "timeseries",
            "config": {
                "log_name": "time_series_sender",
                "log_level": "debug",
                "mqtt": {
                    "transport_addr": "mqtt-tcp://predix-edge-broker",
                    "qos": 2,
                    "client_id": "time_series_sender_mqtt_client",
                    "topics": [
                        "timeseries_data"
                    ]
                },
                "store_forward": {
                    "policy": "store_on_failure",
                    "max_store_percent": 15,
                    "max_batch_interval": 1000
                },
                "timeseries": {
                    "transport_addr": "wss://gateway-predix-data-services.run.aws-usw02-pr.ice.predix.io/v1/stream/messages",
                    "predix_zone_id": "xxx-xxx-xxx",
                    "token_file": "/edge-agent/access_token",
                    "proxy_url": "$http_proxy"
                }
            }
        },
        "event_hub_sender": {
            "type": "eventhub",
            "config": {
                "log_name": "event_hub_sender",
                "log_level": "debug",
                "mqtt": {
                    "transport_addr": "mqtt-tcp://predix-edge-broker",
                    "qos": 1,
                    "topics": [
                        "eventhub_data/osipi_data",
                        "eventhub_data/opc_ua_data",
                        "eventhub_data/modbus_data",
                        "eventhub_data/egd_data"
                    ]
                },
                "store_forward": {
                    "max_store_percent": 60,
                    "max_batch_interval": 1000
                },
                "eventhub": {
                    "transport_addr" : "event-hub-aws-usw02.data-services.predix.io:443",
                    "predix_zone_id" : "yyy-yyy-yyy",
                    "token_file": "/edge-agent/access_token",
                    "topic_map": [
                        {
                            "eventhub_topic": "topic",
                            "mqtt_topics": [
                                "eventhub_data/osipi_data",
                                "eventhub_data/opc_ua_data",
                                "eventhub_data/modbus_data",
                                "eventhub_data/egd_data"
                            ]
                        }
                    ]
                }
            }
        }
    }
}