Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
getting-started:updating [2017/08/23 11:06]
Elco Jacobs [Updating system firmware with DFU]
getting-started:updating [2018/05/02 22:32] (current)
Elco Jacobs [Updating the BrewPi Spark firmware with DFU]
Line 6: Line 6:
   - The BrewPi Spark firmware   - The BrewPi Spark firmware
  
-There are 2 ways to update ​and 2: re-creating your docker container or updating an existing container.+There are 2 ways to update ​the script ​and web interface: re-creating your docker container or updating an existing container.
  
 ==== Re-creating the docker container ==== ==== Re-creating the docker container ====
Line 12: Line 12:
 Because your data and settings are stored outside of the container, you will not loose them. Because your data and settings are stored outside of the container, you will not loose them.
  
-If you made changes in your container outside of the data directory, you will loose those.+If you made changes in your container outside of the data, settings and log directories, you will loose those. 
 + 
 +<​tabs>​ 
 + 
 +  * [[#​tab-recreate-image-pi|Raspberry Pi]] 
 +  * [[#​tab-recreate-image-other|Other systems]] 
 + 
 +<pane id="​tab-recreate-image-pi">​ 
 + 
 +**Ssh into the raspberry pi** 
 + 
 +First log into the shell of the docker machine using ssh (use putty if you are connecting from a Windows PC): 
 +<​code>​ 
 +ssh pirate@192.168.1.100 
 +</​code>​ 
 +The default password for HypriotOS is `hypriot`. 
 + 
 +**Make sure you have the latest docker image** 
 + 
 +Run the code below to get the latest BrewPi image from DockerHub. 
 + 
 +<​code>​ 
 +docker pull brewpi/​brewpi-raspbian 
 +</​code>​ 
 + 
 +**Re-create the brewpi container**
  
 To create a new fresh container, take the following steps: To create a new fresh container, take the following steps:
Line 27: Line 52:
   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   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
   </​code>​   </​code>​
 +</​pane>​
 +
 +
 +<pane id="​tab-recreate-image-other">​
 +
 +**Start a console to run docker commands**
 +
 +On Linux, just open a shell.
 +On Windows or Mac, you will find it in your start menu under the name //Docker Quickstart Terminal//.
 +
 +**Make sure you have the latest docker image**
 +
 +Run the code below to get the latest BrewPi image from DockerHub.
 +
 +<​code>​
 +docker pull brewpi/​brewpi-ubuntu
 +</​code>​
 +
 +**Re-create the brewpi container**
 +
 +To create a new fresh container, take the following steps:
 +  - Show all running containers:<​code>​
 +  docker ps
 +  </​code>​ \\ You can refer to a container by name or container ID. \\ {{:​getting-started:​docker-ps.png|}}
 +  - Remove your existing container: <​code>​
 +  docker stop brewpi; docker rm brewpi
 +  </​code>​
 +  - Make sure you have the latest image: <​code>​
 +  docker pull brewpi/​brewpi-ubuntu
 +  </​code>​
 +  - Create a new fresh container: <​code>​
 +  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-ubuntu
 +  </​code>​
 +</​pane>​
 +
 +<pane id="​tab-recreate-image-linux">​
 +Make sure you have the latest docker image:
 +<​code>​
 +docker pull brewpi/​brewpi-ubuntu
 +</​code>​
 +
 +To create a new fresh container, take the following steps:
 +  - Show all running containers:<​code>​
 +  docker ps
 +  </​code>​ \\ You can refer to a container by name or container ID.
 +  - Remove your existing container: <​code>​
 +  docker stop brewpi; docker rm brewpi
 +  </​code>​
 +  - Make sure you have the latest image: <​code>​
 +  docker pull brewpi/​brewpi-ubuntu
 +  </​code>​
 +  - Create a new fresh container: <​code>​
 +  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-ubuntu
 +  </​code>​
 +</​pane>​
 +
 +</​tabs>​
  
 ==== Updating an existing BrewPi server/​container ==== ==== Updating an existing BrewPi server/​container ====
Line 42: Line 124:
 ==== Updating the BrewPi Spark firmware with DFU ==== ==== Updating the BrewPi Spark firmware with DFU ====
  
 +DFU is a specialized USB protocol. To use DFU mode, the Spark should be connected via USB to your computer or Raspberry Pi.
 When updating over DFU, you will first put the Spark in DFU mode by rebooting into the bootloader. When updating over DFU, you will first put the Spark in DFU mode by rebooting into the bootloader.
  
-This can be done by  +This can be done by 
-- holding the setup button while it boots, until the LED flashes yellow. You can reboot by pressing the reset button (while holding the setup button) or reconnecting power (while holding the setup button). +  
-- triggering it in software (with our script).+  ​- holding the setup button while it boots, until the LED flashes yellow. You can reboot by pressing the reset button (while holding the setup button) or reconnecting power (while holding the setup button), or 
 +  - triggering it in software (with our script). Our script will do that for you if you use the option ''​--autodfu'',​ which we will get to later.
  
 The process to update is for: The process to update is for:
Line 58: Line 142:
 If you installed BrewPi without docker, you will only need to run this command on your system: If you installed BrewPi without docker, you will only need to run this command on your system:
 <​code>​ <​code>​
-python utils/​flashDfu.py ​--tag=0.5.3-rc.3 ​--noreset --autodfu+python utils/​flashDfu.py --noreset --autodfu
 </​code>​ </​code>​
-Modify ''​--tag=0.5.3-rc.3''​ to pick the tag you would like to use from [[https://​github.com/​BrewPi/​firmware/​releases|our releases]]. 
  
 --------------- ---------------
Line 68: Line 151:
  
 <​tabs>​ <​tabs>​
-  * [[#​tab-windows|Windows]]+
   * [[#​tab-pi|Raspberry Pi]]   * [[#​tab-pi|Raspberry Pi]]
 +  * [[#​tab-windows|Windows]]
 +  * [[#​tab-linux|Linux]]
 +  * [[#​tab-mac|Mac]]
  
 <pane id="​tab-pi">​ <pane id="​tab-pi">​
-First log into the shell of the docker machine ​using ssh.+The following commands are performed from the console on pi. See above to log into the pi using SSH.
  
-For Raspberry Pi, you would ssh into your docker ​host (use putty if you are connecting from a Windows PC)+We can start a docker ​container for single use that is destroyed afterwards ​(''​--rm''​and run the flashDfu.py script directly inside the container
-<​code>​ +These 3 commands pull the latest docker image, trigger DFU mode and perform the update.
-ssh pirate@192.168.1.100 +
-</​code>​ +
-The default password for HypriotOS is `hypriot`. +
- +
-Make sure you have the latest docker image:+
 <​code>​ <​code>​
 docker pull brewpi/​brewpi-raspbian docker pull brewpi/​brewpi-raspbian
 +docker run -it --name brewpi-dfu --privileged -v ~/​brewpi-data:/​data --rm brewpi/​brewpi-raspbian python utils/​flashDfu.py --trigger
 +docker run -it --name brewpi-dfu --privileged -v ~/​brewpi-data:/​data --rm brewpi/​brewpi-raspbian python utils/​flashDfu.py --noreset
 </​code>​ </​code>​
- 
-We can start a docker container for single use that is destroyed afterwards (''​--rm''​) and run the flashDfu.py script directly: 
-<​code>​ 
-docker run -it --name brewpi-dfu --privileged -v ~/​brewpi-data:/​data --rm brewpi/​brewpi-raspbian sudo python utils/​flashDfu.py --tag=0.5.3-rc.3 --noreset --autodfu 
-</​code>​ 
-Modify ''​--tag=0.5.3-rc.3''​ to pick the tag you would like to use from [[https://​github.com/​BrewPi/​firmware/​releases|our releases]]. 
- 
-Docker containers can only use devices that are present on the host when they start. Which is why the first time you run this command, it will only put the device in DFU mode. It will not be able to use the new DFU device, because it was not present when the container started. Stop the script with CTRL-C. Your Spark is now in DFU mode. Run the command again to update. 
  
 </​pane>​ </​pane>​
  
 <pane id="​tab-windows">​ <pane id="​tab-windows">​
- 
-**Start the docker console** 
- 
-You will find it in your start menu under the name //Docker Quickstart Terminal// 
- 
-**Make sure you have the latest docker image** 
- 
-Run the code below to get the latest BrewPi image from DockerHub. 
- 
-<​code>​ 
-docker pull brewpi/​brewpi-ubuntu 
-</​code>​ 
- 
- 
 **Install drivers** **Install drivers**
  
Line 118: Line 179:
 Docker runs in as a Virtualbox virtual machine if you installed with Docker toolbox. By default, this machine does not have access to USB devices. To give it access, take the following steps: Docker runs in as a Virtualbox virtual machine if you installed with Docker toolbox. By default, this machine does not have access to USB devices. To give it access, take the following steps:
  
-  ​Stop the running docker machine by typing this in your docker console:\\ <​code>​docker-machine stop</​code>​ +  ​Stop the running docker machine by typing this in your docker console:\\ <​code>​docker-machine stop</​code>​ 
-  ​Start ''​Oracle VM Virtualbox''​ from your Start Menu +  ​Start ''​Oracle VM Virtualbox''​ from your Start Menu 
-  ​Find the virtual machine called ''​default'',​ right click it and open Settings. +  ​Find the virtual machine called ''​default'',​ right click it and open Settings. 
-  ​Go to the USB tab and enable the USB controller +  ​Go to the USB tab and enable the USB controller 
-  ​Click ''​Add device filter''​ and chose the ''​Particle P1/​Photon''​ device \\ {{:​getting-started:​docker-windows-add-usb-devices.png?​nolink&​800|}} +  ​Click ''​Add device filter''​ and chose the ''​Particle P1/​Photon''​ device \\ {{:​getting-started:​docker-windows-add-usb-devices.png?​nolink&​800|}} 
-  ​Put the BrewPi Spark in DFU mode +  ​Put the BrewPi Spark in DFU mode 
-  ​Click ''​Add device filter''​ and chose the ''​Particle P1/Photon DFU mode''​ device +  ​Click ''​Add device filter''​ and chose the ''​Particle P1/Photon DFU mode''​ device 
-  ​Save your settings by clicking OK +  ​Save your settings by clicking OK 
-  ​Go back to the docker console and restart the docker machine:​\\<​code>​docker-machine start</​code>​+  ​Go back to the docker console and restart the docker machine:​\\<​code>​docker-machine start</​code>​
  
 **Check that DFU is working inside the brewpi-ubuntu container now** **Check that DFU is working inside the brewpi-ubuntu container now**
 +Make sure you have the latest docker image:
 +<​code>​
 +docker pull brewpi/​brewpi-ubuntu
 +</​code>​
  
 Make sure your BrewPi Spark is in DFU mode (blinking yellow) and run: Make sure your BrewPi Spark is in DFU mode (blinking yellow) and run:
Line 138: Line 203:
 {{:​getting-started:​docker-windows-dfu-util-test.png?​nolink&​800|}} {{:​getting-started:​docker-windows-dfu-util-test.png?​nolink&​800|}}
  
-Finally, run the command to update ​the controller using DFU:+Finally, ​we can start a docker container for single use that is destroyed afterwards (''​--rm''​) and run the flashDfu.py script directly inside ​the container. 
 +<​code>​ 
 +docker run -it --name brewpi-dfu --privileged -v ~/​brewpi-data:/​data --rm brewpi/​brewpi-ubuntu python utils/​flashDfu.py --trigger 
 +docker run -it --name brewpi-dfu --privileged -v ~/​brewpi-data:/data --rm brewpi/​brewpi-ubuntu python utils/​flashDfu.py --noreset 
 +</​code>​
  
 +</​pane>​
 +
 +<pane id="​tab-linux">​
 +Make sure you have the latest docker image:
 <​code>​ <​code>​
-docker ​run -it --name brewpi-dfu --privileged -v ~/​brewpi-data:/​data --rm brewpi/​brewpi-ubuntu ​sudo python utils/​flashDfu.py --tag=0.5.3-rc.3 --noreset --autodfu+docker ​pull brewpi/​brewpi-ubuntu
 </​code>​ </​code>​
-Modify ​''​--tag=0.5.3-rc.3'' ​to pick the tag you would like to use from [[https://github.com/BrewPi/firmware/releases|our releases]].+ 
 +We can start a docker container for single use that is destroyed afterwards (''​--rm''​) and run the flashDfu.py script directly inside the container: 
 +<​code>​ 
 +docker run -it --name brewpi-dfu --privileged -v ~/brewpi-data:​/data --rm brewpi/​brewpi-ubuntu python utils/​flashDfu.py --trigger 
 +docker run -it --name brewpi-dfu --privileged -v ~/brewpi-data:​/data --rm brewpi/brewpi-ubuntu python utils/​flashDfu.py --noreset 
 +</​code>​ 
 + 
 +</​pane>​ 
 + 
 +<pane id="​tab-mac">​ 
 +I do not have a Mac to test the procedure, so unfortunately I cannot write this piece of documentation myself. 
 +Because Docker is installed on OSX with docker-machine,​ just like in Windows, most of the instructions for Windows will probably apply. 
 + 
 +If you have installed BrewPi on OSX with Docker, please help us update these instructions.
  
 </​pane>​ </​pane>​