Brewblox release 2024/03/26

Relevant links:

Brewblox release 2024/03/26

firmware release 2024/03/26

WARNING: Python 3.7 and Debian Buster are no longer supported. If you’re using Debian Buster, see https://www.brewblox.com/user/system_upgrades.html

For this release, we have two new features: Sequences can use variables,
and brewblox configuration files are now generated based on settings in the new brewblox.yml file.

Variables

Before, if you wanted to change a temperature value or a block name in a Sequence, you always had to update the sequence itself.
If you had multiple instructions targeting or waiting on the same block, you had to copy the block name in every instruction.

Now, instruction arguments can either be a value (as before), or a reference to a variable.
Variables are stored in the new Variables block. Multiple Sequence blocks can use the same Variables block.
In the Variables block, you create a new variable, and give it a name and value.
In the sequence instruction, you use a $ + the variable name instead of an argument value.
The variable type (block link, temperature, duration, etc) must match the argument type.

An example use case for variables is to have a generic sequence that you don’t change often, and a variable block that you update for each batch, with variables for setpoint settings and durations.

Example syntax:

SET_SETPOINT target=$setpoint_block, setting=$beer_temp

The bad news is that the variables block is not available on the Spark 2 and 3.
We were unable to make the implementation small enough to fit the firmware partition.

brewblox.yml

In Brewblox, we want to maintain a balance between configurability and ease of use.
brewblox-ctl install creates configuration files, and if you want to, you can override them.
Environment variables were used to declare simple settings, such as the published HTTP / HTTPS ports.

This has its drawbacks. Some configuration could not be partially overridden, or would be reset during updates.
To make it easier to apply specific and common configuration changes, we reworked how configuration files are handled.

brewblox-ctl now stores its own settings in a dedicated file: brewblox.yml.
Other configuration files are no longer static, but are generated based on the settings in brewblox.yml.
For example, you can now disable TLS termination without having to copy all traefik service settings in your own docker-compose.yml.

Configuration files are generated during updates, and when using the brewblox-ctl config apply command.

This includes the .env file. Any manual edits to .env will be lost when configuration is generated.
If you want to include custom environment variables in .env, you can use the environment section in brewblox.yml.
When updating to this release, existing values in .env will not be discarded, but placed in the newly created brewblox.yml.

To see all available settings, run brewblox-ctl config inspect.

Changes

  • (feature) Added the Variables block.
  • (feature) Sequence instructions can reference named variables defined in a linked Variables block.
  • (feature) The Sequence block behavior on startup can now be configured to start/pause/resume at first/current instruction.
  • (feature) Brewblox-ctl now uses a central brewblox.yml config file to generate other configuration files.
  • (feature) TLS termination in traefik can now be disabled.
  • (improve) The Digital Input block now has better detection for Open Load errors.
  • (improve) Actuator Soft Start now resets on overcurrent error.
  • (fix) Fixed the Spark service page not updating the document title.
  • (deprecate) Brewblox no longer supports Python 3.7 / Debian Buster.

This is great! Nice work, gentlemen!

In preparation for the upgrade, I created a new debian 12 system running x86/64 and I get the following error towards the end of the install running as a newly created user with access to sudo. Any thoughts on fixing it appreciated. I rebooted and remove the brewblox directory in between just to be sure…

Command is about to: Install Brewblox and its dependencies.
Do you want to continue? (yes, no, verbose, dry-run) [press ENTER for default value 'yes'] 
Do you want to install with default settings? [Press ENTER for default value 'yes']

INFO       Docker is already installed.
INFO       dms already belongs to the docker group.
INFO       Generating brewblox.yml ...
INFO       Generating brewblox.yml ...
INFO       Installing apt packages ...
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 https://download.docker.com/linux/debian bookworm InRelease   
Hit:3 http://security.debian.org bookworm-security InRelease        
Hit:4 http://deb.debian.org/debian bookworm-updates InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
curl is already the newest version (7.88.1-10+deb12u5).
libssl-dev is already the newest version (3.0.11-1~deb12u2).
libffi-dev is already the newest version (3.4.4-1).
avahi-daemon is already the newest version (0.8-10).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
INFO       Skipped: docker install.
INFO       Skipped: adding dms to 'docker' group.
Docker Compose version v2.25.0
INFO       Fixing Docker IPv6 settings ...
INFO       Using Docker config file /etc/docker/daemon.json
ERROR      TypeError(read_file_sudo() missing 1 required positional argument: 'infile')

That was an oops on my end. The fix is live now.

Such speed. Thanks Bob. I re-ran it just now after deleting the brewblox directory and I now get what is shown below. My rig doesn’t have a spark plugged in as I connect to it over the network.

Docker Compose version v2.25.0
INFO       Fixing Docker IPv6 settings ...
INFO       Using Docker config file /etc/docker/daemon.json
INFO       Adding udev rules for Particle devices ...
Failed to send reload request: No such file or directory
ERROR      CalledProcessError(Command 'sudo udevadm control --reload-rules && sudo udevadm trigger' returned non-zero exit status 1.)
ERROR      

That should go away on a retry, if only because the rules file exists already. I’ll have a look at why udevadm is complaining.

Well I tried the install again and it gets much further. I’ve now hit an error which repeated installs do not clear, so any thoughts on the one shown below?

INFO       Creating auth directory ...
INFO       Creating history directory ...
INFO       Creating gateway directory ...
INFO       Creating SSL certificate ...
INFO       Generating new certificates in /home/dms/brewblox/traefik ...
edge: Pulling from brewblox/minica
661ff4d9561e: Pull complete 
615c0069d978: Pull complete 
7de2b7897d42: Pull complete 
Digest: sha256:93c7e1cac1bb4e93346d96926d02e752da8b10065b2345d0823865d914d69959
Status: Downloaded newer image for ghcr.io/brewblox/minica:edge
Unable to find image 'alpine/openssl:latest' locally
latest: Pulling from alpine/openssl
4abcf2066143: Pull complete 
9e7c732ca414: Pull complete 
Digest: sha256:6cdbb52e1285fd807d50c1e724a224e56afff4f9da1360abdc8a89b68f31b7c2
Status: Downloaded newer image for alpine/openssl:latest
INFO       Generating static traefik config ...
INFO       Generating dynamic traefik config ...
INFO       Creating mosquitto config directory ...
INFO       Creating Spark backup directory ...
ERROR      PermissionError([Errno 13] Permission denied: '/etc/avahi/avahi-daemon.conf')

The avahi directory contains:

 rw-r--r-- 1 root root 1.8K Apr 19  2023 avahi-daemon.conf
-rw-r--r-- 1 root root 1.1K Apr 19  2023 hosts
drwxr-xr-x 2 root root    2 Apr 19  2023 services

Sorry I should also have added that I manually changed the permissions on avahi-daemon.conf as in sudo chmod a+rw. That then produces the following after an install, if this helps…

Docker Compose version v2.25.0
INFO       Fixing Docker IPv6 settings ...
INFO       Using Docker config file /etc/docker/daemon.json
INFO       IPv6 settings are already present. Making no changes.
INFO       Checking for port conflicts ...
INFO       Generating .env file ...
INFO       Generating docker-compose.shared.yml ...
INFO       Generating docker-compose.yml ...
ERROR      TypeError(can only join an iterable)

Ah, that explains. Not sure whether it’s a new change in default avahi conf permissions that they’re not readable without sudo, but it’s an easy fix.

Could you please run brewblox-ctl -d install to check the last error?

If it can’t find brewblox-ctl yet:

. .venv/bin/activate
python3 -m brewblox_ctl -d install

It finds that executable just fine Bob and I get:

INFO       Generating docker-compose.yml ...
CONFIG     /home/dms/brewblox/docker-compose.yml
services: {}

SHELL      docker version 2>&1
SHELL      docker compose ps -q
ENV        BREWBLOX_CFG_VERSION=0.11.0
INFO       Pulling docker images ...
SHELL      docker compose pull
INFO       All done!

Am I good to go? Assuming I am, I then copied my previous snapshot across and did a snapshot load and got the following:

 ✔ ui 9 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                                63.4s 
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
                                                                                                                       
failed to register layer: unlinkat /var/cache/apt/archives: invalid argument
ERROR      CalledProcessError(Command 'docker compose pull' returned non-zero exit status 18.)
ERROR      
Command 'python3 -m brewblox_ctl update --update-ctl-done' returned non-zero exit status 1.

Looks good. The final test is of course whether it actually does its job.

Is this a virtual machine? Looking around for the udevadm error mostly yields people having problems with Proxmox and containers.

Whoops, info crossover. This is a fresh, clean unprivileged proxmox LXC with debian 12, so not a VM, but a container. Having said that, the current brewblox image I’m running and took a snapshot from was done the same way but was Debian 11. It has been running fine for ages, but I’m happy to take time with the upgrade so I don’t have to touch it again for a while :slight_smile:

docker: failed to register layer: ApplyLayer exit status 1 stdout: stderr: unlinkat /var/log/apt: invalid argument. | Proxmox Support Forum seems related for the pull error.

udevadm is only relevant for when using Spark 2 / 3 devices over USB, and we only reload if the rules file was not yet present. The previous system also probably encountered an error once. I’ll just set it to capture the error. Either the system can’t use USB at all, or it loads the rules on reboot.

I’ve tried the migration/upgrade using a VM and that works just fine. If there is ever an opportunity to check out why the LXC isn’t working, then that would be great, but I appreciate this might take extra time.

I have set traefik: tls: false in brewblox.yml but am getting “404 page not found now” and it is still redirecting me to the ssl port

I can take a look at LXC, if only to get a solution for the immediate issues. We also have been looking at VM and container solutions, to see what we’d want to support officially, but there’s no conclusion yet.

@nixon506e Have you applied the config? If you check traefik/traefik.yml, does it still list entryPoints.websecure.http.tls as true?

I did apply them and it has redirections: entrypoints: secure listed

Ah, I think I see the problem. TLS is disabled, but you’re looking for a setting to disable redirection. (If you use http://address:443, it should work).

The tls:false is working as intended, but I’ll make an issue to add redirect_http:false. It will warn you if it’s set as the same time as auth.enabled:true, but that’s an at own risk thing.
As a temporary workaround, you can copy the traefik/traefik.yml file to traefik/traefik-custom.yml, make the changes, and set traefik.static_config_file to /config/traefik-custom.yml to use it.

I expect we’ll be doing a release of just brewblox-ctl changes very soon, as more of these desired features pop up.

1 Like

Thanks Bob - I’d like to stick to a supported rig and the closest I think I can get to that is the x86/64 with Debian VM. It seems to be working fine. I may revisit the LXC later as it uses way less resources.

I appreciate your help.

The custom traefik settings work for me, thanks for implementing that ability. Looking forward to making it even easier in the future.

As a final thought from me on this is case anyone else uses proxmox LXCs, if you use the excellent github ttech scripts, Proxmox VE Helper-Scripts | Scripts for Streamlining Your Homelab with Proxmox VE, and create a privileged docker LXC, the brewblox install and snapshot upgrade works flawlessly. Perhaps not ideal to have to use a privileged LXC, but the performance benefits for me over a VM are considerable.

1 Like