Reputation: 31
Upgrade or Rewrite Ruby on Rails App (Rails 5.0 to 7.1)
Hi, i got a Large Webapp (A Shop with user management, Orders and so on, and a ThreeJS App, which communicates with the ROR app over api controllers). The Version is Rails 5.0.0.2beta2; ruby 2.3.1p112 and postgress 10.19. I want to upgrade to the newest versions because we using this in production and we need to migrate to a new server with freebsd 13. And it does not support old Ruby installation because the OpenSSL Version is to low. I am multiple Major Versions behind. What is the best approach? Update incrementally like:
5.0 -> 5.2 -> 6.0 -> 6.1 -> 7.0 -> 7.0.2
Or would it be more prudent to completely rewrite the application? So Creating a ROR App and integrate: -> models -> DB migrations -> Gems -> configs -> views and controllers -> assets
An additional challenge is that the application currently has no written tests Does anyone has recommendations on the most efficient and least risky path to take? Any insights or experiences shared by those who have faced similar challenges would be greatly appreciated. Thank you in advance .
Here is my Gemfile
source 'https://rubygems.org'
gem 'rails', '5.0.0.beta2'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', github: "rails/coffee-rails"
gem 'jquery-fileupload-rails'
gem 'jquery-ui-rails'
gem 'turbolinks', '~> 5.2.0'
gem 'jbuilder', '~> 2.0'
gem 'puma'
gem 'bcrypt', '~> 3.1.15'
group :development, :test do
gem 'byebug'
gem 'factory_girl_rails'
gem 'capybara'
gem 'guard-rspec'
gem 'rspec-rails'
gem "letter_opener"
end
group :development do
gem 'web-console', github: 'rails/web-console'
gem 'spring'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'pg'
gem "simple-navigation"
gem 'ancestry'
gem 'multilang-hstore', '~> 1.0.0'
gem 'acts_as_list'
gem 'mini_magick'
gem 'carrierwave'
gem "autoprefixer-rails"
gem 'redis'
gem 'hiredis'
gem 'nokogiri'
gem 'rack-cors'
gem 'amoeba' # for amoeba_dup
gem 'wicked' # Multistep Forms
gem 'premailer-rails'
gem 'paypal-sdk-rest'
gem 'prawn'
gem 'prawn-table'
gem 'barby', '0.6.8'
gem 'responders'
gem 'will_paginate', '~> 3.3'
gem 'coupon_code'
gem 'pg_search'
gem 'dotenv-rails', :require => 'dotenv/rails-now'
gem "recaptcha", require: "recaptcha/rails"
gem "select2-rails"
gem 'logidze'
gem 'woocommerce_api'
gem 'oauth2'
gem 'rest-client'
gem 'paypal-checkout-sdk'
gem 'invisible_captcha'
I am already in the process to remove unecessary gems. I Startet a VM with FreeBSD 13 and tried to configure it as i need it. The Backup and import of the PostgressDB to the new FreeBSD Version works, if i use PostgreSQL V11.
Update 09.24
I followed @spickermann's advice, and after successfully running bundle install and bundle update, updating the app step by step became quite straightforward. However, getting bundle update to work initially was challenging because the gems and dependencies were outdated. The key was to first install the latest version of Bundler, which helped resolve the issues. After that, I removed all unnecessary gems and libraries that were no longer in use, and it took me just three days to update to the current versions of Ruby and Rails.
The real challenge began after the update, as I had to integrate Turbo, JSBundling, and other modern tools to align the app with current standards.
Upvotes: 1
Views: 611
Reputation: 164
Updating a Ruby on Rails application can be difficult if you don't have enough testing.
I suggest, first of all, do a few unit tests on your application before starting to update versions.
Then, there are official guides to understand what changes from version to version and what things you should update in your code.
You can use the shopify bootboot gem, whose objective is to build the application twice, each time with the versions specified in each gemfile (this allows you to have your application running and update on the second build).
Lastly, I recommend using RailsBump, which controls the compatibility of your gems.
Upvotes: 0