1
 
 
Account
In your account you can view the status of your application, save incomplete applications and view current news and events
August 06, 2013

Continuous Delivery with Blue-Green Deployments

What is the article about?

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.

  1. Integration Stage: All last-minute commits are built, all BDD, component and unit tests are executed, and then the automated acceptance tests (including Selenium tests) are run. A test failure leads to a "red" build, i.e. abort and error message.
  2. Testing Stage: Every hour, the last successful CI build is automatically imported into the QA environment. Here, the deployment is automatically tested in interaction with other subsystems. If these tests are successful, the acceptance of stories by QA and the product owners also takes place in this environment.
  3. Prelive and Live Stage: QA and Product Owner select one of the tested deployments. With the "push of a button", this deployment is made live in a "prelive" environment after a short stopover. The prelive stage is a copy of the live environment where the exact combination of deployments can be tested together one last time.

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.

blue-green-deployments
blue-green-deployments

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.

  • In our system environment, all servers are virtualized. Duplicate servers do not necessarily mean duplicate hardware: Since the passive servers consume only few system resources, some savings can be made if, for example, main memory and CPUs are "overcommitted". Since such a configuration is "unsightly" and difficult to manage, we have refrained from doing so so far.
  • Due to the size of our system environment, we could also set up a pool: Before a deployment, VMs from the pool are reserved, then the deployment takes place. After a certain time, the old environment is then returned to the pool. Again, the configuration is likely to be quite complex and the question is whether it would not be cheaper to keep the extra hardware on hand. In cloud environments, however, this approach could work well.
  • Somewhat more seriously, we discussed the variant of configuring two application servers (Tomcat in our case) on different ports on each server: one port would then be "Blue", the other "Green". This way, you only need a little more main memory per server - but you lose the possibility to "just" install a new operating system version or make other major changes.

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.

1 person likes it.

16Comments

  • 07.08.2013 10:00 Clock

    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 […]

  • 28.07.2014 11:09 Clock

    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

  • Guido Steinacker
    28.07.2014 14:07 Clock

    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 […]

  • 20.09.2022 20:31 Clock

    cool.

  • 20.09.2022 20:31 Clock

    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

  • 20.09.2022 20:33 Clock

    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

  • 20.09.2022 20:36 Clock

    thanks!

  • 21.09.2022 10:14 Clock

    zzzzzzzzzz

  • 21.09.2022 13:35 Clock

    zzzzzzzzzz

  • 27.09.2022 15:56 Clock

    zzzzzzzzzz

  • 27.09.2022 16:10 Clock

    abc

  • 27.09.2022 16:11 Clock

    zzzzzzzzzz

  • 27.09.2022 16:21 Clock

    zzzzzzzzzz

Write a comment
Answer to: Reply directly to the topic

Written by

Guido Steinacker

Similar Articles

We want to improve out content with your feedback.

How interesting is this blogpost?

We have received your feedback.

Cookies erlauben?

OTTO und drei Partner brauchen deine Einwilligung (Klick auf "OK") bei einzelnen Datennutzungen, um Informationen auf einem Gerät zu speichern und/oder abzurufen (IP-Adresse, Nutzer-ID, Browser-Informationen).
Die Datennutzung erfolgt für personalisierte Anzeigen und Inhalte, Anzeigen- und Inhaltsmessungen sowie um Erkenntnisse über Zielgruppen und Produktentwicklungen zu gewinnen. Mehr Infos zur Einwilligung gibt’s jederzeit hier. Mit Klick auf den Link "Cookies ablehnen" kannst du deine Einwilligung jederzeit ablehnen.

Datennutzungen

OTTO arbeitet mit Partnern zusammen, die von deinem Endgerät abgerufene Daten (Trackingdaten) auch zu eigenen Zwecken (z.B. Profilbildungen) / zu Zwecken Dritter verarbeiten. Vor diesem Hintergrund erfordert nicht nur die Erhebung der Trackingdaten, sondern auch deren Weiterverarbeitung durch diese Anbieter einer Einwilligung. Die Trackingdaten werden erst dann erhoben, wenn du auf den in dem Banner auf otto.de wiedergebenden Button „OK” klickst. Bei den Partnern handelt es sich um die folgenden Unternehmen:
Google Inc., Meta Platforms Ireland Limited, elbwalker GmbH
Weitere Informationen zu den Datenverarbeitungen durch diese Partner findest du in der Datenschutzerklärung auf otto.de/jobs. Die Informationen sind außerdem über einen Link in dem Banner abrufbar.