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
Too much website traffic can be as disastrous as no traffic at all. A traffic disaster results in server overload. In such a situation, no one is able to use e.g. your online store’s offer, and you do not earn. Learn how to optimally prepare your website for increased traffic.
- Read more
Do you have a bank account? Use the internet with your smartphone? Congratulations! Then you are on the brighter side of the power, where digital exclusion does not reach. But can you take care of the security of your data as effectively as you invite your friend for a beer via instant messenger?
- Read more
SPAM is any message that is unsolicited. By design, such messages do not reach the recipient. They can be blocked at several stages, between sending and delivery. However, the email system does not work perfectly. Some valuable mail ends up in SPAM, while unwanted offers arrive in the inbox. Can something be done about this?