Go to file
2021-06-20 12:19:35 +02:00
iot_data Let data get expired. 2021-06-20 12:19:35 +02:00
LICENSE Initial commit 2021-06-19 11:05:35 +02:00
README.md Let data get expired. 2021-06-20 12:19:35 +02:00
requirements.txt Initial commit 2021-06-19 11:05:35 +02:00
setup.py Initial commit 2021-06-19 11:05:35 +02:00

IOT Data

Just a tiny service for posting small datasets to a server which can get fetched by other services afterwards.

It just keeps the data in RAM so it is definetely not for big stuff and log term storages.

Usage

Read data:

curl http://iot-data.clerie.de/data/sensor1/

Write data:

curl -X POST -d 'hello world!'' -H 'Content-Type: text/plain' http://iot-data.clerie.de/ingress/asdf1234/

Content type is considered too:

curl -X POST -d '{"key": "value"}' -H 'Content-Type: application/json' http://iot-data.clerie.de/ingress/asdf1234/

Check for the last data input with the Last-Modified header.

Deployment

Init codebase

git clone https://github.com/clerie/iot-data.git
cd iot-data/
virtualenv -p python3 ENV
cd ..

Create config.json with the following contents and edit values for your needs:

{
  "sensor1": {
    "key": "asdf1234"
  },
  "sensor2": {
    "key": "supersecret",
    "delete-after": 60
  },
}

delete-after: Specifies the seconds after which the data gets discarded and no data is returned.

Starten und updaten lässt sich die Flask-App folgendermaßen:

cd iot-data/
git pull
source ENV/bin/activate
pip install -r requirements.txt
IOT_DATA_CONFIG=/path/to/config.json gunicorn iot_data:app
deactivate