-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Prerequisites
You need a MySQL-Server with a single database for this tool. You need Python 3 installed.
Installation
- Download the backend-folder.
- Add all the database-credentials to the
connectionmanager.ini
andscheduler.ini
. - IMPORTANT: change the working directory in the
scheduler.py
and theconnectionmanager.py
to the current folder where the files are. - Run the
connectionmanager.py
once, that will create all the needed tables, do not regard the errors ^^. Make sure to use Python 3. - Insert stations into the table
bahn_monitoring_stations
. You just need to fill in the name, use the station name (e.g. "Berlin Hbf"). Do not use stations that are to far away from each other (more than one day driving time), else there might be some displaying errors. - Let the
connectionmanager.py
run every few minutes/hours (e.g. make a cronjob each 10 minutes). In the last line change the number in run = ConnectionManager(10), this number is the maximum of connections that are monitored. - Let the
scheduler.py
run very few minutes (e.g. every 3 minutes). Or rewrite it as a daemon.
Thats it, now the database should fill up with connections and prices.
In the frontend folder you will find a simple HTML/Javascript only application which can be thrown on basically every webserver out there. No php/external ressources needed.
In the api
folder you will find a python/falcon application which needs the following packages installed via apt / pip:
apt-get update && apt-get install python python-pip python-mysqldb -y
pip install gunicorn falcon orator
Also, the API needs to connect to the same database as the sheduler backend. You should have the mysql database set up at this point, so you can simply instert the host/username/database/password into the mysql.ini
config file in the config folder.
After that, the api can be started with the command provided in the startapi.sh:
gunicorn --workers 4 -b 0.0.0.0:8080 main:api -b [::1]:8080 --reload