From b6b2f9926512b4bafa91b40bfe9bf3ba52abb4bb Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 30 Dec 2018 13:40:47 +0100 Subject: add README and example unit file --- Build.PL | 5 ++-- README.md | 52 +++++++++++++++++++++++++++++++++++++++++ examples/vrr-infoscreen.service | 21 +++++++++++++++++ 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 README.md create mode 100644 examples/vrr-infoscreen.service diff --git a/Build.PL b/Build.PL index ef1f625..d46cfb2 100755 --- a/Build.PL +++ b/Build.PL @@ -25,8 +25,9 @@ Module::Build->new( 'DateTime::Format::Strptime' => 0, 'GD' => 0, 'Mojolicious::Lite' => 0, - 'Travel::Status::DE::DeutscheBahn' => 1.01, - 'Travel::Status::DE::VRR' => 1.04, + 'Travel::Status::DE::EFA' => 1.15, + 'Travel::Status::DE::HAFAS' => 2.03, + 'Travel::Status::DE::URA' => 2.01, }, sign => 1, dist_version_from => 'index.pl', diff --git a/README.md b/README.md new file mode 100644 index 0000000..5d0c073 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# vrr-infoscreen - Infoscreen for Public Transit Departures + +[vrr-infoscreen homepage](https://finalrewind.org/projects/vrr-fakedisplay/) + +vrr-infoscreen (formerly vrr-fakedisplay) shows departures at a public transit +stop, serving both as infoscreen / webapp and LED departure monitor look-alike. + +It supports most german local transit networks and also some austrian ones. + +There's a public [vrr-infoscreen service on +finalrewind.org](https://vrrf.finalrewind.org/). You can also host your own +instance, see the Setup notes below. + +## Dependencies + + * perl ≥ 5.10 + * Cache::File (part of the Cache module) + * DateTime + * DateTime::Format::Strptime + * File::ShareDir + * GD + * Mojolicious + * Travel::Status::DE::EFA ≥ 1.15 + * Travel::Status::DE::HAFAS ≥ 2.03 + * Travel::Status::DE::URA ≥ 2.01 + +## Setup + +First, build App::VRR::Fakedisplay which is required for the LED frontend: + +* perl Build.PL +* ./Build +* ./Build manifest +* sudo ./Build install + +vrr-infoscreen is configured via environment variables: + +| Variable | Default | Description | +| :------- | :------ | :---------- | +| VRRFAKEDISPLAY\_LISTEN | `http://127.0.0.1:8091` | IP and Port for web service | +| VRRFAKEDISPLAY\_STATS | _None_ | File in which the total count of (non-cached) backend API requests is written | +| VRRFAKEDISPLAY\_CACHE | `/tmp/vrr-fakedisplay` | Cache directory | +| VRRFAKEDISPLAY\_WORKERS | 2 | Number of concurrent worker processes | + +Set these as needed, create `templates/imprint.html.ep` (imprint) and +`templates/privacy.html.ep` (privacy policy), and configure your web server to +pass requests for vrr-infoscreen to the appropriate port. + +You can run the app using a Mojo::Server of your choice, e.g. **perl +index.pl daemon -m production** (quick&dirty, does not respect all variables) +or **hypnotad** (recommended). A systemd unit example is provided in +`examples/vrr-infoscreen.service`. diff --git a/examples/vrr-infoscreen.service b/examples/vrr-infoscreen.service new file mode 100644 index 0000000..39b3171 --- /dev/null +++ b/examples/vrr-infoscreen.service @@ -0,0 +1,21 @@ +[Unit] +Description=vrrf.finalrewind.org +After=network.target + +[Service] +Type=simple +RemainAfterExit=yes +PIDFile=/tmp/vrr-fakedisplay.pid +ExecStart=/usr/bin/hypnotoad -f index.pl +ExecStop=/usr/bin/hypnotoad -s index.pl +ExecReload=/usr/bin/hypnotoad index.pl +User=vrr-fakedisplay +WorkingDirectory=/srv/www/vrr-fakedisplay +Environment=LANG=en_US.UTF-8 +Environment=VRRFAKEDISPLAY_LISTEN=http://127.0.0.1:8091 +Environment=VRRFAKEDISPLAY_WORKERS=1 +Environment=VRRFAKEDISPLAY_STATS=/tmp/vrrf-api-stats +Environment=VRRFAKEDISPLAY_CACHE=/var/cache/vrrf/main + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3