Blue-Green software deployment
One of the most important activities in working with IT systems is the release of code for production or software update. Not so long ago, new versions of the software were available on CDs released several times a year in the form of newsletters. With the advent of agile software development, cyclical releases appeared at the end of the sprint (e.g. once every two weeks).
Recently, Continuous Deployment has become more and more popular, where we can have new versions every day. How to deal with it?
One of the patterns to deal with frequent updates is the blue-green pattern. It is useful when implementing a new software version is quite risky. Even if we have good tests. Let’s also remember that other factors, such as firewall configuration, permissions, machine performance, etc. are also a part of the risk.
The aforementioned pattern assumes that we have at our disposal at least two environments: blue and green. These can be virtual machines, physical servers, two separate environments in the operating system or hosting accounts. It is important that they are different, but identical at the same time. At any time only one of them is active and has the latest version of the software.
We also need a load balancer or router. It will be responsible for redirecting the connection to the blue or green server. At the beginning it doesn’t matter which server will be selected.
The situation may be as follows:
- On the green environment we throw the first version of the software. Everything works as it should. However, we decided to add some new features to the code and we want to implement it safely. At the moment we have a spare blue environment. So we put there our new code
- At the moment there are two versions of the software. At present, users are using the green machine. So we have time to check if the new code does not cause any problems. Let’s remember that both environments are productive and use the same resources.
- If we find out that everything is working properly, then on the router or load balancer we change the redirection of traffic from the green server to blue.
- There are two possibilities at the moment. After the implementation everything works correctly and we leave it that way. However, if there are any problems, the whole rollback procedure boils down to redirecting traffic to the green server.
- Subsequent implementations will take place on the same basis. Currently our main server is blue. So the new version of the software will be installed on the green server. And follow steps 1 – 4.
To sum up, thanks to the blue-green methodology we get:
- Implementation without any production downtime – the application will always be available for users
- Fast backup – we are able to return to the previous version in a short time. It boils down only to changing the router/balancer configuration.
- Safe implementation of new software without the risk of a more serious failure
Check other blog postsSee all blog posts
- Read more
Many clients of hosting companies are mistakenly convinced that a hosting provider will solve their problems and take care of their crucial issues, while maintaining their website hosted on their servers. (Un)fortunately, that doesn’t work that way. What are the things your hosting won’t do for you? It won’t do the dishes, design a website,…
- Read more
My mind’s made up. You’ve had enough of the silly hosting or cosmic costs of its maintenance and finally you decide to move the site you’ve placed on WordPress. How to move WordPress to another server? What do you need to remember and how should you prepare for it? Migration of WordPress to another server…
- Read more
Google Workspace is probably the best business mail for your work. Great anti-spam filters, full control over your data, the fact you can choose a country where your data are stores, a calendar, Google Meets… these are only a fraction of what G Suite offers. Take a look at why you should consider switching to Google…