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

Configure passenger to load bundler before loading app #4498

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

hackartisan
Copy link
Member

This helps avoid gem version conflicts like the one encountered in
pulibrary/pulfalight#1353

@hackartisan hackartisan marked this pull request as draft December 4, 2023 19:34
@hackartisan
Copy link
Member Author

This worked to fix the bug I encountered in staging. However, in qa it can't find the version of bundler it expects. Gives the following error:

[ E 2023-12-12 17:47:34.3255 32259/Tb age/Cor/Con/CheckoutSession.cpp:283 ]: [Client 2-4] Cannot checkout session because a spawning error occurred. The identifier of the error is 6e99a940. Please see earlier logs for details about the error.
App 32473 output: /usr/local/lib/ruby/site_ruby/3.1.0/rubygems.rb:264:in `find_spec_for_exe'
App 32473 output: :
App 32473 output: can't find gem bundler (= 2.4.21) with executable bundle
App 32473 output:  (
App 32473 output: Gem::GemNotFoundException
App 32473 output: )
App 32473 output:
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/rubygems.rb:244:in `bin_path'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler/rubygems_integration.rb:178:in `bin_path'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler/shared_helpers.rb:297:in `set_bundle_variables'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler/shared_helpers.rb:76:in `set_bundle_environment'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler/runtime.rb:20:in `setup'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler.rb:162:in `setup'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler/setup.rb:23:in `block in <top (required)>'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler/ui/shell.rb:159:in `with_level'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler/ui/shell.rb:111:in `silence'
App 32473 output:       from /usr/local/lib/ruby/site_ruby/3.1.0/bundler/setup.rb:23:in `<top (required)>'
App 32473 output:       from <internal:/usr/local/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
App 32473 output:       from <internal:/usr/local/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
[ E 2023-12-12 17:47:44.7337 32259/Tz age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /opt/pulfalight/current: The application process exited prematurely.
  Error ID: 7852da51
  Error details saved to: /tmp/passenger-error-adxrrn.html

bundler version on both environments is 2.3.18

@hackartisan hackartisan force-pushed the pulfalight#1116-preload-bundler branch from 2c82eb6 to 37ec0c5 Compare December 15, 2023 22:16
@hackartisan hackartisan marked this pull request as ready for review December 27, 2023 21:56
@hackartisan hackartisan force-pushed the pulfalight#1116-preload-bundler branch from 37ec0c5 to d5ab22e Compare December 28, 2023 20:28
@hackartisan
Copy link
Member Author

Note that I also had to upgrade bundler on the box to get this option working right. But I did test it both with and without an override variable and I believe this is good to merge; ready for review.

Copy link
Member

@sandbergja sandbergja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this passenger config, @hackartisan ! This will help with some DACS applications as well, I'm looking forward to copying it 😂.

@carolyncole carolyncole merged commit 757768a into main Jan 5, 2024
72 checks passed
@carolyncole carolyncole deleted the pulfalight#1116-preload-bundler branch January 5, 2024 12:43
hackartisan added a commit that referenced this pull request Jan 9, 2024
Modern versions of bundler comply with gemfile configuration by checking
the "bundled with" line and downloading the desired bundler version
before executing bundler. (if it's already installed it'll just use the
correct installed version). This means we don't need to manage bundler
versions carefully like we did before.

Also, this specific bundler version management causes problems in the
context of the changes introduced in
#4498 -- when
passenger preloads bundler, ruby looks for a version of bundler that
appears to be locked in at installation time when installed from source.
I couldn't find a way to configure ruby to use a specific bundler
version during installation from source. So we have to ensure that the
version that ruby will look for is installed.
hackartisan added a commit that referenced this pull request Jan 17, 2024
Modern versions of bundler comply with gemfile configuration by checking
the "bundled with" line and downloading the desired bundler version
before executing bundler. (if it's already installed it'll just use the
correct installed version). This means we don't need to manage bundler
versions carefully like we did before.

Also, this specific bundler version management causes problems in the
context of the changes introduced in
#4498 -- when
passenger preloads bundler, ruby looks for a version of bundler that
appears to be locked in at installation time when installed from source.
I couldn't find a way to configure ruby to use a specific bundler
version during installation from source. So we have to ensure that the
version that ruby will look for is installed.
hackartisan added a commit that referenced this pull request Jan 17, 2024
Modern versions of bundler comply with gemfile configuration by checking
the "bundled with" line and downloading the desired bundler version
before executing bundler. (if it's already installed it'll just use the
correct installed version). This means we don't need to manage bundler
versions carefully like we did before.

Also, this specific bundler version management causes problems in the
context of the changes introduced in
#4498 -- when
passenger preloads bundler, ruby looks for a version of bundler that
appears to be locked in at installation time when installed from source.
I couldn't find a way to configure ruby to use a specific bundler
version during installation from source. So we have to ensure that the
version that ruby will look for is installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants