Engine Yard's Stack v6 supports Ruby 3, though at this time it is not a selectable option for the Ruby version when creating or editing an environment. It must instead be set as the Ruby version in use via the environment's Environment Variables.
- For details on how to set Environment Variables please see this related article.
- For details on the Environment Variables available to be set please see this readme.
Setting the Ruby version
In the specific case of Ruby 3, the Environment Variable to set is
EY_RUBY_VERSION and this can be set to the either a stable version (e.g.
3.0) or a specific version (e.g.
3.1.0-preview1), as required.
The version set on the Edit Environment page will then be overruled, so can be left set to the existing value.
Installing and utilising the new Ruby
Installation of the new Ruby version should be handled before deployment of the application release requiring it. To install the new Ruby version an Apply should be run on the environment. The version can then be checked via
ruby -v on the instance(s).
At this stage the new Ruby version is installed and is the default, but to utilise the new version worker processes must be restarted. However, application gems are installed for specific Ruby versions, so to ensure the workers can restart correctly the gems require installing under Ruby 3. To do this re-deploy the current version of your application (the Ruby 2.x compatible version), as the deployment will install gems under the active Ruby 3, but the workers will continue to run under Ruby 2.x.
This happens because an application deployment only refreshes application workers (Unicorn, Passenger & Puma), and a full restart is needed for the process to fully respawn and so the new Ruby version be utilised. To do this, on all application instances, a
sudo monit restart all -g [groupname] should be issued, where
[groupname] is found by running
sudo cat /etc/monit.d/[unicorn/passenger/puma]_[appname] (dependent on the application server in use). Background workers should be being handled by deploy hooks, so should be restarted as part of the deploy in the next step, but can also be restarted manually via Monit on all applicable instances if required.
Once the application workers are fully restarted they will be running under Ruby 3, but still serving the Ruby 2.x version of the application. They are now ready for the Ruby 3 release of the application to be deployed.
NOTE: In order to be compatible with Ruby 3, the stable-v6 stack makes use of a higher version of the Engine Yard Serverside gem (which handles the instance side deployment) than the previous stacks. This version of Serverside also automatically handles any deploy hooks required by services configured via Environmental Variables.