Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the Ruby version and Ruby gems #2891

Closed
jhsu802701 opened this issue Oct 19, 2018 · 18 comments
Closed

Upgrade the Ruby version and Ruby gems #2891

jhsu802701 opened this issue Oct 19, 2018 · 18 comments

Comments

@jhsu802701
Copy link

jhsu802701 commented Oct 19, 2018

As of 2018-10-18, this app has Ruby 2.1.5 (released 2014-11-13), Rails 3.2.22 (released June 16, 2015), nokogiri 1.6.8.1 (released October 03, 2016), and pg 0.21.0 (released June 12, 2017).

I will work on updating this app. I have experience upgrading the Adopt-A-Tree app (https://github.com/OpenTwinCities/adopt-a-tree).

@daniellemoorhead
Copy link
Contributor

Hey there @jhsu802701, welcome to the Open Food Network!

We're very much aware that our ruby/rails versions are not current...however we aren't able to upgrade until we finish the project of upgrading Spree to version 2. Doing this will then clear the way to us being able to upgrade ruby/rails.

You can see the past attempts at this here: #1943
#635
#705

@daniellemoorhead
Copy link
Contributor

So for now I suggest closing this issue and perhaps having a look at what @dependabot-bot is listing out as dependencies if that's the kind of contribution you'd like to make to the repo. Or perhaps even better would be to join our slack channel and keep up to date on the spree upgrade (currently in progress with @luisramos0 and @sauloperez and @mkllnk and @HugsDaniel) process, so you can then take part in the subsequent updating of rails/ruby 😃

@luisramos0
Copy link
Contributor

There are things that could be already adapted in our current versions that will work with future versions. Is this not correct?
"Write OFN in current ruby 2.1 in a way that the migration to ruby 2.3 will be a breeze."
"Write OFN in current rails 3.2 in a way that the migration to rails 4 will be a breeze."
Is this not a valid project we could open to the community?
I am making this question because I think this is a generic and interesting topic for the community to help out (unlike the complex spree upgrade!).
This is a question for other core devs.

@mkllnk
Copy link
Member

mkllnk commented Oct 22, 2018

I like @luisramos0`s approach. We can't upgrade yet, but we can prepare ourselves for the upgrade. It would be good to know what we need to change for upgrading.

@sauloperez
Copy link
Contributor

sauloperez commented Oct 31, 2018

I am making this question because I think this is a generic and interesting topic for the community to help out (unlike the complex spree upgrade!).

That's an interesting idea. Theoretically, this would remove a great barrier of entry to new Ruby contributors. There's no need to be fully aware of OFN's and Spree's data model but of Rails/Ruby changes and I assume that's a potentially bigger set of devs.

To my understadning

Write OFN in current ruby 2.1 in a way that the migration to ruby 2.3 will be a breeze.

It shouldn't require any action as Ruby upgrades are backward compatible although I don't know off the top of my head what 2.3 brings in. AFAIK Spree does not force a particular version (or maybe we remove that restriction), so we could consider upgrading it before we finish with Spree.

Write OFN in current rails 3.2 in a way that the migration to rails 4 will be a breeze.

I've been here already 🙈 . This will indeed require refactoring some calls to ActiveRecord methods and possibly other changes to the Gemfile. Someone can start with the former if we prepare detailed and scoped issues. Upgrade guide: https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0

@jhsu802701 it might be interesting to take a quick look at upgrading pg. Whether the version is restricted and if not what are its implications 🤔

@mkllnk
Copy link
Member

mkllnk commented Nov 1, 2018

Quick scan into the guide.

  • Update from put to patch. We have some uses:
> grep put config/routes/*
config/routes/admin.rb:        put :register
config/routes/admin.rb:      put :bulk_update, on: :collection
config/routes/admin.rb:      put :cancel, on: :member
config/routes/admin.rb:      put :pause, on: :member
config/routes/admin.rb:      put :unpause, on: :member
config/routes/admin.rb:      put :cancel, on: :member, format: :json
config/routes/admin.rb:      put :resume, on: :member, format: :json
config/routes/spree.rb:  put 'credit_cards/new_from_token', to: 'credit_cards#new_from_token'
config/routes/spree.rb:    put :cancel, on: :member
  • We use the assets group in the Gemfile.
  • vendor/plugins is unused and can be removed.
  • lots of ActiveRecord stuff needs updating, for example scopes syntax and find_by_* methods.
  • ...

A lot of things can't be done in Rails 3.2, but as @sauloperez mentioned, some of the ActiveRecord stuff can already be done.

@luisramos0
Copy link
Contributor

The spree upgrade to rails 4 is only in spree 2.1 here

@luisramos0
Copy link
Contributor

I created #3708 now to represent the upgrade to spree 2-1-0 together with the upgrade to rails 4.
Although there's some discussion about rails 4 in this issue we can keep this issue and it's title to represent the upgrade of ruby from 2.1.5 to ruby 2.2, is this ok for everyone?

I read a little about the ruby versions after 2.1.5, the only thing that clearly stands out from all the release notes from 2.1 (end of 2014) to 2.6 (end of 2018) is that every single version makes significant performance improvements. So, upgrading ruby version is not only moving to supported versions of ruby is also making OFN run faster, which means happier users or less money on servers for the same capacity.

This can be done at any time now: both rails 3.2 and rails 4.0 support ruby 2.2.

In terms of priority, I believe this can either be picked up by the community (anyone can try to move ofn to ruby 2.2) or we can put it in our tech debt backlog after the upgrade to spree 2-1-0 #3708.

@Matt-Yorkley
Copy link
Contributor

In theory we can upgrade Ruby from 2.1.5 to 2.1.10 now without any hassle. Minor versions should all be compatible.

I had a quick try at upgrading to 2.2.x the other week but there were some issues.

@sauloperez
Copy link
Contributor

sauloperez commented Sep 4, 2019

could you list which ones @Matt-Yorkley I'd like to understand how hard it would be to upgrade. It's blocking few things and that will only exacerbate over time.

@mkllnk
Copy link
Member

mkllnk commented Sep 5, 2019

I looked that up recently as well. A Ruby 2.1 upgrade should be no problem as you said. I upgraded Fair Food to 2.2 and needed to add one Rails gem dependency (bug in our Rails). I also had to patch one spec because an array was returned in a different order. It was very easy.

@sauloperez
Copy link
Contributor

was it the test gem or rake? Let's push it then 💪 !

@Matt-Yorkley
Copy link
Contributor

We're currently upgrading from 2.1.5 to 2.1.9 as a simple trial run.

We should try upgrading to 2.2.x soon, which is a much bigger jump.

@sauloperez
Copy link
Contributor

We need to learn from this upgrade and put the necessary automation/processes in place so upgrading becomes as easy as cake and get up to date soon both reliably and efficiently.

@sigmundpetersen
Copy link
Contributor

Shall we close this? I guess we're not upgrading Ruby further until Rails is upgraded?

@Matt-Yorkley
Copy link
Contributor

We can probably close this now, but I might try bumping to 2.3.8 to see if it works...

@sigmundpetersen
Copy link
Contributor

Okay let's keep it open then. No prob

This was referenced Nov 27, 2019
@luisramos0
Copy link
Contributor

#4518 is merged 🎉
we are on Ruby 2.3.7 🎉
We agreed that we cant upgrage ruby any further before we get to Rails 4.0 (in spree 2.1) or maybe even only after Rails 4.1 (rails 4.1 comes on spree 2.3, I dont think we will get there), that probably means we will be independent of Spree before we make another ruby upgrade.
So, I'd say we can close this.
Is this correct @Matt-Yorkley?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants