My server has Ruby 2.6.5 and there are some Rails applications which run on this server. I would like to deploy another Rails application to this server. My local machine (development machine) has Ruby 3.1.2 which is installed by rbenv
. I use Capistrano to be able to deploy.
Questions:
deploy.rb
file in Capistrano for rbenv
? It should be my server Ruby version or my local Ruby version?You should not be developing/testing on another Ruby version as this is known to cause problems when the code is actually deployed. You want to find out about incompatibilities or inconsistencies by tanking your production server.
This is very likely if you're not even using the same major version. Between Ruby 2.6 and 3.0 there was a lot of changes to how keyword arguments are handled and new features were introduced like argument forwarding which are breaking changes.
You need to achieve dev/prod parity either by changing the Ruby version used in the production environment or development/testing so that they match.
Should I install ruby 3.1.2 on my server to be able to deploy my new application?
Yes. Ruby 2.6 was EOL:ed 31 Mar 2022.