This is a rewrite of Waka. The notable difference is that it now uses sqlite on both client and server to speed up queries and run offline.
npm ci
npm run dev
for devnpm run build
to buildnpm run preview
for a preview server
The orchestrator will start without any configuration and serve the sample configuration. However, if you do not set up AWS credentials (S3), imports on the server will not work but you can still use the Waka dev tools in the client to test imports locally. If you're not using S3 (e.g Cloudflare R2) you can set AWS_S3_ENDPOINT
.
To configure the orchestrator, set WAKA_ORCHESTRATOR_CONFIG
to something like:
database:
region: ap-southeast-2
bucketName: your-s3-bucket-name
publicUrl: https://your-bucket-public-url.com/regions
regions:
nz-akl:
name: 'Auckland, New Zealand'
gtfsZipUrl: https://gtfs.at.govt.nz/gtfs.zip
shouldCache: false # defaults to true. false means the orchestrator won't load the region on launch.
zz-sample1:
name: Sample Region
gtfsZipUrl: https://next.waka.app/sample-feed-1.zip
gtfsZipDisableEtag: true # set to true if you want to force an import every time
gtfsZipDisableHead: true # set to true if the upstream server doesn't suport http HEAD
gtfsZipHeaders:
Authorization: SECRET.whatever # you can use WAKA_ORCHESTRATOR_SECRETS to substitute secrets
gtfsTidyOptions: false # set to false if gtfstidy is not installed
You will also need to set a WAKA_ORCHESTRATOR_ACCESS_TOKEN
to the administrator bearer token that you want to use. Multiple tokens are not currently supported.
The WAKA_ORCHESTRATOR_CACHE_PERIOD
variable can also be set to a number in milliseconds to reduce the number of reads from S3.
The WAKA_ORCHESTRATOR_NO_CACHE
variable can be used to set shouldCache to false globally.
fly machine run alpine --entrypoint "sh -c 'apk add --no-cache curl && curl -X POST -H \"Authorization: Bearer \$WAKA_ORCHESTRATOR_ACCESS_TOKEN\" https://waka-next-orchestrator.fly.dev:5000/admin/schedule-update'" --schedule hourly
There's three apps in this repository.
- lib: The library for importing, manipulating, and querying GTFS. This will eventually be published as a NPM module that runs on both client and server.
- apps/orchestrator: The server that downloads, parses GTFS files and serves them to users. It also provides a HTTP API so queries can be run without downloading the whole database.
- apps/web: The new web frontend. It can download and query the sqlite database directly, or use server side rendering to grab the data from the orchestrator's HTTP API.
This is designed to eventually run fully offline - this is how static GTFS data is loaded in apps/web
:
- If the sqlite db is already downloaded to the client, query from that (provider: client)
- If it's not, query the data via HTTP from
apps/orchestrator
- this is also run when server side rendering (provider: server) - If the HTTP request fails, wait until the sqlite db is downloaded, and then query on that (provider: static)
- If that fails, the request is rejected