Tracking and mapping RPI's shuttles with Go, Vue.js, and MongoDB.
Check it out in action at shuttles.rpi.edu.
- Install Go (https://golang.org/doc/install)
- Ensure your
$GOPATH
is set correctly, and is apart of 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 MongoDB installed.
- Rename
conf.json.sample
toconf.json
- Edit conf.json with the following:
DataFeed
: API with tracking information from iTrak... For RPI, this is a unique API URL that we can get data from. It's currently private, and we will only share it with authorized members for now.UpdateInterval
: Number of seconds between each request to the data feedMongoUrl
: URL where MongoDB is locatedMongoPort
: Port where MongoDB is bound (default is 27017)
- Start MongoDB, and ensure it is running, and listening on port 27017 (or whichever port you defined in
MongoPort
withinconf.json
) - Add data to your database. Example DBs are provided in
example_database
, as well as a simple import/export script to setup the database for you.- If using an example database, you might need to check the name of the imported database, and change
MongoUrl
accordingly.
- If using an example database, you might need to check the name of the imported database, and change
- Start the app by running
go run main.go
in the project root directory. - You can optionally add yourself as an administrator by using the
make-admin
script in the example_database folder, passing it your RCS ID as the first argument. - Visit http://localhost:8080/ to view the tracking application and http://localhost:8080/admin to view the administration panel
Shuttle Tracker reads from a conf.json
file. It can look like this:
{
"Updater": {
"DataFeed": "",
"UpdateInterval": "3s"
},
"API": {
"GoogleMapAPIKey": "",
"GoogleMapMinDistance": 1,
"CasURL": "https://cas-auth.rpi.edu/cas/",
"Authenticate": true,
"ListenURL": "127.0.0.1:8080"
},
"Database": {
"MongoURL": "127.0.0.1:27017"
},
"Log": {
"Level": "debug"
}
}
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 DATABASE_MONGOURL
.