htz.ex42-1048908: can haz travelynx?
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit

This commit is contained in:
Franzi 2020-08-19 18:43:32 +02:00
parent 20f3f566ac
commit 0dd2a4b985
Signed by: kunsi
GPG key ID: 12E3D2136B818350
5 changed files with 188 additions and 0 deletions

View file

@ -0,0 +1,57 @@
# vim:ft=perl
# travelynx.conf must be a valid perl hash reference. String values must be
# quoted and hash items must end with a comma. You can access environment
# variables via $ENV, e.g. by writing $ENV{TRAVELYNX_DB_HOST} instead of
# 'localhost'.
{
# Cache directories for schedule and realtime data. Mandatory. The parent
# directory ('/var/cache/travelynx' in this case) must already exist.
cache => {
schedule => '/var/cache/travelynx/iris',
realtime => '/var/cache/travelynx/iris-rt',
},
# Database configuration. host and port are optional
# (defaulting to localhost:5432), the rest is mandatory.
db => {
host => '${database.get('host', 'localhost')}',
port => 5432,
database => '${database['database']}',
user => '${database['username']}',
password => '${database['password']}',
},
# See the Mojo::Server::Hypnotoad manual for details on the following
# settings.
hypnotoad => {
accepts => 100,
clients => 10,
listen => [ 'http://127.0.0.1:8093' ],
pid_file => '/var/cache/travelynx/travelynx.pid',
workers => ${workers},
spare => ${spare_workers},
},
mail => {
# If you want to disable outgoing mail for development purposes,
# uncomment the following line. Mails will instead be logged as
# Mojolicious "info" messages, causing their content to be printed on
# stdout.
## disabled => 1,
# Otherwise, specify the sender ("From" field) for mail sent by travelynx
# here. E.g. 'Travelynx <mail@example.org>'
from => '${mail_from}',
},
# Secrets used for cookie signing and verification. Must contain at least
# one random string. If you specify several strings, the first one will
# be used for signing new cookies, and the remaining ones will still be
# accepted for cookie validation.
secrets => [
'${cookie_secret}',
],
version => qx{git describe --dirty} // 'experimental',
};

View file

@ -0,0 +1,21 @@
[Unit]
Description=Travelynx Railway Checkin Service
After=network.target
[Service]
Type=simple
RemainAfterExit=yes
PIDFile=/var/cache/travelynx/travelynx.pid
ExecStart=/usr/local/bin/hypnotoad -f index.pl
ExecStop=/usr/local/bin/hypnotoad -s index.pl
ExecReload=/usr/local/bin/hypnotoad index.pl
User=travelynx
WorkingDirectory=/opt/travelynx
Environment=LANG=en_US.UTF-8
Environment=PERL5LIB=/opt/travelynx/local/lib/perl5
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,73 @@
pkg_apt = {
'perl': {},
'cpanminus': {},
}
directories = {
'/var/cache/travelynx': {
'owner': 'travelynx',
'mode': '0700',
},
}
files = {
'/etc/systemd/system/travelynx.service': {
'triggers': {
'action:systemd-reload',
},
},
'/opt/travelynx/travelynx.conf': {
'content_type': 'mako',
'context': node.metadata['travelynx'],
'needs': {
'git_deploy:/opt/travelynx',
},
},
}
git_deploy = {
'/opt/travelynx': {
'repo': 'https://git.finalrewind.org/travelynx',
'rev': '1.16.1',
'triggers': {
'action:travelynx_install_deps',
'action:travelynx_database_migrate',
'svc_systemd:travelynx:restart',
},
},
}
actions = {
'travelynx_install_deps': {
'command': 'cd /opt/travelynx && cpanm -in --no-man-pages --installdeps .',
'needs': {
'pkg_apt:perl',
'pkg_apt:cpanminus',
},
'triggered': True,
},
'travelynx_database_migrate': {
'command': 'cd /opt/travelynx && perl index.pl database migrate',
# Because git_deploy does not put .git onto the server, the script
# will complain on STDERR about not finding a git repository.
# That's why we need to redirect stderr to /dev/null.
'unless': 'cd /opt/travelynx && [ $(perl index.pl database has-current-schema 2>/dev/null) = "yes" ]',
'needs': {
'action:travelynx_install_deps',
'file:/opt/travelynx/travelynx.conf',
'postgres_db:travelynx',
'postgres_role:travelynx',
},
'triggered': True,
},
}
svc_systemd = {
'travelynx': {
'needs': {
'file:/etc/systemd/system/travelynx.service',
'action:travelynx_database_migrate',
'directory:/var/cache/travelynx',
},
},
}

View file

@ -0,0 +1,31 @@
defaults = {
'users': {
'travelynx': {
'home': '/opt/travelynx',
'deploy_configs': False,
},
},
'travelynx': {
'database': {
'username': 'travelynx',
'password': repo.vault.password_for('{} postgresql travelynx'.format(node.name)),
'database': 'travelynx',
},
'workers': 4,
'spare_workers': 2,
'mail_from': 'travelynx@{}'.format(node.hostname),
'cookie_secret': repo.vault.password_for('{} travelynx cookie_secret'.format(node.name)),
},
'postgresql': {
'users': {
'travelynx': {
'password': repo.vault.password_for('{} postgresql travelynx'.format(node.name)),
},
},
'databases': {
'travelynx': {
'owner': 'travelynx',
},
},
},
}

View file

@ -6,6 +6,7 @@ nodes['htz.ex42-1048908'] = {
'nodejs', 'nodejs',
'riot-web', 'riot-web',
'postgresql', 'postgresql',
'travelynx',
'vmhost', 'vmhost',
'voc-loudness-monitor', 'voc-loudness-monitor',
}, },
@ -149,6 +150,11 @@ nodes['htz.ex42-1048908'] = {
'/': 'http://localhost:8080/', '/': 'http://localhost:8080/',
}, },
}, },
'travelynx.franzi.business': {
'proxy': {
'/': 'http://127.0.0.1:8093',
},
},
'vliedel.random.franzi.business': {}, 'vliedel.random.franzi.business': {},
'webmail.mx0.kunbox.net': { 'webmail.mx0.kunbox.net': {
'index': 'index.php', 'index': 'index.php',