Skip to content

Set Up on OS X

Liana Lo edited this page Dec 19, 2014 · 2 revisions

If you are not familiar with Go and run into trouble with the following instructions, please visit "How to Write Go Code" for more details. In particular, pay attention to the GOPATH environment variable.

####Master

You will need Go installed to run and/or compile the source code. Clone this repository to the machine that will run the master.

If you would like to use the website with user authentication, install the following dependencies,

dashboard-controller$ go get github.com/gorilla/mux
dashboard-controller$ go get github.com/gorilla/securecookie

and specify the user name and password in a file named user_authentication_data.txt in the directory dashboard-controller/src/website/hash/. user_authentication_data.txt should only contain two lines -- username on the first line, password on the second line. You may refer to user_authentication_data_for_testing.txt as an example.

To run the code from the cloned repository directory,

dashboard-controller$ go run src/master/master.go

At this point, you will be able to access the master website on the same device at http://localhost:5000/ -- replace "localhost" with the device's IP address to access the website from other devices on the same local area network. Other deployment options are left up to the user.

####Slave

Again, you will need Go installed to run and/or compile the source code. We recommend that you compile the slave.go file to produce a binary file executable on one slave machine, then copy the slave binary file to all your slaves. A slave does not need Go installed to run the binary file, so you can save yourself the Go installation time for each slave. (We used Raspberry Pis as slaves, and each Go installation took 70-100 minutes.)

From the repository directory, compile slave code with the command,

dashboard-controller$ go install slave

Then run the executable with a specified slave name and master IP address.

dashboard-controller$ $GOPATH/bin/slave -slaveName="Main Lobby" -masterIP=10.0.0.195

The slave will begin listening on its default port number: 8080. The master's default port number is 5000. Optionally, you can specify a port number for the slave and/or master with the -port and -masterPort flags, respectively.

dashboard-controller$ $GOPATH/bin/slave -slaveName="Main Lobby" -port=9999 -masterIP=10.0.0.195 -masterPort=9090 

The slave will automatically map itself to the master and periodically emit heartbeats to the master. If the slave's heartbeats do not reach the master for some period of the time, the master will mark the slave as dead and remove it from the map of available slaves.

Clone this wiki locally