This is an experimental project using FastAPI and TimescaleDB as backend application for IoT sensors monitoring applications. The main purpose of this project is:
- to allow for automatic onboarding of new sensor devices/nodes to the sensors network database.
- handle a large number of API requests asynchronously.
- leverage Postgres for both realational and timeseries data use-cases.
- Python 3.10 and above. Version 3.13.0 was used for this project.
- Have TimescaleDB installed by follwing this guide. A Docker instance is preferrable.
- Create a virtual environment
python -m venv .venvand activatesource .venv/bin/activate - Install dependencies
pip install -r requirements.txt - Create a
.envfile and set the environment variables as per the.env.template - Run the app
fastapi dev main.py - Run the simulation script in another terminal
python sensors_simulate.py
- Run
docker compose up -dto build and run the services. Override the default environment variables with the-eflag. - Run the the simulation script by entering the
apiservice container's shell.
docker exec -it <container id> /bin/bashpython sensors_simulate.py