arichadda / edgetech-couchdb-saver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Forks Stargazers Issues MIT License


Logo

EdgeTech-CouchDB-Saver

This repo builds upon the IQT Labs EdgeTech-Core functionality to instantiate an MQTT client that subscribes to sensor, telemetry, audio filename topics to write them to a local CouchDB instance after checking the validity of the JSON being pushed. All of this functionality is wrapped in a Docker container for cross-platform compatibility.

Make Contribution · Report Bug · Request Feature

Built With

Python Poetry Docker

Getting Started

To run this repo, simply run:

docker-compose up

The couchDB saver is containerized and dependencies are managed using poetry.

Prerequisites

Running this repo requires that you have Docker installed.

Usage

Spinning up this system requires an MQTT server and this container to be included in your docker-compose.yml. You can find an example of this workflow in this repository's docker-compose.yml. Additionally, some editing of relevant environment variables will be required based upon your system's configuration of topics to subscribe to and MQTT configuration. Examples of these environment variables can be found in this repository's .env file.

As this system is meant to be spun up with MQTT topics you would like to write to the database, copying the couchdb-saver docker-compose statements into a master docker-compose.yml and .env files with your entire system of containers is the preferred workflow. Find an application architecture diagram example of how the usage of this module was envisioned below.

flowchart TD
    telemetrydata(Telemetry Data) -- Telemetry Topic --> mqtt{MQTT}
    sensordata(Sensor Data) -- Sensor Topic --> mqtt{MQTT}
    audiofilename(Audio File Name) -- Audio File Name --> mqtt{MQTT}
    mqtt{MQTT} -- Subscribed to Telemetry Topic, Sensor Topic, and Audio File Name Topic --> couchdbsaver(CouchDB Saver)
    couchdbsaver(CouchDB Saver) -- Write to Database --> couchdbserver(CouchDB Server)
    couchdbstartup(CouchDB Startup) -- Initalized Connection --> couchdbserver(CouchDB Server)
    couchdbstartup(CouchDB Startup) -- Initalized Connection --> couchdbremote[Cloud-Hosted CouchDB Server]
    couchdbserver(CouchDB Server) -- Sync Data with External Databse --> couchdbremote[Cloud-Hosted CouchDB Server]

style mqtt fill:#0072bc,color:#ffffff
style couchdbsaver fill:#F9D308,color:#ffffff
style telemetrydata fill:#80c342,color:#ffffff
style audiofilename fill:#80c342,color:#ffffff
style sensordata fill:#80c342,color:#ffffff
style couchdbstartup fill:#6657d3,color:#ffffff
style couchdbserver fill:#6657d3,color:#ffffff
style couchdbremote fill:#5f6475,color:#ffffff

Loading

Roadmap

  • TBA

See the open issues for a full list of proposed features (and known issues).

Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b dev)
  3. Commit your Changes (git commit -m 'adding some feature')
  4. Run (and make sure they pass):
black --diff --check *.py

pylint --disable=all --enable=unused-import *.py

mypy --allow-untyped-decorators --ignore-missing-imports --no-warn-return-any --strict --allow-subclassing-any *.py

If you do not have them installed, you can install them with pip install "black<23" pylint==v3.0.0a3 mypy==v0.991.

  1. Push to the Branch (git push origin dev)
  2. Open a Pull Request

See CONTRIBUTING.md for more information.

License

Distributed under the Apache 2.0. See LICENSE.txt for more information.

Contact IQTLabs

See our other projects: https://github.com/IQTLabs/

(back to top)

About

License:Apache License 2.0


Languages

Language:Python 96.0%Language:Dockerfile 4.0%