PiSwitch_reporting/README.md

62 lines
1.3 KiB
Markdown
Raw Normal View History

2021-03-22 21:23:14 +01:00
# PiSwitch_Reporting
reporting server/API for the [PiSwitch](https://git.dennisvandermeulen.nl/dennis/PiSwitch)
## Installation Process
Clone the repository
```shell
git clone https://git.dennisvandermeulen.nl/dennis/PiSwitch_reporting.git
cd PiSwitch_reporting/
```
Setup virtual environment & install requirements (skip if you use Docker)
```shell
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
```
Setup config.ini
```shell
nano src/config.ini
```
setup database config
```ini
[database]
host =
user =
password =
db =
```
setup apikey for this server
```ini
[setup]
apikey = string
````
2021-04-13 19:46:39 +02:00
## Docker
2021-03-22 21:23:14 +01:00
use the included Dockerfile
```shell
docker run . -t piswitch/reporting -d -p 5000:5000
```
or build the dockerfile for use with [PiSwitch_frontend](https://git.dennisvandermeulen.nl/dennis/PiSwitch_frontend)
```shell
docker build . -t piswitch/reporting
```
## Systemd
Use the following script to automatically start the scripts at boot
````ini
[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