- Install the DigitalOcean SSH keys to ~/.ssh/brewbit and ~/.ssh/brewbit.pub
- Install the Chef encrypted data bag key to ~/.chef/encrypted_data_bag_secret
- Add the following to your ~/.bashrc:
export DIGITAL_OCEAN_CLIENT_ID=<snip>
export DIGITAL_OCEAN_API_KEY=<snip>
- Install Vagrant
- Install Vagrant plugins
vagrant plugin install vagrant-digitalocean
vagrant plugin install vagrant-librarian-chef
vagrant plugin install vagrant-omnibus
- Bring up the droplet on DigitalOcean
vagrant up --provider=digital_ocean
- Deploy the site to the droplet
cap production deploy
- ... On server... TODO AUTOMATE THIS!!!
export RAILS_ENV=production
# load seed data to database
rake db:seed
# create additional admin users (if needed)
rake spree_auth:admin:create
# start the app servers
bundle exec unicorn_rails -c config/unicorn.rb -D
Server is now accessible on http://brewbit.com
It is possible to run a fully-local copy of the BrewBit backend services (see below for an overview) using Docker Compose.
-
Modify the database name in
config/database.yml
to readhost: db
(instead of localhost). -
Specify a permanent storage location for the PostgreSQL data by editing
docker-compose.yml
. -
Git clone brewbit/brewbit-device-server. Both
brewbit.com
andbrewbit-device-server
should be located in the same directory. (The path tobrewbit-device-server
be changed indocker-compose.yml
.) -
Configure your router's DNS to resolve
dg.brewbit.com
to the address of your local server. This is a workaround, since the gateway server location is compiled into the Model-T firmware. -
Launch the services using Docker Compose and instantiate the database:
docker-compose build
docker-compose run web rake db:create
docker-compose run web rake db:migrate
docker-compose up
The website will appear at http://localhost:3000, and you will be able to create an account and log in.
There are three main backend services for BrewBit:
-
brewbit/brewbit-device-server acts as an intermediary between the Model-T device and the web dashboard, so that statistics and setpoints can be exchanged back and forth. The device server speaks to the Model-T using Protocol Buffers and to the dashboard using JSON. The protobuf message formats are found in brewbit/brewbit-protobuf-messages.
-
brewbit.com (this repo) provides the website at http://brewbit.com/ including the web dashboard. It persists statistics in a PostgreSQL database and communicates to the Model-T devices via the brewbit-device-server. Most of the brewing dashboard code has been extracted to the gem brewbit/brewbit-dashboard.
-
A PostgreSQL database that holds statistics, device configurations, and even the firmware updates themselves.
The device firmware can be found at brewbit/model-t.