sudo apt install protobuf-compiler build-essential gcc pkg-config libssl-dev postgresql unzip wget
Loading in data into the Postgres database is a multistep process. Ensure your postgres database is working and your password is set correctly.
Transitland acts as an initial source of knowledge for Catenary-Backend, and associates static feeds and realtime feeds together. Download and Update it via:
git submodule init && git submodule update
If you already have it, remember to git pull / merge changes
To do this, cd into the folder transitland-atlas
and run git pull
This downloads the world's GTFS Static Data. This step may take a while, so go play some Minecraft / touch grass and come back when it's all finished!
cargo run --release --bin transitlanddownload
./src/ingest_gtfs_schedule/unzip-statics.sh
cargo run --release --bin import -- --postgres "host=localhost user=postgres password=correcthorsebatterystaple" --threads 25 --startfresh true --isprod false
This command writes to gtfs_stage
.
Omit startfresh if you would want to wipe the staging directory.
For safety reasons, you are unable to wipe the gtfs
schema, which is the production database, from this version.
You can also write to production, especially loading in a single agency, like this.
cargo run --release --bin import -- --postgres "host=localhost user=postgres password=correcthorsebatterystaple" --threads 25 --startfresh false --limittostaticfeed f-9q9-caltrain --isprod true
Moving the gtfs_stage
set of tables to gtfs
is really simple
cargo run --bin move_to_prod -- --postgres "host=localhost user=postgres password=correcthorsebatterystaple"
Move to prod deletes the current production database, renames the staging and then commits the change.
You're all done! Data is fully ready for serving to users!
sudo cp transitbackend.service /etc/systemd/system/transitbackend.service
sudo systemctl daemon-reload
sudo systemctl enable --now transitbackend.service
Example endpoints
http://localhost:5401/getroutesperagency?feed_id=f-9mu-orangecountytransportationauthority
http://localhost:5401/gettrip?feed_id=f-9mu-orangecountytransportationauthority&trip_id=10995882
For unix users, running git config core.hooksPath .githooks
is required.
Pull requests will not be merged without this.
No option exists for Windows users at the moment. Please try WSL Ubuntu for the moment. We're working on adding this.