My Stuff

Upgrading Ruby on Rails, Phase 2: Booting the App

This blog post is taking a deeper look at phase 2 of upgrading a large Ruby on Rails up in smallish steps.  The next phase is basically updating the config and booting the application in both versions. This is hopefully a small enough piece that can be merged into the main branch relatively quickly or at least give enough information on what needs to be refactored.

The following is what the details of phase 2 of the upgrade process could look like.

Phase 2: Config working on both versions

Goal: Have the application loading on both versions with updated config. One merged any new changes will have to make sure the app boots in both versions.

What: Adding the changes of bundle exec rake config:update or  bundle exec rake app:update(The command will differ depending on your rails version)


  1. Create a “Spike/Boot Rails in next version” story and plan according to your process
  2. Once you start on the story: Create a branch for it
  3. Update the config
    • `BUNDLE_GEMFILE=Gemfile-next rails config:update` (depending on Rails version)
    • merge the changes between the original files and the new ones
    • staging.rb (any not standard environment) will have to be done manually
    • You might have to add `if Rails.version` around some config.
    • eg: if Rails.version > “4”
  4. Attempt to Boot the application in all the environments
    • eg RAILS_ENV=test bundle exec rails runner “puts User.first”
    • Attempt to resolve any minor issues immediately
    • Create new refactor stories as required
  5. If you created new refactor stories
    • Merge as much as you can into the main branch
    • mark the main story as attempted/done/finish/etc
    • plan the new refactor stories according to your process
    • once new stories are done, start from Step 1 again
  6. Add the changes to version control
  7. Get building and checking of app boot on CI (ie Something like `bundle exec rails runner “puts User.first”` running on CI)
  8. Share with the team that any changes need to boot in both versions
  9. Merge the branch into master

And that is it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s