Repository navigation
Stop staging boot from aborting on old libvips - #294
Merged
Merged
Conversation
Rails 8.1.3.1 aborts boot when ruby-vips loads against libvips older than 8.13. This app only resizes Action Text images, so drop ruby-vips and use MiniMagick. Co-authored-by: rsmoke <rsmoke@umich.edu>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the switch from ruby-vips to MiniMagick for Active Storage image variants.
No open issues 🎉
What changed in this PR
This PR addresses staging boot failures on older system libvips by removing ruby-vips from the bundle and switching Active Storage image variants to MiniMagick.
Changes:
- Upgrade
image_processingto 2.x and explicitly declaremini_magick. - Configure Active Storage to use MiniMagick for Action Text image resizing.
- Add regression specs checking processor selection, MiniMagick availability, and ruby-vips exclusion.
| File | Description |
|---|---|
spec/config/active_storage_variant_processor_spec.rb |
Adds four configuration and dependency regression checks. |
Gemfile.lock |
Locks image_processing to 2.2.0 and removes ruby-vips and ffi. |
Gemfile |
Updates image-processing dependencies and documents the boot workaround. |
config/application.rb |
Selects MiniMagick as the Active Storage variant processor. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
Release
20261110150937(commit73f66b96dc43d4959984bd1128333e7fc9e6b6b4, Rails 8.1.3.1) dies while booting because Active Storage callsVips.block_untrusted(true). ruby-vips 2.2.2 only defines that method when the system libvips is 8.13 or newer. Staging's libvips is older, so the method is missing and rake aborts inactive_storage/vips.rb.The lockfile already had ruby-vips 2.2.2. Pinning the gem cannot upgrade the host library. The Gem::Platform warnings from bundler 2.5.9 are unrelated.
What the app actually uses
ruby-vips is not called from application code. image_processing 1.x pulled it in, and
config.load_defaults 8.1selects the:vipsprocessor.rails_blob_path, not variants.app/views/active_storage/blobs/_blob.html.erb(resize_to_limit). The Trix attach button is hidden.Change
image_processingto~> 2.0(resolved 2.2.0), where ruby-vips and mini_magick are optional, and leave ruby-vips out of the bundle.mini_magick~> 4.13(still 4.13.2) and setconfig.active_storage.variant_processor = :mini_magick.On 8.1.3.1 the Vips analyzer loads at boot, and a missing ruby-vips is a rescued
LoadError. The Vips transformer is not: itsLoadErrordoes not match the engine's rescue and would still abort boot if the processor stayed:vips. MiniMagick keeps Action Textresize_to_limitworking. The untrusted-loader check is unchanged; libvips is simply not loaded.Hatchbox
No package change is required before the next deploy. Boot no longer needs libvips >= 8.13, and a Gemfile pin would not have installed it.
Rich-text image previews now use ImageMagick (
convert). If those previews later fail with a MiniMagick error, install theimagemagickapt package. That is request-time only, not a boot requirement. Ubuntu 22.04'slibvips42(8.12.1) is what makes the old path unsecurable; Ubuntu 24.04'slibvips42t64(8.15.1) would satisfy the check if vips were kept.Tests
spec/config/active_storage_variant_processor_spec.rb(4 examples, 0 failures).RAILS_ENV=test rails runnerboots withvariant_processor=mini_magickandVIPS_AVAILABLE=false. A generated PNG resized withresize_to_limitvia MiniMagick.spec/models/entry_spec.rbdid not finish here:config/storage.ymlevaluates a missing GCS credentials path when factories touch Active Storage (no master key in this environment).