Forums

Miscellaneous

Framework upgrade

Bubbles, FC Sunnyvale Developer 25 January 2022, 11:17

As I've mentioned before, it's time for us to upgrade to the latest version of our framework, Ruby on Rails. It's been almost 2 years since we last updated. This was in the beginning of 2020 where we did 3 upgrades in quick succession, which I didn't write about.

At that time, we upgraded from 4.2 to 5.0 - then from 5.0 to 5.1 - and finally from 5.1 to 5.2.

For the past 2 weeks we've been working on preparing the upgrades from 5.2 to 6.0 and from 6.0 to 6.1.

When we upgrade the framework, there are always things that break, but we do everything we can to catch and correct as many errors as possible before we post it.

The first safeguard against errors is our suite of automatic tests. Automatic tests are small bit of code that we have written over the years to test many different parts of the game's functionality. Each test sets up a scenario, runs a limited portion of the code with this data, and then checks if the result is as we expect. With a single command, we can ask the system to run all the tests, and give us an overview of which tests are failing.

It's impossible to test everything, but so far we have a collection of 1747 automatic tests that check 5402 different things in the code. But, even though all these tests are green, it does not mean that the code is error-free - it just means that out of all the things that can go wrong, there are at least 5402 things that won't ;)

Today we start rolling out the update from 5.2 to 6.0

In our server setup, we have 3 smaller web servers behind a load balancer, which distributes the load. Each time you click on a link or perform an action, the task is performed by the least busy web server.

We will take advantage of this in connection with the update today. We have set up a single new server that uses the new version.

When we start the roll-out, we will do this by first adding the new server to the load balancer, so that it has 3 servers with the old version and 1 with the new one. That way, 25% of all requests that come in will be handled by the server with the new version. We can therefore introduce the new version in a safer way, and if you experience an error, it is possible that it will disappear if you try again and your request is handled by one of the old servers instead.

Once there don't seem to be any more more errors, we can then roll out the new version on all servers, including our server that handles background jobs and the 5 servers that handle match simulation.

After that we will immediately start rolling out the update to 6.1 following the same procedure. When it's over, we'll start work on preparing for the final upgrade to version 7.0, which was released here in December.