I recently upgaded three Rails applications: UAM, Proposals, and Projects from Rails 5.2 to 6.1.7.7 and from Ruby 2.7.4 to Ruby 3.3.1.
The three applications were previously split from the same monolith Proposals application, so are very similar.
UAM and Proposals deployed successfully to the apache 2.4 staging server, where there are two vhosts for each, uam-dev, uam-stage2, proposals-dev, and proposals-stage2.
Projects was finished last. It has four vhosts, projects-dev, projects-stage2, projects-genint, projects-int2. These point to their own respective directories, except projects-genint doubles up with projects-stage2 as a semantic alias hostname. All of these serve fine when their vhosts are configured with PassengerRuby set to 2.7.4 and their current symlink pointed to an older rails 5.2 release of Projects. But when I try to deploy the new version of Projects to any of them and set the PassengerRuby version to 3.3.1, they fail with an error message like this:
+ exec /opt/rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/passenger-6.0.22/buildout/support-binaries/PassengerAgent spawn-env-setupper /tmp/passenger.spawn.XXXXLXAXEL --after
/opt/rbenv/versions/3.3.1/bin/ruby: No such file or directory -- Passenger AppPreloader: /opt/projects_int2/current (LoadError)
in the Error Starting Web Application page from Passenger. I haven’t found anything in logs that hints more as to why this one application of the three won’t run under Passenger, in any of its instances if they are using the newer version of Ruby and the app.
They will run rails console from such a deployed Projects current directory, and puma can run the Projects application there as a test of something being wrong in the Rails application.
I tried adding some logging to one instance in various files in the projects-int2 app, and it showed me that not even boot.rb is getting loaded when trying to run via Apache + Passenger, but all the files I logged as being loaded showed in the log when run at console or via Puma.
I have inspected all the permissions on the various Projects directories and they are the same as for the directories for Proposals and UAM. /opt/projects_int2/current is accessible to the www-data user that runs Apache.
The vhosts are the same as the ones for Proposals and UAM, except for specifying the projects directories and hostnames, and work when configured to Ruby 2.7.4 and current points to an older release of the application.
I have dug through the Projects application trying to find anything significantly different about it that would break it but once I saw that even its boot.rb wasn’t loading, I’m guessing it is not a problem there.
I have backed out all but projects-int2 to the older version to minimize impact on other users of the staging server, using this one to experiment further.
I upgraded to the latest Passenger and made its PassengerDefaultRuby be 3.3.1 without that mattering.
I tried Passenger standalone today and it fails the same way, so that takes the Apache vhost out of being the issue.
1