Skip to content
This repository has been archived by the owner on May 31, 2022. It is now read-only.

Installation

Cubicroot edited this page Sep 7, 2019 · 2 revisions

Installation (English)

Backend

Prerequisites

You need a MySQL-Server with a single database for this tool. You need Python 3 installed.

Installation

  1. Download the backend-folder.
  2. Add all the database-credentials to the connectionmanager.ini and scheduler.ini.
  3. IMPORTANT: change the working directory in the scheduler.py and the connectionmanager.py to the current folder where the files are.
  4. Run the connectionmanager.py once, that will create all the needed tables, do not regard the errors ^^. Make sure to use Python 3.
  5. 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.
  6. 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.
  7. 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.

Frontend

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.

API

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

Clone this wiki locally