Tracking and mapping RPI's shuttles with Go, Polymer Web Components, and MongoDB.
Check it out in action at shuttles.rpi.edu.
- Install Go (https://golang.org/doc/install)
- Ensure your
$GOPATHis set correctly, and is apart of your$PATH - Run
go get github.com/wtg/shuttletracker - Install
govendorby runninggo get -u github.com/kardianos/govendor - Run
govendor sync - Ensure you have NPM, Bower, and MongoDB installed.
- Run
bower installinside the Shuttle Tracker directory ($GOPATH/src/github.com/wtg/shuttletracker) to install dependencies listed in bower.json - Rename
conf.json.sampletoconf.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
MongoPortwithinconf.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
MongoUrlaccordingly.
- 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.goin the project root directory. - 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
},
"Database": {
"MongoURL": "localhost:27017"
},
"Log": {
"Level": "debug"
},
"Server": {
"ListenURL": "localhost:8080"
}
}
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.