Open wkulesza opened 2 years ago
It seems like you are neither passing configuration parameters nor do you have the config.ini
file.
I wrote a small setup script for you:
#!/bin/sh
MOTIS_URL=https://github.com/motis-project/motis/releases/latest/download/motis-linux-amd64.tar.bz2
SCHEDULE_URL=https://opentransportdata.swiss/dataset/55b617c1-7241-4254-b243-0352d5523f6f/resource/54262e6d-04df-4d7d-bdb2-b6d173a49d0a/download/4_tu_ch_oev_sammlung_ch__2021_20211208_201836.zip
OSM_URL=https://download.geofabrik.de/europe/switzerland-latest.osm.pbf
# Create folder.
mkdir -p motis-swiss/data/hrd
cd motis-swiss
# Download and unpack MOTIS.
wget $MOTIS_URL
tar -xf motis-linux-amd64.tar.bz2
# Download and unpack timetable.
wget $SCHEDULE_URL
unzip 4_tu_ch_oev_sammlung_ch__2021_20211208_201836.zip -d data/hrd
# Download OSM data
wget -P data $OSM_URL
# Write config.ini
echo "\
server.static_path=motis/web\n\
dataset.begin=20211201\n\
\n\
[import]\n\
paths=schedule:data/hrd\n\
paths=osm:data/switzerland-latest.osm.pbf\n\
data_dir=data\n\
\n\
[osrm]\n\
profiles=motis/osrm-profiles/car.lua\n\
profiles=motis/osrm-profiles/bike.lua\n\
profiles=motis/osrm-profiles/bus.lua\n\
\n\
[ppr]\n\
profile=motis/ppr-profiles/default.json\n\
\n\
[tiles]\n\
profile=motis/tiles-profiles/background.lua\n\
\n" > config.ini
# Start MOTIS
./motis/motis
Please copy this script into a file setup-motis-swiss.sh
, make it executable chmod +x setup-motis-swiss.sh
and run it ./setup-motis-swiss.sh
.
Edit: oops, made a mistake with unpacking the HRD data. Fixed now.
Thanks @felixguendling - this script did the trick. I can see Motis running on 8080. Two quick questions:
MOTIS can load GTFS and handles GTFS-RT in real-time. Do you have an URL for your feeds?
We run MOTIS detached either via docker compose
(see here or via SystemD service unit. I can post our systemd configuration later.
Yes, we could start with official feeds for Poznan: newest is here: https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20211214_20211217.zip trip updates are here: https://www.ztm.poznan.pl/pl/dla-deweloperow/getGtfsRtFile/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZXN0Mi56dG0ucG96bmFuLnBsIiwiY29kZSI6MSwibG9naW4iOiJtaFRvcm8iLCJ0aW1lc3RhbXAiOjE1MTM5NDQ4MTJ9.ND6_VN06FZxRfgVylJghAoKp4zZv6_yZVBu_1-yahlo&file=trip_updates.pb
We switched to docker compose
for all our MOTIS instances.
But here are the systemd unit files. They belong to /etc/systemd/system
.
motis.service
[Unit]
Description=Motis
After=network.target
[Service]
Restart=always
RestartSec=15
TimeoutStartSec=300
User=motis
Group=motis
WorkingDirectory=/home/motis
ExecStart=/home/motis/motis/motis -c /root/motis/config.ini
[Install]
WantedBy=multi-user.target
motis-restart.timer
[Unit]
Description=Restart MOTIS
RequisiteOverridable=motis-restart.service
[Timer]
OnCalendar=*-*-* 03:30:00
Persistent=false
[Install]
WantedBy=timers.target
motis-restart.service
[Unit]
Description=Restart MOTIS
[Service]
Type=oneshot
ExecStart=/bin/systemctl restart motis
Enable timer: systemctl enable motis-restart.timer
Enable MOTIS autostart: systemctl enable motis
Start MOTIS: systemctl start motis
This files assume that you have user named motis
that has a home directory at /home/motis
with the usual MOTIS setup.
I adapted the script for the Poznan data:
#!/bin/sh
MOTIS_URL=https://github.com/motis-project/motis/releases/latest/download/motis-linux-amd64.tar.bz2
SCHEDULE_URL=https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20211214_20211217.zip
OSM_URL=https://download.bbbike.org/osm/bbbike/Poznan/Poznan.osm.pbf
# Create folder.
mkdir -p motis-poznan/data/gtfs
mkdir -p motis-poznan/data/gtfs-rt
cd motis-poznan
# Download and unpack MOTIS.
wget $MOTIS_URL
tar -xf motis-linux-amd64.tar.bz2
# Download and unpack timetable.
wget $SCHEDULE_URL
unzip index.html?file=20211214_20211217.zip -d data/gtfs
touch data/gtfs/transfers.txt
# Download OSM data
wget -P data $OSM_URL
# Write config.ini
echo "\
modules=intermodal\n\
modules=routing\n\
modules=rt\n\
modules=ris\n\
modules=railviz\n\
modules=path\n\
modules=lookup\n\
modules=address\n\
modules=guesser\n\
modules=tiles\n\
modules=osrm\n\
modules=ppr\n\
modules=parking\n\
\n\
server.static_path=motis/web\n\
dataset.begin=20211214\n\
\n\
[import]\n\
paths=schedule:data/gtfs\n\
paths=osm:data/Poznan.osm.pbf\n\
data_dir=data\n\
\n\
[osrm]\n\
profiles=motis/osrm-profiles/car.lua\n\
profiles=motis/osrm-profiles/bike.lua\n\
profiles=motis/osrm-profiles/bus.lua\n\
\n\
[ppr]\n\
profile=motis/ppr-profiles/default.json\n\
\n\
[tiles]\n\
profile=motis/tiles-profiles/background.lua\n\
\n\
[ris]\n\
gtfsrt.is_addition_skip_allowed=false\n\
instant_forward=true\n\
input=data/gtfs-rt\n\
init_time=NOW\n\
\n" > config.ini
# Start MOTIS
./motis/motis
For GTFS-RT, you need to run this script additionally to MOTIS:
#!/bin/bash
while true; do
filename="data/gtfs-rt/$(date +%Y%m%d-%H%M%S).pb"
curl -X GET -H "Content-type: application/octet-stream" -o "$filename" https://www.ztm.poznan.pl/pl/dla-deweloperow/getGtfsRtFile/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0ZXN0Mi56dG0ucG96bmFuLnBsIiwiY29kZSI6MSwibG9naW4iOiJtaFRvcm8iLCJ0aW1lc3RhbXAiOjE1MTM5NDQ4MTJ9.ND6_VN06FZxRfgVylJghAoKp4zZv6_yZVBu_1-yahlo&file=trip_updates.pb
echo "$i" "$filename"
curl --insecure https://localhost:8080/ris/read
sleep 30
done
The GTFS-RT feed does only contain coordinate updates for the vehicles:
{
id: "9115"
trip_update {
trip {
trip_id: "1_12179^D"
schedule_relationship: SCHEDULED
route_id: "901"
}
stop_time_update {
stop_sequence: 0
arrival {
delay: -310
}
schedule_relationship: SCHEDULED
}
vehicle {
id: "9115"
label: "901/2"
}
timestamp: 1639509290
}
}
{
id: "9102"
vehicle {
trip {
trip_id: "1_12204^D"
schedule_relationship: SCHEDULED
route_id: "901"
}
position {
latitude: 52.4793
longitude: 16.8603096
speed: 3.06
}
current_stop_sequence: 4
timestamp: 1639509288
vehicle {
id: "9102"
label: "901/3"
}
}
}
These are currently not supported by MOTIS.
MOTIS only supports timetable updates like event time changes, reroutings, additional services, etc.
@felixguendling great stuff. It works with poznan data. We would be anxious to help out to work on this. Maybe we could do something together on this - have you heard about OneBusAway ? trip updates from GTFS-RT would be real-time info on actual position/ schedule adherence from GTFS timetables - so this could show how does the vehicle actually behave in terms of being ontime/early/late.
Always happy to join forces! :sunglasses:
But I'm not exactly sure what you're proposing.
Feel free to reach out to me guendling@cs.tu-darmstadt.de
.
Hello Felix,
I just stumbled upon Motis and tried to run it using your setup-motis-swiss.sh
script above. It runs for a while but then fails with
address: FINISHED
osrm-bike: FINISHED
osrm-bus: FINISHED
osrm-car: FINISHED
parking: WAITING: {"PPR", "SCHEDULE"}
path: WAITING: {"OSRM", "SCHEDULE"}
paxmon: WAITING: {"SCHEDULE"}
ppr: [■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ] 84% | Graph Serialization
schedule: FINISHED
tiles: WAITING: {"OSM"}
tripbased: WAITING: {"SCHEDULE"}
fish: Job 1, './motis/motis' terminated by signal SIGBUS (Misaligned address error)
Do you know why this might be? This is on a 64-bit Linux system.
This could be caused by running AVX instructions on a (potentially virtualized) CPU that doesn't support AVX. Maybe we could eliminate this problem source by using this binary for now: https://github.com/motis-project/motis/releases/download/v0.6.3/motis-linux-amd64-noavx.tar.bz2
Would be happy to hear whether that helps! 😃
It appears that I was just running out of disk space. Now I have it running. Thanks for your help!
Hi, great project, I love the demo. Tried recreating all steps mentioned here https://motis-project.de/docs/install using Switzerland data. I grabbed the code and extracted (directory structure same as suggested) Created data folder Within data folder, I created hrd folder, where i added 4_tu_ch_oev_sammlung_ch__2021_20211201_203455.zip file , within data folder, there's also switzerland-latest.osm.pbf file and log folder, whre txt empty files have been created.
When tring to run motis from root folder i get:
Running on Ubuntu 18.04.5 LTS