Skip to content

Commit 54eb4b1

Browse files
committed
wip
1 parent e662a47 commit 54eb4b1

File tree

8 files changed

+173
-3
lines changed

8 files changed

+173
-3
lines changed

ansible/crowd-sourced-realtime.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-FileCopyrightText: 2025 Jonah Brüchert <[email protected]>
2+
#
3+
# SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+
- name: Set up MOTIS servers
6+
hosts: crowd-sourced-realtime
7+
roles:
8+
- crowd-sourced-realtime

ansible/roles/motis/templates/motis-update-feeds.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ chown -R motis:motis /var/lib/motis/data/
2222

2323
echo "Restarting MOTIS…"
2424
systemctl --no-ask-password restart motis.service
25+
systemctl --no-ask-password restart delay-tracker.service

ansible/roles/nginx/files/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ http {
2929
include /etc/nginx/mime.types;
3030
default_type application/octet-stream;
3131

32-
proxy_cache_path /var/cache/nginx max_size=10g keys_zone=motis:100m inactive=5d;
32+
proxy_cache_path /var/cache/nginx/motis/ max_size=10g keys_zone=motis:100m inactive=5d;
3333

3434
##
3535
# SSL Settings

ansible/roles/nginx/tasks/main.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
- nginx
2121
- certbot
2222

23-
- name: Create nginx cache directory
23+
- name: Create nginx motis cache directory
2424
file:
25-
path: /var/cache/nginx
25+
path: /var/cache/nginx/motis/
26+
state: directory
27+
28+
- name: Create nginx gtfsrt cache directory
29+
file:
30+
path: /var/cache/nginx/gtfsrt
2631
state: directory
2732

2833
- name: Install nginx config
@@ -58,6 +63,13 @@
5863
- address: 10.11.1.1:8080
5964
options: "backup"
6065

66+
- name: Install site config
67+
template:
68+
src: "crowd-sourced-realtime.conf.j2"
69+
dest: "/etc/nginx/sites-available/{{ vhost }}"
70+
vars:
71+
vhost: "crowdsourcing.transitous.org"
72+
6173
- name: Disable default site configuration
6274
file:
6375
path: /etc/nginx/sites-enabled/default
@@ -71,6 +83,7 @@
7183
with_items:
7284
- vhost: api.transitous.org
7385
- vhost: staging.api.transitous.org
86+
- vhost: crowdsourcing.transitous.org
7487

7588
- name: Reload nginx
7689
systemd:
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# SPDX-FileCopyrightText: 2025 Jonah Brüchert <jbb@kaidan.im>
2+
#
3+
# SPDX-License-Identifier: AGPL-3.0-or-later
4+
#
5+
6+
proxy_cache_path /var/cache/nginx/gtfsrt/ max_size=1g keys_zone=gtfsrt:20m;
7+
8+
server {
9+
listen 80;
10+
server_name {{ vhost }};
11+
12+
# For certbot
13+
location ^~ /.well-known/acme-challenge/ {
14+
root /var/www/html/;
15+
}
16+
17+
return 301 https://$host$request_uri;
18+
}
19+
20+
server {
21+
listen 443 http2 ssl;
22+
listen [::]:443 http2 ssl;
23+
24+
# Override TLS settings from included file
25+
ssl_protocols TLSv1.2 TLSv1.3;
26+
27+
ssl_ecdh_curve X25519:prime256v1:secp384r1;
28+
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305;
29+
ssl_prefer_server_ciphers off;
30+
31+
# see also ssl_session_ticket_key alternative to stateful session cache
32+
ssl_session_timeout 1d;
33+
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
34+
35+
# OCSP stapling
36+
ssl_stapling on;
37+
ssl_stapling_verify on;
38+
39+
server_name {{ vhost }};
40+
41+
ssl_certificate /etc/letsencrypt/live/api.transitous.org/fullchain.pem;
42+
ssl_certificate_key /etc/letsencrypt/live/api.transitous.org/privkey.pem;
43+
44+
charset UTF-8;
45+
46+
# For certbot
47+
location ^~ /.well-known/acme-challenge/ {
48+
root /var/www/html/;
49+
}
50+
51+
location ~ ^/gtfsrt/(?<feed_name>[^/]+)/trip-updates.pb {
52+
proxy_pass http://10.11.1.1:5002/$feed_name/trip-updates.pb;
53+
proxy_buffering on;
54+
proxy_cache gtfsrt;
55+
proxy_cache_revalidate off;
56+
proxy_cache_valid 200 304 5s;
57+
proxy_cache_lock on;
58+
}
59+
60+
location ~ ^/gtfsrt/(?<feed_name>[^/]+)/vehicle-positions.pb {
61+
proxy_pass http://10.11.1.1:5001/gtfsrt/$feed_name/vehicle-positions.pb;
62+
proxy_buffering on;
63+
proxy_cache gtfsrt;
64+
proxy_cache_revalidate off;
65+
proxy_cache_valid 200 304 5s;
66+
proxy_cache_lock on;
67+
}
68+
69+
location /api/v1/submit {
70+
proxy_pass http://10.11.1.1:5001/api/v1/submit;
71+
}
72+
73+
location / {
74+
add_header Content-Type text/html;
75+
return 200 '
76+
<h2>work in progress...</h2>
77+
<h3>Supported endpoints</h3>
78+
<p>
79+
<code>POST /api/v1/submit</code><br />
80+
81+
Example body:<br />
82+
<code>
83+
{"position": {"lat": 43.58199, "lon": 19.52472}, "motis_trip_id": "20250722_20:10_zpcg_237", "timestamp": 12345}
84+
</code>
85+
</p>
86+
<p>
87+
<code>GET /gtfsrt/{feed}/trip-updates.pb</code>
88+
</p>
89+
<p>
90+
<code>GET /gtfsrt/{feed}/vehicle-positions.pb</code>
91+
</p>';
92+
}
93+
}

configs/delay-tracker/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[server]
2+
address = "10.11.1.1:5001"

configs/gps-collector/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[server]
2+
address = "10.11.1.1:5002"

configs/motis/config.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-FileCopyrightText: 2024 Jonah Brüchert <[email protected]>
2+
#
3+
# SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+
server:
6+
host: 0.0.0.0
7+
port: 8080
8+
web_folder: "/opt/motis/ui/" # Just for testing, not used on server
9+
data_attribution_link: https://transitous.org/sources/
10+
11+
street_routing: true
12+
osr_footpath: false
13+
elevators: false
14+
geocoding: true
15+
reverse_geocoding: true
16+
17+
osm: planet-latest.osm.pbf
18+
19+
tiles:
20+
profile: /opt/motis/tiles-profiles/full.lua
21+
coastline: land-polygons-complete-4326.zip
22+
23+
timetable:
24+
first_day: TODAY
25+
num_days: 365
26+
railviz: true
27+
with_shapes: true
28+
ignore_errors: true
29+
adjust_footpaths: true
30+
merge_dupes_intra_src: true
31+
merge_dupes_inter_src: true
32+
link_stop_distance: 100
33+
update_interval: 60
34+
http_timeout: 30
35+
incremental_rt_update: false
36+
max_footpath_length: 12
37+
extend_missing_footpaths: true
38+
# The datasets are filled in by ./src/generate-motis-config.py
39+
datasets:
40+
41+
gbfs:
42+
feeds:
43+
44+
limits:
45+
stoptimes_max_results: 16384
46+
plan_max_results: 256
47+
plan_max_search_window_minutes: 5760
48+
stops_max_results: 2048
49+
onetoall_max_results: 524288
50+
onetoall_max_travel_minutes: 2880
51+
routing_max_timeout_seconds: 90

0 commit comments

Comments
 (0)