PiSwitch_reporting/README.md

1.3 KiB

PiSwitch_Reporting

reporting server/API for the PiSwitch

Installation Process

Clone the repository

git clone https://git.dennisvandermeulen.nl/dennis/PiSwitch_reporting.git
cd PiSwitch_reporting/

Setup virtual environment & install requirements (skip if you use Docker)

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

Setup config.ini

nano src/config.ini

setup database config

[database]
host = 
user = 
password = 
db = 

setup apikey for this server

[setup]
apikey = string

##Docker use the included Dockerfile

docker run . -t piswitch/reporting -d -p 5000:5000

or build the dockerfile for use with PiSwitch_frontend

docker build . -t piswitch/reporting

Systemd

Use the following script to automatically start the scripts at boot

[Unit]
Description=PiSwitch Reporting server
After=multi-user.target

[Service]
Type=simple
User=
Group=
WorkingDirectory=/path/to/PiSwitch_reporting/src
ExecStart=/path/to/venv/bin/python3 path/to/PiSwitch_reporting/src/server.py

[Install]
WantedBy=multi-user.target

save as PiSwitch_reporting.service