Skip to content
Snippets Groups Projects
README.md 8.77 KiB

travelynx - Railway Travel Logger

travelynx allows checking into and out of individual trains, thus providing a log of your railway journeys annotated with real-time delays and service messages. At the moment, it only supports german railways and trains which are exposed by the Deutsche Bahn IRIS Interface.

You can use the public instance on travelynx.de or host your own via carton. Experimental Docker images are also available. See the Setup notes below.

Dependencies

  • perl >= 5.20
  • carton
  • build-essential
  • libpq-dev
  • git

Installation

travelynx depends on a set of Perl modules which are documented in cpanfile. After installing the dependencies mentioned above, you can use carton to install Perl depenencies locally. You may alsobe able to use cpanminus; however this method is untested.

In the project root directory (where cpanfile resides), run

carton install --deployment

and set PERL5LIB=.../local/lib/perl5 before executing any travelynx commands (see configs in the examples directory) or wrap them with carton exec, e.g. carton exec hypnotoad index.pl

Setup

First, you need to set up a PostgreSQL database so that travelynx can store user accounts and journeys. It must be at least version 9.4 and must use a UTF-8 locale. The following steps describe setup on a Debian 9 system; setup on other distributions should be similar.

  • Write down a strong random password
  • Create a postgres user for travelynx: sudo -u postgres createuser -P travelynx (enter password when prompted)
  • Create the database: sudo -u postgres createdb -O travelynx travelynx
  • Copy examples/travelynx.conf to the application root directory (the one in which index.pl resides) and edit it. Make sure to configure db, cache, mail, and secrets.
  • Initialize the database: carton exec perl index.pl database migrate or PERL5LIB=local/lib/perl5 perl index.pl database migrate

Your server also needs to be able to send mail. Set up your MTA of choice and make sure that the sendmail binary can be used for outgoing mails. Mail reception on the server is not required.

Finally, configure the web service:

  • Set up a travelynx service using the service supervisor of your choice (see examples/travelynx.service for a systemd unit file)
  • Configure your web server to reverse-provy requests to the travelynx instance. See examples/nginx-site for an nginx config.
  • Install a timeout 5m perl index.pl work -m production cronjob. It is used to update realtime data and perform automatic checkout and should run every three minutes or so, see examples/cron.

You can now start the travelynx service, navigate to the website and register your first account. There is no admin account, all management is performed via cron or (in non-standard cases) on the command line.

Please open an issue on https://github.com/derf/travelynx/issues or send a mail to derf+travelynx@finalrewind.org if there is anything missing or ambiguous in this setup manual.

Updating

It is recommended to run travelynx directly from the git repository. When updating, the workflow depends on whether schema updates need to be applied or not.