Skip to content

Commit

Permalink
Import ansible playbook for the server
Browse files Browse the repository at this point in the history
  • Loading branch information
jbruechert committed Feb 10, 2024
1 parent 51053dc commit bfc8dd6
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ansible/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2024 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

motis:
hosts:
spline-vm-motis:
ansible_user: root
ansible_host: 130.133.110.196
14 changes: 14 additions & 0 deletions ansible/motis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2024 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- name: Set up MOTIS servers
hosts: motis
roles:
- motis
tasks:
- name: Install rsync
apt:
name:
- rsync
- htop
36 changes: 36 additions & 0 deletions ansible/roles/motis/files/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPDX-FileCopyrightText: 2024 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

modules=intermodal
#modules=address
#modules=tiles
#modules=osrm
#modules=ppr
#modules=parking
modules=nigiri

intermodal.router=nigiri
server.static_path=/opt/motis/web
dataset.no_schedule=true


[import]
#paths=osm:europe-latest.osm.pbf
paths=osm:aachen.osm.pbf
paths=schedule-de-berlin:vbb.fixed.zip
paths=schedule-lv-pv:pv.zip
paths=schedule-lv-rigas-satiksme:improved-gtfs-satiksme.zip
paths=schedule-lv-rigas-saraksti:improved-gtfs-saraksti.zip
paths=schedule-lt:lt.zip
paths=schedule-lt-all:lt-all.zip

[osrm]
profiles=/opt/motis/osrm-profiles/car.lua
profiles=/opt/motis/osrm-profiles/bike.lua

[ppr]
profile=/opt/motis/ppr-profiles/default.json

[tiles]
profile=/opt/motis/tiles-profiles/background.lua
17 changes: 17 additions & 0 deletions ansible/roles/motis/files/motis.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2024 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

[Unit]
Description=MOTIS public transport router
After=network-online.target

[Service]
Type=simple
ExecStart=/opt/motis/motis -c /var/lib/motis/config.ini
Restart=always
User=motis
WorkingDirectory=/var/lib/motis

[Install]
WantedBy=multi-user.target
43 changes: 43 additions & 0 deletions ansible/roles/motis/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: 2024 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

- name: Create MOTIS user
user:
name: motis

- name: Unpack MOTIS
unarchive:
src: https://github.com/motis-project/motis/releases/download/v0.11.14/motis-linux-amd64.tar.bz2
dest: /opt/
remote_src: yes

- name: Create MOTIS runtime directory
file:
path: /var/lib/motis
owner: motis
group: motis
state: directory

- name: Copy MOTIS config file
copy:
src: config.ini
dest: /var/lib/motis/config.ini

- name: Copy MOTIS systemd service
copy:
src: motis.service
dest: /etc/systemd/system/motis.service

# - name: Download Europe
# get_url:
# url: https://download.geofabrik.de/europe-latest.osm.pbf
# dest: /var/lib/motis/europe-latest.osm.pbf

- name: Enable motis systemd service
systemd:
name: motis.service
enabled: true
state: started
masked: false
daemon_reload: true

0 comments on commit bfc8dd6

Please sign in to comment.