story of upgrading rails 5.x to 7.x

sugiarto - Aug 27 - - Dev Community

This post will not explain in detail parts of the app's upgrade and only give general points about what I did a few months ago.

So I am a freelance Ruby on Rails developer, I was hired to work on Rails application upgrade five months ago. The application had several dependencies that needed to run on a separate server to reduce load on the main server.

Upgrading Ruby locally

The first step was upgrading the Ruby version. I used rbenv for managing the Ruby version on my Mac. I used .ruby-version file for managing active Ruby versions.

Upgrading rails and any other gems locally

I used bundle install and bundle update repeated until all gems can be installed successfully.

Install package dependencies locally

The app depends on several packages to run, so I need to install them locally too. I used a combination of brew and orbstack / docker for installing packages. Some dependencies for this project are redis, mongodb and memcache

Make the app work locally.

For upgrading steps, I did incremental update by increasing the Rails version step by step and making sure the app can bootup for each version, this also helped figure out any deprecated codes during the upgrade. I also made a switch for javascript build from therubyracer to use  nodejs.

Staging Deployment.

The previous deployment was using capistrano v2, and the client wants to stay with the same deployment method. So I just upgraded the code to use capistrano v3.

We split the staging server into two instances using Ubuntu 22.04 as the base image. The first instance is for a web server with nginx,  passenger and MySQL. The second instance is for the support server and this is where we install redis, memcache, mongodb and resque

For database, we just apply sql dump file from old staging server.

Production deployment

Production deployment actually just similar to staging deployment, but we did more carefully.

. . . . . . .
Terabox Video Player