The Smart City Resource Adaptation Layer (SCRAL) is a framework used in MONICA european project to manage several different kinds of IoT devices.
This file was written to explain how you can run a SCRAL module already developed or how to develop your own.
If you would like to start a ready-to-use SCRAL Docker Container, you can have a look to the quickstart containers that you can find on this Docker Hub repository. SCRAL was tested mainly with Python 3.6 so it is suggested to install at least that version.
_____ __________ ___ __
/ ___// ____/ __ \/ | / /
\__ \/ / / /_/ / /| | / /
___/ / /___/ _, _/ ___ |/ /___
/____/\____/_/ |_/_/ |_/_____/ Smart City Resource Adaptation Layer
(c) 2017-2020, LINKS Foundation
developed by Jacopo Foglietti & Luca Mannella
usage: SCRAL [-h] -p PILOT
arguments:
-h, --help
show this help message and exit
-p PREFERENCES_FOLDER, --preferences PREFERENCES_FOLDER
the name of the configuration folder
example: start_module.py -p MOVIDA
Have a look to config folder to find more details about SCRAL configuration parameter.
To better understand the MONICA environment and the SCRAL framework, you can have a look to the tutorials contained on the official MONICA website. In particular, to start using SCRAL it is suggested to follow this tutorial, meanwhile to start developing your own SCRAL module, you can read this other tutorial.
As you can see in the UML Class diagram, when you start developing a new SCRAL module, it is usually necessary to develop at least two methods, the first one for the registration of new datastreams, and the second one for the management of the Observation. If you will not extend the SCRALRestModule, it will be mandatory also to write your own "runtime" method.
To deploy a new SCRAL image, modify to your needs one of the dockerfile already contained in each module folder.
To start using SCRAL is strongly suggest to take a Docker image "as is" and to configure properly the environmental
variables.
An update list of the configurable variable is available in the
Docker hub repository.
The SCRAL source code is available in MONICA project repository. It is possible to fork (or simply download) the repository and start working directly on the source code.
To start working with SCRAL is necessary to have Docker installed on your machine. To install the proper version for your operating system, have a look to the Docker documentation page.
SCRAL depends on the GOST server, a Go implementation of the Sensing OGC SensorThings API. To learn more about OGC and GOST visit the GOST GitHub page or the MONICA tutorial about OGC Historical Data Retrieval & Visualizations.
To start GOST, you need the docker-compose file that you can download from GOST repository or the file "docker-compose-gost.yml" contained inside the "docker-compose" folder of SCRAL repository. Once you have the file, from the directory in which the file is stored, you can execute the following command:
$ docker-compose -f docker-compose-gost.yml up -d
To work properly SCRAL requires the following Python packages (with the recommended versions):
- Eclipse Paho 1.5
- Flask 1.0.2
- CherryPy 18.1.0
- arrow 0.14.2 (arrow 0.15 not supported)
- requests 2.22.0
- configparser 3.7.1
SCRAL does not have at the moment a test suite.
Feel free to contribute if you want! :)
SCRAL is mainly written in Python 3 (that is an interpreted language) and so it could just be started without building anything.
Contributions are welcome.
Please fork, make your changes, and submit a pull request. For major changes, please open an issue first and discuss it with the other authors.
Copyright © 2017-2020 Jacopo Foglietti and Luca Mannella for LINKS Foundation.
SCRAL is licensed under the Apache 2 License (click here for details).
This work is supported by the European Commission through the MONICA H2020 PROJECT under grant agreement No 732350.