Skip to content

Commit

Permalink
Switch to MQTT-JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Sep 2, 2024
1 parent 715580f commit 8902321
Show file tree
Hide file tree
Showing 7 changed files with 871 additions and 41 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ CURL_VERSION=8.4.0
MONGO_DB_PORT=27017
MONGO_DB_VERSION=6.0

# IoT Agent Ultralight Variables
ULTRALIGHT_VERSION=3.3.0-distroless
# IoT Agent JSON Variables
#ULTRALIGHT_VERSION=3.3.0-distroless
JSON_VERSION=3.3.0-distroless
IOTA_NORTH_PORT=4041
IOTA_SOUTH_PORT=7896

Expand Down
33 changes: 29 additions & 4 deletions docker-compose/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ services:
test: ["CMD","mongosh", "localhost:27017/test", "--quiet"]
interval: 5s

# IoT-Agent is configured for the UltraLight Protocol
# IoT-Agent is configured for the JSON Protocol
iot-agent:
labels:
org.fiware: 'tutorial'
image: quay.io/fiware/iotagent-ul:${ULTRALIGHT_VERSION}
#image: quay.io/fiware/iotagent-ul:${ULTRALIGHT_VERSION}
image: quay.io/fiware/iotagent-json:${JSON_VERSION}
hostname: iot-agent
container_name: fiware-iot-agent
depends_on:
Expand All @@ -79,16 +80,37 @@ services:
- IOTA_AUTOCAST=true # Ensure Ultralight number values are read as numbers not strings
- IOTA_MONGO_HOST=mongo-db # The host name of MongoDB
- IOTA_MONGO_PORT=${MONGO_DB_PORT} # The port mongoDB is listening on
- IOTA_MONGO_DB=iotagentul # The name of the database used in mongoDB
- IOTA_HTTP_PORT=${IOTA_SOUTH_PORT} # The port used for device traffic over HTTP
- IOTA_MONGO_DB=iotagentjson # The name of the database used in mongoDB
- IOTA_PROVIDER_URL=http://iot-agent:${IOTA_NORTH_PORT}
- IOTA_CB_NGSI_VERSION=ld # use NGSI-LD when sending updates for active attributes
- IOTA_JSON_LD_CONTEXT=http://context/user-context.jsonld
- IOTA_FALLBACK_TENANT=openiot
- IOTA_MULTI_CORE=true
- IOTA_MQTT_HOST=mosquitto # The host name of the MQTT Broker
- IOTA_MQTT_PORT=1883 # The port the MQTT Broker is listening on to receive topics
- IOTA_DEFAULT_RESOURCE= # Default is blank. I'm using MQTT so I don't need a resource
- IOTA_DEFAULT_TRANSPORT=MQTT
healthcheck:
interval: 30s

# Other services
mosquitto:
image: eclipse-mosquitto:1.6.14
hostname: mosquitto
container_name: mosquitto
labels:
org.fiware: 'tutorial'
expose:
- "1883"
- "9001"
ports:
- "1883:1883"
- "9001:9001"
volumes:
- ../mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf
networks:
- default

farmer:
labels:
org.fiware: 'tutorial'
Expand Down Expand Up @@ -146,6 +168,9 @@ services:

- PIG_COUNT=${PIG_COUNT}
- COW_COUNT=${COW_COUNT}
- MQTT_TOPIC_PROTOCOL=json
- MQTT_BROKER_URL=mqtt://mosquitto
- DUMMY_DEVICES_API_KEYS=321701236,548027571,854782081,110990,98699,112903447,1067386313


networks:
Expand Down
5 changes: 2 additions & 3 deletions docker-compose/orion-ld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ services:
# Tutorial acts as a series of dummy IoT Sensors over HTTP and connects to the Orion-LD Broker
tutorial:
environment:
- IOTA_DEFAULT_RESOURCE=/iot/d
- DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT} # Port used by the dummy IOT devices to receive commands
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
- DUMMY_DEVICES_PAYLOAD=ULTRALIGHT
- DUMMY_DEVICES_TRANSPORT=MQTT # Default transport used by dummy Io devices
- DUMMY_DEVICES_PAYLOAD=JSON
- CONTEXT_BROKER=http://orion:${ORION_LD_PORT}/ngsi-ld/v1 # URL of the context broker to update context

5 changes: 2 additions & 3 deletions docker-compose/scorpio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ services:
# Tutorial acts as a series of dummy IoT Sensors over HTTP and connects to the Scorpio Broker
tutorial:
environment:
- IOTA_DEFAULT_RESOURCE=/iot/d
- DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT} # Port used by the dummy IOT devices to receive commands
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
- DUMMY_DEVICES_PAYLOAD=ULTRALIGHT
- DUMMY_DEVICES_TRANSPORT=MQTT # Default transport used by dummy Io devices
- DUMMY_DEVICES_PAYLOAD=JSON
- CONTEXT_BROKER=http://scorpio:${SCORPIO_PORT}/ngsi-ld/v1 # URL of the context broker to update context

volumes:
Expand Down
5 changes: 2 additions & 3 deletions docker-compose/stellio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ services:
# Tutorial acts as a series of dummy IoT Sensors over HTTP and connects to the Stellio Broker
tutorial:
environment:
- IOTA_DEFAULT_RESOURCE=/iot/d
- DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT} # Port used by the dummy IOT devices to receive commands
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
- DUMMY_DEVICES_PAYLOAD=ULTRALIGHT
- DUMMY_DEVICES_TRANSPORT=MQTT # Default transport used by dummy Io devices
- DUMMY_DEVICES_PAYLOAD=JSON
- CONTEXT_BROKER=http://stellio:${STELLIO_PORT}/ngsi-ld/v1 # URL of the context broker to update context

volumes:
Expand Down
Loading

0 comments on commit 8902321

Please sign in to comment.