Predix Edge Applications

What protocol translators and cloud gateways come out of the box with Predix Edge?

Predix Edge ships with protocol translators for OPC-UA, Modbus, EGD, OSI-Pi and MQTT and comes with cloud gateways for sending data to Predix Time Series and Predix EventHub.

How do I access the Predix Edge stock apps like protocol translators and cloud gateways?

Instructions for accessing the protocol translators and cloud gateways are available here. Additionally you'll find sample configurations there.

How do I configure protocol translators and cloud gateways?  

For configuration instructions see:

How should I write Predix Edge applications?

We have taken an open approach to developing apps for Predix Edge.  As long as your app can be containerized to run in Linux Docker, your app can be deployed to Predix Edge.  If your app requires connectivity to other apps or Predix Edge components such as protocol adapters or cloud gateways, the only requirement is the ability to connect to MQTT.  MQTT client libraries are available for most languages you would consider for app development.

There are a few security constraints you must follow when designing your app. First of all, you are not allowed to define arbitrary volume mounts for disk access on the Predix Edge device.  Disk access is restricted to a /config and /data folder automatically provided to each app.  The config folder is read-only and contains configuration files uploaded to your app from either Edge Manager or PETC.  Your app should be designed to load startup configuration files from this location.  The Data folder is read-write and must be used for any file IO in your application.  

To connect to the MQTT Broker for inter app communication, your application must be configured to attach to the predix-edge-broker_net Docker network.  This is configured in the app’s docker-compose.yml file.  

Predix Edge provides sample applications in C++, Java, GO, NodeJS and Python.  Each application has a full set of instructions on how to design, code, build and deploy the app to Predix Edge.  Links to these apps can be found in the Predix Edge documentation at www.predix.io.

How do the /config and /data volume mounts work?

When you deploy an application using either Edge Manager, the curl command from the Edge OS command prompt, or PETC, the Predix Edge Agent does some behind the scenes magic to your docker-compose file to create a read-only /config mount that your applications will be able to access for configuration information and a /data volume mount that your applications can use for read/write AKA sandboxed config and persistent storage.    

Some recommended do's and dont's:

Do
  • Write your application logic to look for configuration logic in the /config directory.
  • Write to and read from the /data directory in your application logic.
Don't
  • Create the volume mounts in your docker-compose files. Edge Agent will do that for you and will choke if you try to do it. (This is for sandboxing purposes.)
  • Look for a /config directory on the predix OS instance, you will not find it there. If you are looking for where to put those config files because you are doing it manually on the Dev VM, then you want the /var/lib/edge-agent/app/your-app-id/conf/ directory, which mounts to the Docker app's /config directory.
  • Try writing to the /config directory in your app logic, it is a read-only mount.
The curl command to deploy the application is:
$ curl http://localhost/api/v1/applications --unix-socket /var/run/edge-core/edge-core.sock -X POST -F "file=@/mnt/data/downloads/app.tar.gz" -H "app_name: your-app-id"
Note: The above curl command will initialize the /config and /data directories. 

For more information on application packaging and deployment, see Packaging and Deployment.

Can I retrieve log information from the OS and from my apps?

Yes, see the logging documentation for more information about retrieving logs using journalctl, PETC and Edge Manager.