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.
- Host: GitHub
- URL: https://github.com/derdp/chirpstack-postgresql-integration-api
- Owner: DerDP
- Created: 2024-10-29T16:41:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-06T11:52:00.000Z (over 1 year ago)
- Last Synced: 2025-08-01T03:52:07.456Z (9 months ago)
- Topics: chirpstack, postgresql
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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