An open API service indexing awesome lists of open source software.

https://github.com/derdp/chirpstack-postgresql-integration-api

The chirpstack-postgresql-integration-api repository provides middleware API integration for Chirpstack with PostgreSQL, using FastAPI.
https://github.com/derdp/chirpstack-postgresql-integration-api

chirpstack postgresql

Last synced: 2 months ago
JSON representation

The chirpstack-postgresql-integration-api repository provides middleware API integration for Chirpstack with PostgreSQL, using FastAPI.

Awesome Lists containing this project

README

          

# Introduction

API Middelware for the PostgreSQL Chirpstack integration.
Swagger page is available at /docs web path.

## Prerequisites

- Python 3.8+
- Chirpstack with PostgreSQL integration
- Environment setup for the API key and database connection string

# Getting Started

1. Clone the Repository:
```bash
git clone https://github.com/DerDP/chirpstack-postgresql-integration-api
cd chirpstack-postgresql-integration-api/code
2. Install Dependencies:
```bash
pip install -r requirements.txt
```
3. Set the following environment variables in your environment:
- `API_KEY`: The API key for access to the endpoints.
- `DATABASE_URL`: The PostgreSQL connection URL (e.g., `postgresql://user:password@localhost:5432/database_name`).
- Or Adjust `code/app/.env` file
4. Database Setup:
- Ensure that your PostgreSQL database is running and contains the event_up table with a schema matching the `SensorData` model.

# Run locally

From folder `code/` execute:

uvicorn app.main:app --reload

# Run in Docker

You can build the docker image from `code/` folder using the following command:

docker build -t fastapi-chirpstack:latest --no-cache .

To test run docker container, run the following command:

```
docker run -d \
--name fastapi-chirpstack \
-e DATABASE_URL="" \
-e API_KEY="" \
-p 8000:8000 \
fastapi-chirpstack:latest
```

# k8s deployment
Adjust the deploy.sh and yaml files in `k8s/` folder and run following commands (populate `code/app/.env` as secret is created with these values):

```bash
chmox +x deploy.sh
./deploy.sh