/bhus

A REST API for Dublin bus operators, vehicles and stops.

Primary LanguagePython

bhus

Irish for bus. API to interact with Dublin's operators, vehicles and stops.

Setup

Dependencies

  1. docker-compose
  2. PostgreSQL client - I recommend pgcli.
  3. wrk2 - if you want to run the benchmarks.

Starting the local environment

./run.sh

This will start a docker-compose environment, pulling in the necessary base images and initializing your database and the service automatically.

Connecting to the local database

The credentials to connect to the Postgres server are exposed in the .env file in the root of the repo. To save some time, here's the raw connection URL you might want to use to connect to the database with pgcli.

pgcli postgres://bhus:bhus@localhost/bhus

Note: to connect via a port other than the default Postgres 5432 port edit the .env file and set the new port from there. This is useful for when you already have a PG server running on your host machine and there's a port conflict. TODO: Make the above instruction Just Work by just using a different port.

Running the benchmarks

First ensure the service is up and running

./run.sh

Then simply run

./benchmark.sh http://localhost:8000

Note: This will likely changed, as well as the wrk2 dependency removed, pending on doing benchmarks via Gatling.

Roadmap

  1. benchmark via Gatling.
  2. add API documentation. best if autogenerated, accessible via a webpage that the service provides. OpenAPI 3.0+, Swagger.
  3. add documentation to launch the service if needed.
  4. add mypy step for some type safety assurances.