This is the API server for ether_house project. Client software runs on an Arduino and interacts with this API.
In designing the software, I aimed for longevity. I want the software to continue to run for many years without maintenance. I decided to use golang.
- Go binaries are statically compiled, which means the same binary I compile now will continue to run on new platforms for years to come.
- With godeps I can include all compatible libraries together with no external dependencies, regardless of their long term state.
- I use Heroku to deploy the code. Heroku is free for small installs and a stable platform. They can probably keep this server up better than I can.
- I use a DNS name I can control for service discovery. This gives me the flexibility to change platforms over time if necissary.
This is an API server. It isn't really designed to be useful to humans. All it really does is store shared state and configuration for ether_house clients as they report in.
- golang 1.3 (1.2.1 seems to work too)
- heroku (optional)
Install heroku, get an account, log in with the tool
Clone this repo
Make a copy of the secrets file and make your own secrets
Create an app
Use the golang buildback
heroku create -b https://github.com/kr/heroku-buildpack-go.git
Enable Memcache (optional)
heroku addons:add memcachedcloud:25
git push origin heroku
Push your secrets
Locally on Ubuntu
# cd to directory containing this code sudo apt-get install go export GOPATH=$HOME/gopath:`pwd`/Godeps/_workspace go get github.com/kr/godep sudo apt-get install memcached go build . ./solarkennedy-ether_housed
The client uses HTTP in combination with an API key to authenticate and authorize. A compromised API key means someone can change the stored state associated with that key, as well as retrieve the mac address associated with that API key.
This key is considered a simple shared secret. If you want new ones, change the secrets.sh file and program the new key on the arduino.