How could i build a container to do automatic rolling updates

I would like to build a container that runs on rancher, and automatically performs rolling updates when there are changes to an image, similar to how watchtower works: https://github.com/CenturyLinkLabs/watchtower

We cannot use watchtower because it doesn’t perform rolling ( no downtime ) updates like rancher-compose can.

What we’d like to do is to combine the ‘watch for updates’ feature with rancher-compose upgrade, so that when a new version of a container is ready, its is rolled into production.

I’ve searched around and I have not found something like this. We are happy to build it and contribute it back as a community catalog, but I need some help figuring out how to integrate it with rancher.

I know i can use the metadata service to get info on all of the images, which i could use to contact our registry to see if there is a new version.

But I do not know how i could then trigger a rolling update for that service. It seems like the rolling functionality is all built into the rancher-compose binary, not an api that I can call.

What’s my best strategy to proceed?

@dcowden - I wrote a small Python program which I use in a similar way to cause zero-downtime upgrade of my services.

In my case, I have a GitLab web hook receiver (https://github.com/olipo186/Git-Auto-Deploy) which when called, runs the program to upgrade the service (my changes are not based on container updates).

So you could find/make a receiver for the Docker Repository events (supposing that this is the trigger point for you) which runs the program I wrote to cause a service upgrade through the API.

Aces! I had a look at your code, that’s just what i need!
I just need to replace this with code to poll my registry for changes, and then make a docker container out of it. When i get something working, i’ll let you know.

This seems like a very useful container to have in the rancher catalog!

@dcowden - Glad it’s useful to someone else!