The Simulator generates the types of data hardware devices in the field would send to Proficloud either directly or via a proxy device like the PLCnext. It includes the Connector binary running as a service, the Mosquitto MQTT broker and the Simulator service, which accept default configurations via
habitat/simulator/default.toml
To build and run locally during development:
brew install mosquitto
hab studio enter
you can then access the MQTT event stream:
mosquitto_sub \
--host "127.0.0.1" \
--port 1883 \
--topic "proficloud/#"
and the Connector log from inside the Studio session:
sup-log | grep connector.default
(sup here refers to the Habitat Supervisor.)
The variables specific to a Workspace can be configured here.
Once configured, each Terraform Cloud Workspace will perform a plan for each
push to a Pull-Request branch in Git and an apply for merges to the Master
branch.
The Simulator can be run from a Docker container built from the included Dockerfile:
docker build . --tag="proficloud/device-simulator"
DEVICE should be the name of a device as represented by one of the included JSON configuration files, such as pump_healthy.json:
export DEVICE_TOKEN="n78nrWd5uc"
export DEVICE="healthy-and-online-blower"
export CHANNEL="unstable"
export CLOUD_SERVER="<host>:<port>" #kpc-kaa-demo.pc-playground.de:1883
docker run \
--rm \
--name="simulator" \
--publish=1883:1883 \
--publish=8080:8080 \
--env=DEVICE=$DEVICE \
--env=CHANNEL=$CHANNEL \
--env=CLOUD_SERVER=$CLOUD_SERVER \
--env=DEVICE_TOKEN=$DEVICE_TOKEN \
--env=HAB_AUTH_TOKEN=$HAB_AUTH_TOKEN \
"proficloud/device-simulator"
You can extend connect with an MQTT Client (like MQTTBox or MQTT.fx) to 127.0.0.1:1883 to see messages as they are published.
We use the BATS testing framework:
bats ./test.bats
Content type
Image
Digest
Size
126.5 MB
Last updated
about 6 years ago
docker pull proficloud/device-simulator