Code Monkey home page Code Monkey logo

catenary-backend's Introduction

Install Dependencies

sudo apt install protobuf-compiler build-essential gcc pkg-config libssl-dev postgresql unzip wget

Loading in Data

Loading in data into the Postgres database is a multistep process. Ensure your postgres database is working and your password is set correctly.

Download the Transitland repo

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

Download GTFS static data

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

Unzip and format the zip files

./src/ingest_gtfs_schedule/unzip-statics.sh

Import data into the postgres database

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 staging to be the new production database.

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!

Running the Application

Install Systemd Service

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 Contributors

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.