Commit 3f44788e authored by Federico Sismondi's avatar Federico Sismondi
Browse files

Feat() data collection in raw format, and sketch of first version of collect...

Feat() data collection in raw format, and sketch of first version of collect to historical data base (w/ QuantumLeap)
parent 733df5b9
.cpython-36.pyc
.idea/
weather_data_init.json
scripts/weather_raw_last_data.json
wms-example/__pycache__/
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -30,6 +30,10 @@ services:
command: -dbhost mongo-db -logLevel INFO
healthcheck:
test: curl --fail -s http://orion:${ORION_PORT}/version || exit 1
start_period: 40s
interval: 15m00s
timeout: 10s
retries: 3
# Keyrock is an Identity Management Front-End
keyrock:
......@@ -58,6 +62,10 @@ services:
- my_secret_data
healthcheck:
test: curl --fail -s http://localhost:${KEYROCK_PORT}/version || exit 1
start_period: 40s
interval: 15m00s
timeout: 10s
retries: 3
# PEP Proxy for Orion
orion-proxy:
......@@ -89,6 +97,10 @@ services:
- PEP_PROXY_PUBLIC_PATHS=/version
healthcheck:
test: curl --fail -s http://orion-proxy:${ORION_PROXY_PORT}/version || exit 1
start_period: 40s
interval: 15m00s
timeout: 10s
retries: 3
# Databases
mongo-db:
......@@ -179,10 +191,13 @@ services:
healthcheck:
test: curl --fail -s http://fiware-quantumleap:${QUANTUMLEAP_PORT}/v2/version || exit 1
start_period: 40s
interval: 1m30s
interval: 15m00s
timeout: 10s
retries: 3
# - - - services which act as clients of the NAIADES platform
wms-app-example:
build:
context: ./wms-example
......@@ -204,6 +219,61 @@ services:
ipv4_address: 172.18.1.11
healthcheck:
test: curl --fail -s http://wms-app-example:${WMS_MODULE_PORT}/healthcheck || exit 1
start_period: 40s
interval: 15m00s
timeout: 10s
retries: 3
weather-data-collection-carouge-raw:
build:
context: ./weather-data-collection-carouge
dockerfile: Dockerfile
image: weather-data-collection-carouge:latest
container_name: weather-data-collection-carouge-raw
environment:
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
- POST_DATA_PERIOD=3600 #3600sec = 1hour
- ORION_HOST=orion
- COLLECTION_DIR=/code/raw_data
volumes:
- ./weather-data-collection-carouge:/code:rw
networks:
default:
ipv4_address: 172.18.1.13
command: ./weather_00_collect_raw_weather_data_carouge
# healthcheck:
# test: curl --fail -s http://wms-app-example:${WMS_MODULE_PORT}/healthcheck || exit 1
# start_period: 40s
# interval: 15m00s
# timeout: 10s
# retries: 3
# weather-data-collection-carouge:
# build:
# context: ./weather-data-collection-carouge
# dockerfile: Dockerfile
# image: weather-data-collection-carouge:latest
# container_name: weather-data-collection-carouge
# environment:
# - LC_ALL=C.UTF-8
# - LANG=C.UTF-8
# - POST_DATA_PERIOD=15
# - ORION_HOST=orion
# volumes:
# - ./weather-data-collection-carouge:/code:rw
# networks:
# default:
# ipv4_address: 172.18.1.14
# command: ./weather_01_collect_and_post_weather_data_carouge.py
## healthcheck:
## test: curl --fail -s http://wms-app-example:${WMS_MODULE_PORT}/healthcheck || exit 1
## start_period: 40s
## interval: 15m00s
## timeout: 10s
## retries: 3
networks:
default:
......
......@@ -6,6 +6,5 @@ echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/subscriptions/" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
| python -mjson.tool
......@@ -8,4 +8,4 @@ echo "Querying Fiware entrypoint (PEP_PROXY) at: ${FIWARE_PROXY_HOST}"
curl -X GET \
"http://$FIWARE_PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc/value"\
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering"
--header "Fiware-ServicePath: /Watering"
......@@ -10,6 +10,6 @@ echo "Querying Fiware entrypoint (PEP_PROXY) at: ${FIWARE_PROXY_HOST}"
curl -X GET \
"http://$FIWARE_PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc/value"\
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
--header "X-Auth-Token: $KEYROCK_TOKEN"
......@@ -10,7 +10,7 @@ echo "Querying Fiware entrypoint (PEP_PROXY) at: ${FIWARE_PROXY_HOST}"
curl --location --request PUT \
"http://$FIWARE_PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc/value"\
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
--header "X-Auth-Token: $KEYROCK_TOKEN" \
--header "Content-Type: text/plain" \
-d $(( RANDOM % 10 ))
......
......@@ -17,7 +17,7 @@ echo "Callback URL for subscriptions is: ${SUBSCRIPTION_URL}"
curl --location --request POST \
"http://$ORION_HOST:1026/v2/subscriptions/" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "X-Auth-Token: $KEYROCK_TOKEN" \
......
......@@ -6,7 +6,7 @@ echo "Querying context broker at: ${ORION_HOST}"
curl -iX POST \
"http://$ORION_HOST:1026/v2/entities/" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
--header "Content-Type: application/json" \
--data '{
"id": "urn:ngsi-ld:FlowerBed:FlowerBed-345",
......
......@@ -6,5 +6,5 @@ echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/entities/" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
| python -mjson.tool
......@@ -6,5 +6,5 @@ echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345?options=keyValues" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
| python -mjson.tool
\ No newline at end of file
......@@ -6,11 +6,11 @@ echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc/value" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
| python -mjson.tool
#curl --location --request GET \
# "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/location/value" \
# --header "Fiware-Service: carouge" \
# --header "Fiware-ServicePath: /watering" \
# --header "Fiware-ServicePath: /Watering" \
# | python -mjson.tool
\ No newline at end of file
......@@ -6,11 +6,11 @@ echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
| python -mjson.tool
#curl --location --request GET \
# "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/location" \
# --header "Fiware-Service: carouge" \
# --header "Fiware-ServicePath: /watering" \
# --header "Fiware-ServicePath: /Watering" \
# | python -mjson.tool
\ No newline at end of file
......@@ -6,6 +6,6 @@ echo "Querying context broker at: ${ORION_HOST}"
curl --location --request PUT \
"http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc/value"\
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
--header "Content-Type: text/plain" \
-d $(( RANDOM % 10 ))
......@@ -10,7 +10,7 @@ echo "Callback URL for subscriptions is: ${SUBSCRIPTION_URL}"
curl --location --request POST \
"http://$ORION_HOST:1026/v2/subscriptions/" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Fiware-ServicePath: /Watering" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
......
{"city_info": {"name": "Carouge", "country": "Suisse", "latitude": "46.1838613", "longitude": "6.1385878", "elevation": "388", "sunrise": "05:56", "sunset": "21:06"}, "current_condition": {"date": "18.05.2020", "hour": "14:00", "tmp": 23, "wnd_spd": 17, "wnd_gust": 27, "wnd_dir": "NE", "pressure": 1017.6, "humidity": 45, "condition": "Ensoleill\u00e9", "condition_key": "ensoleille", "icon": "https://www.prevision-meteo.ch/style/images/icon/ensoleille.png", "icon_big": "https://www.prevision-meteo.ch/style/images/icon/ensoleille-big.png"}}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
# This is for building docker images for running the scripts
FROM python:3.8-slim-buster
MAINTAINER Federico Sismondi <fsismondi@udgalliance.org>
RUN apt-get update
RUN mkdir /code
WORKDIR /code
COPY requirements.txt requirements.txt
RUN pip install --timeout 300 -r requirements.txt
COPY . /code
CMD ["echo", "please override this CMD with some .sh or .py script call"]
# docker run -it --rm --name weather-data-collection-carouge --env ORION_HOST=10.81.6.109 naiades-client ./weather_02_get_all_raw_data.py
# docker run -it --rm --name weather-use-case-collection-carouge --env ORION_HOST=10.81.6.109 naiades-client ./security_01_get_token_with_password.sh
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment