Using docker to install BrewPi


#1

Hi Guys,

I’m working on making Docker the default way of installing BrewPi.

This will streamline the install process across platforms and will have the following benefits:

  • It is much faster
  • It is easier, because all the steps to install are already performed in the docker image. The only thing the user needs to do is install docker and deploy the image. No messing with setting up user and cloning git repos.
  • The data lives outside of the container. Updating can be done by just destroying the container and starting a fresh one.
  • Modified images contributed by users can be installed with ease too.
  • This should also make it much easier to connect to multiple BrewPi Sparks from a single pi.
  • BrewPi runs in an isolated environment, without the need to install any packages on the host.

I am documenting the new install process on our new wiki:
https://wiki.brewpi.com/start

The docker repository can be found here:

I took inspiration from existing BrewPi containers, mainly the work of Geo.

Docker purists might tell me that I should use a container for each separate process, but I think running the brewpi script, nginx and php in a single container is probably easier to manage for novice users. It’s not like we’re trying to optimize for performance here.

I created a container based on Ubuntu and one on Raspbian. I have only tested them on a pi (running HyriotOS jessie) and on Ubuntu 17.

If you want to help, it is very much appreciated. You can do one of these things:

  • Take the instructions and docker container for a spin and report back
  • Fork and improve the container and send me a PR.
  • Please help improve and expand the documentation on our new wiki! If you follow the install instructions and have time to make a few screenshots, that would be great too.

Cheers!


#2

By the way, solid instructions. Didn’t get any errors. Couple of questions though.

I tried all the docker installation and got to the Install Portainer which looks to have worked. Logged into it and saw 2 containers. The Brewpi one and another one called “loving_beaver”. Odd, per your instructions there was only supposed to be one. What is this other one?

Also, this is probably an easy one, how do you connect to the brewpi webpage now to manage the spark and such? I am not familiar with any of the docker/portainer software.


#3

I moved some instructions around, I’ll update it. The two containers you see are portainer itself and brewpi.

“loving_beaver” is the (awesome) random name it chose. I’ll add --name portainer.

You should see the brewpi webpage at http://<raspberry pi IP>:<port>.
You can also click on the port of the container in portainer.


#4

Hey Elco,

So my network isn’t on the 192.168.1.1 subnet (I think you call it that). So I followed all the steps but in Portainer there isn’t a port to click on nor can I use my subnet with a :80 at the end to bring up the site.

Attached is a pic of the portainer…


#5

I think you left out -p 80:80 when creating the container. You should destroy the container and recreate it with the port mapping. Just copy the entire command from the wiki:

docker run -d --name brewpi -p 80:80 -v ~/brewpi-data:/data -v /etc/timezone:/etc/timezone -v /etc/localtime:/etc/localtime --restart always brewpi/brewpi-raspbian

You will not lose data by destroying the container. The data is stored on the host.


#6

Ok. So I killed and then removed the container. Copied the line exactly (copy/pasted last time too) and ran it on putty.

I found it!!! But when I click on the port you mentioned in Portainer it went to http:/0.0.0.0 and gave me “Cannot by Displayed” error…

So now what about the added line in the code for when you connect the spark via USB? Where does that go?

Do I just add it to the end of the Docker run line above or run one separately? I am on the brewpi webpage but it isn’t connected to the Spark.


#7

If you want to give the container access to USB, you need to add that bit to the command to create the container, before
brewip/brewpi-raspbian. I’ll edit the wiki to clarify.

I have not added it by default, because some people might want to connect over WiFi and do not have the Spark connected over USB.

Sorry about the wrong information about clicking the port, seems that the link assumes localhost. You should just go the ip address of your raspberry pi.


#9

Ok. Thanks for your help. Looks like I got everything going.

What about mods for Tilt and stuff? I understand you cannot support that within your typical upgrades and such. But my question is more from a Docker/container standpoint. Can you still modify stuff within a container and have it boot into those changed mods with no issues?

I assume if you upgrade, if those mods are contained within the container then they will overwritten - right?


#10

You can modify a container, but if you destroy it these changes are lost.
You can do a docker commit to commit any changes you made since you started the container.

The best way to handle changes for a Tilt I think is if someone makes a new image with our image as base image, but with the modifications for the tilt added.


#11

I tried to follow the instructions, but now I’m stuck.

  • My Spark is now connected to my WiFi net (led glowing green). No devices/USB connected.

  • Fing shows both Pi and Spark as connected to the network

  • Portainer shows brewpi/brewp-raspbian container as running

  • The “Published Ports” link takes nowhere (0.0.0.0 )

  • I’m still able to see the web interface at my usual Pi web address.

  • The script isn’t running

  • Looking at stderr window, I see the following lines repeating:

    Jul 22 2017 19:11:38 Notification: Script started for beer 'My First BrewPi Run’
    Jul 22 2017 19:11:38 Connecting to controller…
    Jul 22 2017 19:11:38 Opening serial port
    Jul 22 2017 19:11:48 Errors while opening serial port:
    Could not open port socket://192.168.1.94:6666: [Errno 111] Connection refused

It looks like Spark isn’t allowing Pi to access…
Did I make any mistake?


#12

… I rebooted the spark and now it is glowing cyan. It cannot be seen in the wifi network anymore…


#13

Replying to myself…
I didn’t realize that the new “containers” setup required a firmware update in order to have the wifi working on the Spark.
I was at 0.4.4

Now I updated and Pi is correctly exchanging info with the Photon on Wifi now


#14

I followed the instructions with no issues and have the container up and running. My Spark 3 arrives on Monday so will finish the setup next week.


#15

I have unRAID NAS and it supports Docker. How much different would the setup be?
NOTE: I have 2 Spark v2 connected to 2 fermenters. Would need to have them both connected WiFi and display as /conical1 /conical2


#16

You should be able to use the brewpi/brewpi-ubuntu image, similar to the synology nas setup.
You can set them up at different ports instead of /conical1 and /conical2.


#17

From reading https://lime-technology.com/docker-guide, doesn’t seem like it will be as streamlined as it is for Synology NAS until a repository address is provided to add to unRAID Docker repo list for BrewPi to then be an option to setup.


#18

I can’t really write that template, because I don’t have a system to test it on. I understand that with such a template, you could use the GUI to pick the template, but can’t you create new docker container from the cli?

It seems like that’s what the UI does, it’s a menu to form the right docker command.

There’s also this: https://www.reddit.com/r/unRAID/comments/62jnss/how_to_install_custom_docker_image/

If you can help me write those template files, that would be great. Then we can add brewpi to the server.io templates.


#19

I will take screenshots and work through getting things working via unRAID Docker and see what I can provide back to the community. I’ve placed an order for V3 spark since both of my V2 are busy. :slight_smile:


#20

Actually, the syntax of the xml file seems very simple.

I made a guess here:

Please give it a try, fork it and fix it and send a PR for a working version :slight_smile:
I cannot test it, so if you can make it work and send me a pull request for a working version,t that would be great.
I picked port 8080 as default. If that clashes with other apps, please change that too.


#21

I was able to successfully get my new spark connected via docker. One item about editing the config.cfg, a clean install only has config.cfg.sample. Just copied that to config.cfg and used vi to edit the port line to connect to the new BrewPi 3 via WiFi. I installed and configured the sensors and SSR’s but for some reason the device stays in idle mode when after I put in fridge constant and set the temperature to something that should kick on one of the outlets. May not have configured the devices correctly.

One item I don’t see how to do is pull the latest version of BrewPi and the firmware. There is no upgrade script in the docker BrewPi image. I assume the intent is to just destroy and repull the docker image, but not sure how to ensure the Photon has the latest firmware.