Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
getting-started:ubuntu-docker-install [2017/07/19 10:08]
Elco Jacobs created
getting-started:ubuntu-docker-install [2018/07/30 08:30] (current)
Bob Ubuntu guide with docker-compose
Line 1: Line 1:
 +===== Installing Docker and BrewPi on Ubuntu =====
 +We'll install Docker to run BrewPi in a container. This keeps it nicely isolated from the rest of the system and makes it easy to deploy.
 +
 +==== Install Docker ====
 Install docker following these instructions:​ Install docker following these instructions:​
  
 https://​docs.docker.com/​engine/​installation/​linux/​docker-ce/​ubuntu/​ https://​docs.docker.com/​engine/​installation/​linux/​docker-ce/​ubuntu/​
 +
 +Install docker-compose:​
 +
 +<​code>​
 +sudo apt install python-pip
 +pip install --user docker-compose
 +</​code>​
 +
 +==== Deploy the containers ====
 +Copy this code to a file called `docker-compose.yml
 +<​code>​
 +version: '​3'​
 +
 +services:
 +  brewpi:
 +    image: brewpi/​brewpi-ubuntu
 +    restart: always
 +    privileged: true
 +    volumes:
 +      - ~/​brewpi-data:/​data
 +      - /​etc/​timezone:/​etc/​timezone
 +      - /​etc/​localtime:/​etc/​localtime
 +    ports:
 +      - "​80:​80"​
 +
 +  portainer:
 +    image: portainer/​portainer
 +    restart: always
 +    volumes:
 +      - /​var/​run/​docker.sock:/​var/​run/​docker.sock
 +    ports:
 +      - "​9000:​9000"​
 +</​code>​
 +
 +Open a terminal in the directory where you saved the file, and run the following command to get started:
 +
 +<​code>​
 +docker-compose up -d
 +</​code>​
 +
 +This started the BrewPi container, and the Portainer management tool.
 +To stop the containers again, run (still in the same directory):
 +
 +<​code>​
 +docker-compose down
 +</​code>​
 +
 +You can of course modify the configuration to your liking.
 +
 +Let's break it down to explain each part:
 +
 +^ Parameter ​                              ^ Explanation ​                                                                                                             ^
 +| image: brewpi/​brewpi-ubuntu ​            | The type of docker container. ​                                                                                           |
 +| restart: always ​                        | Start on boot, and always restart the container when it stops. ​                                                          |
 +| privileged: true                        | The container is allowed to use the computer USB ports                                                                   |
 +| volumes: ~/​brewpi-data:/​data ​           | The container can now read and write all files in the brewpi-data directory. ​                                            |
 +| volumes: /​etc/​timezone:/​etc/​timezone ​   | The container will use the time and timezone settings from your computer. ​                                               |
 +| volumes: /​etc/​localtime:/​etc/​localtime ​ | The container will use your computer'​s current time.                                                                     |
 +| ports: 80:80                            | Map your computer'​s port 80 to port 80 on the container. 8000:80 would be port 8000 on your computer, 80 on container. ​   |
 +
 +
 +=== Connecting the BrewPi Spark via WiFi ===
 +
 +This step requires that you both configure the BrewPi Spark itself and your docker instance so it can find your controller on the network. Please follow [[:​how-to-setup-wifi-on-the-brewpi-spark|this guide]] to configure both. Note that since you are running docker, expect the ''​config.cfg''​ to reside in ''​~/​brewpi-data/​settings/''​ or the folder you specified when ran your container.
 +
 +==== Use portainer to access the command line of the brewpi container ====
 +
 +After you've started the containers using docker-compose,​ you can load the portainer web interface: ''​localhost:​9000''​.
 +It will ask you to set an admin password. Pick a password and set it up. Use it to log in on the next page. 
 +
 +{{:​getting-started:​portainer-password-setup.png|}}
 +
 +On the next page, choose to first option '​Manage the Docker instance where Portainer is running'​ and click the Connect button. ​
 +
 +{{:​getting-started:​portainer-connect.png|}}
 +
 +When you have logged in, you can see your running containers. In this case, there will be a brewpi and a portainer one. If you click on the published port, this will take you to the web interface.
 +
 +{{:​getting-started:​portainer-running-containers.png|}}
 +
 +If you click on the brewpi container, you can click on '​console'​ on the container page. This will drop you directly to the command line of the container if you need it.
 +
 +