This script tests the Gluon autoupdater by continuously updating a VM from one firmware version to the next one using the autoupdater.
This script tests the Gluon autoupdater by continuously updating a VM from one
firmware version to another using the autoupdater.
Before starting the update, we will create a snapshot. After successful update, we will rollback to that snapshot and start again. When a update failed, we will leave a snapshot named `test_fail_%Y_%m_%d_%H_%M_%S` behind so you can investigate what went wrong.
## How it works
## Setup
Communicating with the Gluon node works over a virtual serial port.
First of all, we will create a snapshot of your VM. This makes sure the script
never touches your actual VM state. The script will also take care of cleaning
up any snapshots it has created, except when an update failed.
Then, we make sure your node is actually running the expected firmware version
by comparing the contents of `/lib/gluon/release` with what you specified in
the `--before-version` parameter.
This script to be run on Proxmox with a fully configured Gluon node as VM. This script will use a virtual serial port to communicate with the VM, so be sure to set one up. To verify it's working run `qm terminal <vmid>` and press enter. You should see a root prompt.
If that matches, we try to ping the IP specified in `--ping-ip` every second to
make sure your node has connectivty to your network. As soon as it succeeds, we
run `autoupdate -f`.
In Gluon, set up the update channel as desired, but *disable* the autoupdater. The script will run `autoupdater -f`, so the autoupdater will run even when disabled.
After updating, we will again the read the firmware version and compare that to
what you specified in the `--after-version` parameter. If it doesn't, we
consider the update failed. Then, we again try to ping the IP specified in
`--ping-ip`. If pinging that IP fails 90 times in a row with retries every
second, we will consider the update failed.
After successful update, we will rollback to the snapshot and start again.
When a update failed, we will exit and leave a snapshot
`test_fail_%Y_%m_%d_%H_%M_%S` behind so you can investigate what went wrong.
## Setup
There are several things, which currently only work for Freifunk Stuttgart, but it should be easy to adjust to your community.
1. Set up a Gluon node with connectivity to your community as a Proxmox VM.
1. In Gluon, set up the update channel as desired, but *disable* the autoupdater.
The script will run `autoupdater -f`, so the autoupdater will run even when
disabled.
1. Make sure the Gluon node has a virtual serial port attached. To verify it's
working run `qm terminal <vmid>` and press enter a few times. You should see