Tracking and mapping RPI's shuttles with Go, Vue.js, and Postgres.
Check it out in action at shuttles.rpi.edu.
- Install Go. Shuttle Tracker targets Go 1.7 and newer, but we recommend using the latest Go stable release.
- Ensure your
$GOPATH
is set correctly, and$GOPATH/bin
is in your$PATH
- Run
go get github.com/wtg/shuttletracker
- Install
govendor
by runninggo get -u github.com/kardianos/govendor
- Switch to the Shuttle Tracker directory (
$GOPATH/src/github.com/wtg/shuttletracker
) - Run
govendor sync
- Ensure you have Postgres downloaded, installed, and running. On macOS, prefer installing it with Homebrew.
- Run
createdb shuttletracker
to create a Postgres database. - Rename
conf.json.sample
toconf.json
- Edit
conf.json
with the following, if necessary:API.MapboxAPIKey
: Necessary for creating routes through the admin interface. Create your own token or ask a Shuttle Tracker developer to provide you with one.Postgres.URL
: URL where Postgres is located. The provided default typically won't need to be modified.
- Install Node.js and npm.
- Switch to the
./frontend
directory. - Run
npm install
- Build the frontend using
npx vue-cli-service build --mode development
- Note: if you are working on the frontend, you may instead use
npx vue-cli-service build --mode development --watch
in another terminal to continuously watch for changes and rebuild.
- Note: if you are working on the frontend, you may instead use
- Go back up to the project root directory and build Shuttle Tracker by running
go build -o shuttletracker cmd/shuttletracker/main.go
- Start the app by running
./shuttletracker
in the project root directory. - You can add yourself as an administrator by using
./shuttletracker admins --add RCS_ID
, replacingRCS_ID
with your RCS ID. See the "Administrators" section below for more information. - Visit http://localhost:8080/ to view the tracking application and http://localhost:8080/admin to view the administration panel.
Shuttle Tracker needs configuration to run properly. The preferred method during development is to create a conf.json
file. See conf.json.sample
for an example of what it should contain.
Updater.DataFeed
: API with tracking information from iTrak. For RPI, this is a unique API URL that we can get data from. It's private, and a Shuttle Tracker developer can provide it to you if necessary. However, by default, Shuttle Tracker will reach out to the instance running at shuttles.rpi.edu to piggyback off of its data feed. This means that most developers will not have to configure this key.
Most keys can be overridden with environment variables. The variables names usually take the format SECTION_KEY
. For example, overriding database's Mongo URL could be done with a variable named POSTGRES_URL
.
The admin interface (at /admin
) is only accessible to users who have been added as administrators. There is a command-line utility to do this: shuttletracker admins
. It has two flags: --add RCS_ID
and --remove RCS_ID
. Replace RCS_ID
with a valid RCS ID.
> ./shuttletracker admins
No Shuttle Tracker administrators.
> ./shuttletracker admins --add kochms
Added kochms.
> ./shuttletracker admins --add lyonj4
Added lyonj4.
> ./shuttletracker admins
kochms
lyonj4
> ./shuttletracker admins --remove lyonj4
Removed lyonj4.
> ./shuttletracker admins
kochms