|
I maintain a fleet of edge devices, including their embedded software written in python. There is a release every two weeks or so, which usually consists on pulling a new set of docker images. My current pain comes from the fact that, sometimes, I have to update the docker-compose.yml on the unit, or add a library, or change something outside of the unit. I am currently writing a (python) script and a documented process for every update, which is gently becoming a pain in the xxx for the units which are not available so often, and for which I have a few updates late. I would love to have this pile of scripts ran through automatically with a higher level command, and create the skeleton of a new migration script on demand. Hence the question: how do you manage such remote incremental update manager ? I am looking for something as simple as alembic, but obviously to run scripts not DB migrations. |
Pyinfra was the perfect match.
I have used their "operations" to pile up the actions that come with the next release:
- A new package (apt)
- an updtated pip dependency
- checking a file
- and docker-compose actions to update all containers
I was able define my "inventory" easily, which allows me to update my whole fleet with one single command. One caveat here, the timeout is not properly configurable with a ProxyJump. Discussion opened on stackoverflow.
Pyinfra idempotency and dry-run approaches allow me to run the update as many times as I want.
For the next release, would I need to change anything different, I will simply add a new operation. The beauty of it is that all operations are strictly executed in the order I define them, which mean that any devices that would not have been updated with the first release, would be still updated appropriately with the second release.
Cheers !