Commit bca16d48 authored by Federico Sismondi's avatar Federico Sismondi
Browse files

Updated docker-compose doc and scripts for a more-user friendly SDK.

parent 91c2b2ec
......@@ -20,9 +20,18 @@ KEYROCK_HTTPS_PORT=3443
MYSQL_DB_VERSION=5.7
MYSQL_DB_PORT=3307
# CrateDB variables
CRATE_VERSION=3.3.5
CRATE_PORT_GUI=4200
CRATE_PORT=4300
# PEP Proxy variables
WILMA_VERSION=7.8.1
ORION_PROXY_PORT=1027
# QuantumLeap Variables
QUANTUMLEAP_VERSION=0.7.5
QUANTUMLEAP_PORT=8668
# WMS mock module
WMS_MODULE_PORT=5000
# WARNING: Do not deploy this tutorial configuration directly to a production environment
#
# The tutorial docker-compose files have not been written for production deployment and will not
# scale. A proper architecture has been sacrificed to keep the narrative focused on the learning
# goals, they are just used to deploy everything onto a single Docker machine. All FIWARE components
# are running at full debug and extra ports have been exposed to allow for direct calls to services.
# WARNING! All FIWARE components are running at full debug and extra ports have been exposed to allow for direct calls
# to services.
# They also contain various obvious security flaws - passwords in plain text, no load balancing,
# no use of HTTPS and so on.
#
......@@ -31,7 +27,7 @@ services:
expose:
- "${ORION_PORT}"
ports:
- "${ORION_PORT}:${ORION_PORT}" # localhost:1026
- "${ORION_PORT}:${ORION_PORT}"
command: -dbhost mongo-db -logLevel DEBUG
healthcheck:
test: curl --fail -s http://orion:${ORION_PORT}/version || exit 1
......@@ -75,10 +71,10 @@ services:
ipv4_address: 172.18.1.10
depends_on:
- keyrock
ports:
- "${ORION_PROXY_PORT}:${ORION_PROXY_PORT}" # localhost:1027
expose:
- "${ORION_PROXY_PORT}"
ports:
- "${ORION_PROXY_PORT}:${ORION_PROXY_PORT}"
environment:
- PEP_PROXY_APP_HOST=orion
- PEP_PROXY_APP_PORT=${ORION_PORT}
......@@ -154,6 +150,44 @@ services:
secrets:
- my_secret_data
# db for timeseries (quantumleap)
crate-db:
image: crate:${CRATE_VERSION}
container_name: db-crate
networks:
default:
ipv4_address: 172.18.1.8
expose:
- "${CRATE_PORT_GUI}"
ports:
- "${CRATE_PORT_GUI}:${CRATE_PORT_GUI}" # Admin UI
- "${CRATE_PORT}:${CRATE_PORT_GUI}" # Transport protocol
command: crate -Clicense.enterprise=false -Cauth.host_based.enabled=false -Ccluster.name=democluster -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*"
volumes:
- crate-storage:/data
# Quantum Leap is persisting Short Term History to Crate-DB
quantumleap:
image: smartsdk/quantumleap:${QUANTUMLEAP_VERSION}
container_name: fiware-quantumleap
expose:
- "${QUANTUMLEAP_PORT}"
ports:
- "${QUANTUMLEAP_PORT}:${QUANTUMLEAP_PORT}"
depends_on:
- crate-db
networks:
default:
ipv4_address: 172.18.1.7
environment:
- CRATE_HOST=crate-db
healthcheck:
test: curl --fail -s http://fiware-quantumleap:${QUANTUMLEAP_PORT}/v2/version || exit 1
start_period: 40s
interval: 1m30s
timeout: 10s
retries: 3
wms-app-example:
build:
context: ./wms-example
......@@ -166,9 +200,9 @@ services:
- LANG=C.UTF-8
- FLASK_DEBUG=1
expose:
- ${WMS_MODULE_PORT}
- "${WMS_MODULE_PORT}"
ports:
- 5000:${WMS_MODULE_PORT}
- "${WMS_MODULE_PORT}:${WMS_MODULE_PORT}"
volumes:
- ./wms-example:/code
networks:
......@@ -185,6 +219,7 @@ networks:
volumes:
mysql-db: ~
mongo-db: ~
crate-storage: ~
secrets:
my_secret_data:
......
Some scripts depend previous execution of other scripts.
Please start by running `watering` scripts before using `security` scripts.
Getting started
---------------
Please read the doc before getting started.
- For a more complete explanation of the scripts included here please refer to the [oficial tutorial](https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2/index.html)
Some initial requirements:
- These scripts require docker-compose services to be up.
- Some scripts depend previous execution of other scripts, so please start by running `watering` scripts
before using `security` scripts.
- For a more complete explanation of the scripts included here please refer to the
[oficial tutorial](https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2/index.html)
- For those scripts related to security (authentication and authorization),
please refer to the [FIWARE-IDM documentation](https://fiware-idm.readthedocs.io/en/7.4.0/api/)
- `security` script use dummy user/pass, these will work on the SDK platform, but not the production one.
- For connecting to NAIADES platform using the security mechanisms please request credentials to the admins.
If any questions dont hesitate to drop me an email to fsismondi@udgalliance.org
......@@ -15,5 +15,5 @@ curl -iX POST \
echo
echo
echo "(!) Please export obtained <access_token> as KEYROCK_TOKEN, e.g. 'export KEYROCK_TOKEN=a0926276fc493fb5c423849bbf45cb5d7593dboo'"
echo "(!) Please export obtained <access_token> as KEYROCK_TOKEN, e.g. 'export KEYROCK_TOKEN=<put_the_received_access_token_here!>'"
echo
......@@ -15,3 +15,4 @@ curl --location --request PUT \
--header "Content-Type: text/plain" \
-d $(( RANDOM % 10 ))
echo "If you now re-run script <security_04...>.sh you will get a different value for the entity"
\ No newline at end of file
......@@ -7,7 +7,11 @@ echo "Querying Fiware entrypoint (PEP_PROXY) at: ${FIWARE_PROXY_HOST}"
[[ -z "$KEYROCK_TOKEN" ]] && echo "Please set KEYROCK_TOKEN env var. E.g. export KEYROCK_TOKEN=****" && exit
[[ -z "$SUBSCRIPTION_URL" ]] && echo "Please set SUBSCRIPTION_URL env var. E.g. export SUBSCRIPTION_URL=http://172.18.1.11:5000/on_change_soilMoistureVwc" && exit
[[ -z "$SUBSCRIPTION_URL" ]] &&
echo "Please set SUBSCRIPTION_URL env var. E.g. export SUBSCRIPTION_URL=http://172.18.1.11:5000/on_change_soilMoistureVwc" &&
echo "You can check out the wms-example source code for a server implementation example." &&
exit
echo "Callback URL for subscriptions is: ${SUBSCRIPTION_URL}"
curl --location --request POST \
......
#!/bin/sh
#!/usr/bin/env bash
[[ -z "$KEYROCK_HOST" ]] && echo "Please set KEYROCK_HOST env var. E.g. export KEYROCK_HOST=127.0.0.1" && exit
echo "Querying Identity Managed (Keyrock) at: ${KEYROCK_HOST}"
[[ -z "$KEYROCK_TOKEN" ]] && echo "Please set KEYROCK_TOKEN env var. E.g. export KEYROCK_TOKEN=****" && exit
curl -iX GET \
"http://$KEYROCK_HOST:3005/v1/oauth2/user?access_token=$KEYROCK_TOKEN" \
--header "X-Auth-Token: $KEYROCK_TOKEN" \
--header "Content-Type: application/json"
#curl -iX GET \
# "http://$KEYROCK_HOST:3005/v1/user?access_token=2YotnFZFEjr1zCsicMWpAA" \
# --header "Content-Type: application/json" \
......
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