One of the goals we have set for the Lhotse platform is continuous delivery: changes should not only be integrated continuously, but also quickly put into production as soon as acceptance has taken place. How we want to achieve this in practice is another issue. But in order for us to be able in principle to put a new version live at any time, the system must be able to switch to a new release without interruption.
We have now fully automated the live development process via Jenkins Pipelines. Changes are permanently integrated and automatically tested via various stages.
Since we want to be able to deploy at any time, but also have testers or customers on the road, we have implemented an uninterrupted "blue-green" deployment for these stages. The environments are designed twice for this purpose: in each stage there are active servers that are currently in use, and passive servers onto which the next deployment is imported. After deployment, tests can be run on the passive half before the load balancer switches to the new version.
The two halves are referred to as "Blue" and "Green". For example, if "Blue" is active at any time, the next deployment switches to "Green".
In our case, the switch is made via an upstream Varnish that offers both reverse proxy and load balancing functionalities. Varnish is excellent for Blue-Green deployment because it can be switched between two configurations with one command. One configuration contains the "Blue" servers, the other the "Green" servers to which new requests are distributed. If requests are still being processed when switching, this is not a problem either: they are processed by Varnish with the "old" configuration.
One of the big advantages is the immediate switch of the whole cluster to the new version: At no time are both old and new versions active in the cluster, so our software does not have to deal with the fact that a new feature is already rolled out on half of the cluster nodes, but not yet on the other half.
In our case, both halves use the same database, so no further action is required to synchronize data during the switchover. We will write another separate blog post about how to deal with possible schema changes of the DB - just this: schema-free document stores are a very big help here.
Once you have solved the problem with possible schema changes, you get another feature as a gift: the possibility to reset the release to the previous state. Since both releases are still available on "their" servers, you can easily and quickly switch back - which we haven't had to do yet, though.
One of the disadvantages of this approach is quite obvious: we need twice as many servers. At the moment, we accept this disadvantage, but we are also discussing alternatives that would allow us to partially avoid these additional costs.
Overall, our experience with Blue-Green deployments has been very good so far. The deployments run smoothly, no adjustments to the software are necessary (apart from dealing with DB schema changes - but you have to solve that problem anyway) and we are actually able to go into production fully automated at ten in the morning - when all developers are in place. The ability to roll back at any time is also a confidence builder: by being able to immediately roll back to the previous release, people are more likely to dare to deploy even in a hot phase - leading to many small deployments overall, each of which is much less risky than the large, infrequent deployments of "major releases" - done nightly and controlled by an extensive process.
Hi Guido, thanks for the article. I remember seeing a presentation by eBay in the past where the speaker described how both the old and the new software versions were running in production at the same time. The idea being that it checked that the only changes in behaviour between the A and B versions were the expected changes. And only once that was proven (could be several days or weeks later) the old version was removed.
[…] Guido’s (german) article on blue/green deployment to learn how we implemented zero downtime deployments, a requisite ingredient to Continuous […]
Hallo, toller Artikel,
vielen Dank für die Insights.
habt Ihr hierzu schon einen Folgeartikel geschrieben, dies ist für uns ein sehr wichtiges Entscheidungskriterium:
[...]Bei uns verwenden beide Hälften dieselbe Datenbank, so dass während der Umschaltung keine weiteren Maßnahmen zur Synchronisierung von Daten notwendig sind. Über den Umgang mit eventuellen Schemaänderungen der DB werden wir noch einen separaten Blog-Post schreiben – nur soviel: Schemafreie Document Stores sind hier eine sehr große Hilfe.[...]
Viele Grüße
Daniel
Moin Daniel,
den Folgeartikel gibt es noch nicht - aber danke für den Hinweis, ich werde mich bei Gelegenheit darum kümmern.
Wenn du konkrete Fragen dazu hast, kannst du mich auch gerne per Mail ansprechen.
Grüße aus Hamburg, Guido
Moin Guido,
mich würde interessieren, wie ihr die Umschaltung in Varnish vornimmt. Schreibt ihr die Konfiguration um und lädt diese neu oder kann Varnish auch anderweitig umkonfiguriert werden?
Grüße aus Kiel
Patrick
[…] ist es also keinesfalls selbstverständlich, dass sie auf demselben Server landen. Auch für Blue-Green Deployments dürfen die Maschinen keinen Zustand teilen, der sich […]
cool.
allo, toller Artikel,
vielen Dank für die Insights.
habt Ihr hierzu schon einen Folgeartikel geschrieben, dies ist für uns ein sehr wichtiges Entscheidungskriterium:
[...]Bei uns verwenden beide Hälften dieselbe Datenbank, so dass während der Umschaltung keine weiteren Maßnahmen zur Synchronisierung von Daten notwendig sind. Über den Umgang mit eventuellen Schemaänderungen der DB werden wir noch einen separaten Blog-Post schreiben – nur soviel: Schemafreie Document Stores sind hier eine sehr große Hilfe.[...]
Viele Grüße
Daniel
Moin Guido,
mich würde interessieren, wie ihr die Umschaltung in Varnish vornimmt. Schreibt ihr die Konfiguration um und lädt diese neu oder kann Varnish auch anderweitig umkonfiguriert werden?
Grüße aus Kiel
Patrick
thanks!
zzzzzzzzzz
zzzzzzzzzz
zzzzzzzzzz
abc
zzzzzzzzzz
zzzzzzzzzz
We have received your feedback.