Skip to content

Stop staging boot from aborting on old libvips - #294

Merged
rsmoke merged 1 commit into
stagingfrom
cursor/fix-staging-vips-boot-13f6
Nov 10, 2026
Merged

rsmoke merged 1 commit into
stagingfrom
cursor/fix-staging-vips-boot-13f6

Conversation

@rsmoke

@rsmoke rsmoke commented Nov 10, 2026

Copy link
Copy Markdown
Member

Cause

Release 20261110150937 (commit 73f66b96dc43d4959984bd1128333e7fc9e6b6b4, Rails 8.1.3.1) dies while booting because Active Storage calls Vips.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 in active_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.1 selects the :vips processor.

  • Entry files are PDFs and are served with rails_blob_path, not variants.
  • The only resize is the stock Action Text partial app/views/active_storage/blobs/_blob.html.erb (resize_to_limit). The Trix attach button is hidden.

Change

  • Move image_processing to ~> 2.0 (resolved 2.2.0), where ruby-vips and mini_magick are optional, and leave ruby-vips out of the bundle.
  • Declare mini_magick ~> 4.13 (still 4.13.2) and set config.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: its LoadError does not match the engine's rescue and would still abort boot if the processor stayed :vips. MiniMagick keeps Action Text resize_to_limit working. 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 the imagemagick apt package. That is request-time only, not a boot requirement. Ubuntu 22.04's libvips42 (8.12.1) is what makes the old path unsecurable; Ubuntu 24.04's libvips42t64 (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 runner boots with variant_processor=mini_magick and VIPS_AVAILABLE=false. A generated PNG resized with resize_to_limit via MiniMagick. spec/models/entry_spec.rb did not finish here: config/storage.yml evaluates a missing GCS credentials path when factories touch Active Storage (no master key in this environment).

Open in Web Open in Cursor 

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>
Copilot AI balanced review requested due to automatic review settings November 10, 2026 15:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 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_processing to 2.x and explicitly declare mini_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

@rsmoke rsmoke left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good stuff

@rsmoke
rsmoke merged commit e39fb0e into staging Nov 10, 2026
7 checks passed
@rsmoke
rsmoke deleted the cursor/fix-staging-vips-boot-13f6 branch November 10, 2026 15:47
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