Skip to content

Commit

Permalink
Update Devices
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Apr 9, 2024
1 parent 989b856 commit df5401a
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ STELLIO_TIMESCALE_POSTGIS=14-2.11.1-3.3
CURL_VERSION=8.4.0

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

Expand Down
27 changes: 26 additions & 1 deletion docker-compose/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,32 @@ services:
mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
interval: 5s

# Tutorial acts as a series of dummy IoT Sensors over HTTP

farmer:
labels:
org.fiware: 'tutorial'
image: quay.io/fiware/tutorials.forwarder
hostname: 'farmer'
container_name: cb-farmer
ports:
- 1027:80
environment:
- TENANT=farmer
- DEBUG=broker:*

devices:
labels:
org.fiware: 'tutorial'
image: quay.io/fiware/tutorials.forwarder
hostname: 'farmer'
container_name: cb-devices
ports:
- 1028:80
environment:
- TENANT=openiot
- DEBUG=broker:*

# Tutorial acts as a series of dummy IoT Sensors over HTTP
tutorial:
labels:
org.fiware: 'tutorial'
Expand Down
8 changes: 8 additions & 0 deletions docker-compose/orion-ld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ services:
test: curl --fail -s http://orion:${ORION_LD_PORT}/version || exit 1
interval: 5s

farmer:
environment:
- CONTEXT_BROKER=http://orion:${ORION_LD_PORT}

devices:
environment:
- CONTEXT_BROKER=http://orion:${ORION_LD_PORT}

# IoT-Agent connects to the Orion-LD Broker
iot-agent:
environment:
Expand Down
7 changes: 7 additions & 0 deletions docker-compose/scorpio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ services:
volumes:
- postgres-db:/var/lib/postgresql/data

farmer:
environment:
- CONTEXT_BROKER=http://scorpio:${SCORPIO_PORT}

devices:
environment:
- CONTEXT_BROKER=http://scorpio:${SCORPIO_PORT}

# IoT-Agent connects to the Scorpio Broker
iot-agent:
environment:
Expand Down
6 changes: 6 additions & 0 deletions docker-compose/stellio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ services:
- IOTA_CB_PORT=${STELLIO_PORT} # port the context broker listens on to update context


farmer:
environment:
- CONTEXT_BROKER=http://stellio:${STELLIO_PORT}
devices:
environment:
- CONTEXT_BROKER=http://stellio:${STELLIO_PORT}
# Tutorial acts as a series of dummy IoT Sensors over HTTP and connects to the Stellio Broker
tutorial:
environment:
Expand Down
47 changes: 47 additions & 0 deletions import-data
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,51 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/entityOper
}
]'


echo -e "Registering Farmer and Devices as data sources.\n"

curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/csourceRegistrations/' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
-H 'Content-Type: application/json' \
-d '{
"type": "ContextSourceRegistration",
"information": [
{
"entities": [
{
"type": "Animal"
}
]
}
],
"mode": "redirect",
"operations": [
"redirectionOps"
],
"endpoint": "http://farmer"
}'


curl -s -o /dev/null -X POST 'http://farmer/ngsi-ld/v1/csourceRegistrations/' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
-H 'Content-Type: application/json' \
-d '{
"type": "ContextSourceRegistration",
"information": [
{
"entities": [
{
"type": "Animal"
}
]
}
],
"mode": "inclusive",
"operations": [
"federationOps"
],
"endpoint": "http://devices"
}'


echo -e " \033[1;32mdone\033[0m"

0 comments on commit df5401a

Please sign in to comment.