Application 2019-10-05

Upgrading from FuelPHP 1.8.0 to 1.8.2 and PHP 5.6 to PHP 7.3

Summary of the application version upgrade from FuelPHP 1.8.0 to 1.8.2 and PHP 5.6 to PHP 7.3.

Read in: ja
Upgrading from FuelPHP 1.8.0 to 1.8.2 and PHP 5.6 to PHP 7.3

Overview

We upgraded FuelPHP from 1.8.0 to 1.8.2 and PHP from 5.6 to 7.3. Since this was part of our business application upgrade efforts, I wanted to summarize our approach.

Scope

Middleware version details are omitted. The OS is Amazon Linux (not version 2).

FuelPHP 1.8.0 supports up to PHP 7.2, while 1.8.2 supports up to PHP 7.3.

The release occurred suddenly about two weeks before we started the upgrade. fuelphp.com - Fuel releases 1.8.2

PHP 7.2 has active support until November 30, 2019, and security support until November 30, 2020, while PHP 7.3 has support until December 6, 2020, and December 6, 2021.

I believe we should be very grateful for the release of FuelPHP 1.8.2, as it extends the support period.

Duration

About one and a half months.

The first two weeks were spent working intensively in a retreat away from the office. During this period, we had a code freeze, stopping all releases except for emergency fixes.

Team Composition

Why We Upgraded

The primary motivation was security rather than performance requirements.

Failing to ensure the security of the product could pose a risk to the business.

Tasks

Preparations

Branch Management Policy

I prepared a release branch for upgrade work derived from the master branch. We set a two-week code freeze period, but after the freeze was lifted, to allow for releases from the master branch, any functional modifications or additions to the master were rebased into the release branch as needed.

Progress

The approach for upgrading both FuelPHP and PHP was generally the same:

Note 1: The functionality confirmation tests utilized past assets (test items used in previous upgrade efforts). Note 2: After completing the FuelPHP upgrade, I conducted a functionality confirmation test, then performed the PHP upgrade and conducted another confirmation test. (I felt it might have been okay to do a release after completing the FuelPHP confirmation tests.)

This was the flow of progress.

The only difference was that for the PHP upgrade, it was necessary to prepare the staging environment and CI execution environment for PHP 7.3 in advance.

We also held morning meetings to share progress and any issues, and we enjoyed lunch together. It was fun (a simple pleasure).

Since there were a decent number of unit tests prepared, I don't think we faced any hellish situations. (Testing is important.)

The bugs that arose after the work was completed were mainly in areas not covered by tests (such as fat controllers or areas that would likely be detected by E2E), and there were hardly any issues related to insufficient test cases.

Changes Made During the Upgrade

As I took on a role similar to that of a project leader, I managed progress and task handling while also engaging in actual work. However, I feel I spent more time on infrastructure tasks than on the development work for upgrading Fuel and PHP. (Most of my development work was centered around reviews, although I did handle a few tasks.)

FuelPHP

Unlike frameworks like Laravel, FuelPHP is not frequently updated, so I had some skepticism about whether the PHP 7.3 support was truly solid (given that it had just been released and had little track record). However, it turned out to be fine.

Smarty

There were changes that made me feel emotional, like "What was this minor update?"

Two issues arose during the minor update from v3.1.30 to v3.1.33.

PHP

Having been away from PHP 7 for about a year, I found that I had forgotten some features and changes, leading to learning opportunities. I feel that I may have taken a somewhat haphazard approach. To respond more carefully, I might have needed to reconsider data structures and adjust method appearances.

Infrastructure

Release

We handled the release with a canary release strategy. We gradually added PHP 7.3 instances to the target group where PHP 5.6 instances were hanging, running them in parallel, while increasing the number of 7.3 instances and decreasing the number of 5.6 instances. Once the switch was fully completed, we performed a complete switch (merging the release branch into master).

For some errors investigated in the production environment, we utilized the listener settings of the load balancer. We specified the source IP as the internal IP to route access from within the company to specific instances for verification. (Dark canary release?)

During the parallel operation period, errors frequently occurred, and we handled issues by disconnecting and reconnecting instances from the load balancer, requiring nearly two weeks to achieve stable operation and complete switching.

Challenges Faced

Several bugs arose during the release phase that could not be detected through testing or functionality confirmation.

Some were difficult to resolve or cumbersome to address, but whenever something arose, we quickly performed rollback operations (just disconnecting instances from the load balancer) while converging error logs, and it took nearly two weeks to stabilize operations.

From my perspective, the release work seemed more challenging than the upgrade work.

Others

I searched for blogs and slides related to PHP version upgrades.

The areas that need to be addressed during upgrades vary by product, but I found that the basic flow of work is quite similar. I felt a strong emotional connection with GameWith, as their environment is very similar.

We upgraded GameWith, which had been running on FuelPHP for over 5 years, from PHP 5 to 7.3! #GameWith #TechWith Can't upgrade to PHP 7 due to lack of test code? We solved it with a bot! How we upgraded from PHP 5.5 to 7.2 in 3 months and how we will approach it in the future

Performance Improvement

There was a significant improvement in CPU and memory usage, but no major changes were observed in response times. There are still some areas that have not been properly measured, so investigations are ongoing.

Reflections

I believe that a manpower-intensive approach is highly effective for upgrade efforts, so focusing on it may allow for relatively quick completion. It was a valuable experience.

While there was the miraculous release of FuelPHP 1.8.2, we also faced the rare event of a large-scale AWS outage toward the end of the retreat. (This had some impact on functionality verification in the staging environment.)

Tags: PHP FuelPHP
Share: 𝕏 Post Facebook Hatena
✏️ View source / Discuss on GitHub
☕ Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles