Our app was already deployed and working on Heroku with MiniMagick. There were a few features of Image Processing that were appealing, performance and autorotation, and it appeared to be a straightforward swap.
Locally, we had run brew install vips
on our MacBooks to get it running. That was early in the process and a detail long forgotten. When I deployed to Heroku @juliancheal pointed out that the staging environment was failing with an ActiveSupport::MessageVerifier::InvalidSignature
error.
We were able to quickly identify the missing libvips
dependency.
Figuring out how to install libvips
to support rubyvips
to support Image Processing was not trivial and therefore this guidepost exists.
The heroku/ruby
buildpack does not include libvips
. In order to add it we need to add a buildpack that includes libvips
. There are many to choose from in the Heroku Elements marketplace (over 20 at the time of this writing).
It may be slightly arbitrary but, we chose the buildpack from @brandoncc because it had the most installs/activity.
heroku buildpacks:add --index 1 https://github.com/brandoncc/heroku-buildpack-vips
This buildpack also takes an environment variable to determine which version of libvips
to install. We chose the latest version, 8.9.2.
heroku config:set VIPS_VERSION=8.9.2
That turned out to not be enough as libvips
now had unmet dependencies. A little digging led to a Github issue thread featuring, unsurprisingly, @schneems.
To install the dependencies we followed @matpowel's suggestion and added another buildpack this time adding apt
, a linux package management tool.
heroku buildpacks:add --index 1 heroku-community/apt
Note: Because of the discovery process each of these items were given an index of 1 which placed them at the top of the buildpack order. The Apt buildpack should come first.
Finally, we need to tell apt
which libraries to install. We do this by creating an Aptfile
in the root of our repository with the following contents:
libglib2.0-0
libglib2.0-dev
libpoppler-glib8
libheif-dev
Hopefully, this helps future readers even if it's just us.
Did we get something wrong? Is there a better way to do this? Let us know: [email protected]
Flagrant is a team of software developers intent on making the digital more humane.
Thanks @bigtiger!
I had to update the Aptfile to include
libheif-dev
instead oflibheif
for this to work.