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

Reintroduce ghostscript for heroku-24 #324

Merged
merged 2 commits into from
Sep 4, 2024
Merged

Conversation

joshwlewis
Copy link
Member

@joshwlewis joshwlewis commented Aug 27, 2024

We've received some feedback about ghostscript (which was included in Heroku-18, Heroku-20, and Heroku-22, but was not included in Heroku-24):

Removing ghostscript has an effect on imagemagick based libraries on Python(eg. wand etc). We had to revert to using a custom buildpack(https://github.com/Airbase/heroku-buildpack-ghostscript) to install these back. The imagemagic libraries are fairly common in the python world to do PDF, image manipulations, thumb-nailing etc.

So, while not being used directly a ton, folks do use ghostscript via ImageMagick to work with PDFs.

Other packages we could consider:

- libgs10
- gsfonts

GUS

@edmorley
Copy link
Member

Does the APT buildpack work for installing ghostscript?

@joshwlewis
Copy link
Member Author

joshwlewis commented Aug 27, 2024

Does the APT buildpack work for installing ghostscript?

In my testing (with CNBs), no. gs needs libXt.so.6 which comes from libxt6t64. libxt6t64 is installed on heroku/heroku:24-build, so the Debian packages CNB won't install it. libxt6t64 is not present on the heroku/heroku:24 image, though, so gs fails at runtime.

If we would rather make ghostscript installable by the Debian packages CNB, we might have to add libxt6t64 to the run image. This library is probably in the same bucket as those in #317.

@edmorley
Copy link
Member

edmorley commented Aug 27, 2024

Checking against the nightly image tag (since that has #321), the size impact of adding Ghostscript isn't as bad as I would have thought (albeit it still is +10%):

$ dr --user root heroku/heroku:24.nightly bash -c 'apt-get update -qq && apt-get install --no-install-recommends ghostscript'
Unable to find image 'heroku/heroku:24.nightly' locally
24.nightly: Pulling from heroku/heroku
1567e7ea90b6: Pull complete
1bb2a64922ff: Pull complete
Digest: sha256:5afdec7165e02ba0334afc2b1246c9ce3b9ad94e4c79082ee3fae73a065573a3
Status: Downloaded newer image for heroku/heroku:24.nightly
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libavahi-client3 libavahi-common-data libavahi-common3 libcups2t64 libdbus-1-3 libgs-common libgs10 libgs10-common libice6 libidn12 libijs-0.35 libjbig2dec0 libpaper1 libsm6
  libxt6t64 poppler-data
Suggested packages:
  texlive-binaries cups-common fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum
Recommended packages:
  dbus fonts-droid-fallback libpaper-utils
The following NEW packages will be installed:
  ghostscript libavahi-client3 libavahi-common-data libavahi-common3 libcups2t64 libdbus-1-3 libgs-common libgs10 libgs10-common libice6 libidn12 libijs-0.35 libjbig2dec0
  libpaper1 libsm6 libxt6t64 poppler-data
0 upgraded, 17 newly installed, 0 to remove and 46 not upgraded.
Need to get 7481 kB of archives.
After this operation, 44.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] n

Other packages we could consider:

  • libgs9
  • gsfonts

ghostscript already transitively depends of libgs10, so we don't need to add an explicit libgsNN dep.

And gsfonts is only a transitional package that wraps fonts-urw-base35 (which itself is both a transitive dep of ghostscript and also included after #321):
https://packages.ubuntu.com/noble/gsfonts

...so we don't need to explicitly include gsfonts either.

@edmorley
Copy link
Member

Fwiw I'd be fine with either adding back ghostscript, or else adding libxt6t64 and mentioning using the APT buildpack for ghostscript in the Heroku-24 migration guide.

@joshwlewis
Copy link
Member Author

The full Aptfile to get gs --version working with the classic buildpack heroku-buildpack-apt:

ghostscript
libxt6t64
libidn12
libsm6
libice6

Though, gs still throws errors about not being able to find initialization scripts. This can be solved by manually setting GS_LIB. I say this just to illustrate the point that the apt and debian packages buildpacks won't get users all the way to a working gs and some extra steps are needed.

If we want to support installation via the Debian packages CNB, we'd need to addlibxt6t64, libidn12, libsm6, libice6 to the run image. These are all in heroku/heroku:24-build, but not heroku/heroku:24, so the Debian packages CNB won't install them.

@edmorley
Copy link
Member

edmorley commented Aug 27, 2024

Hmm yeah so adding ghostscript to the run image is sounding like the easier option for now.

Though long long term, if we introduce a slim image, I suppose we'll want to update the Debian packages CNB to set GS_LIB as one of the compatibility env vars it sets, which would then make it possible to use the slim image and add ghostscript via the CNB.

@colincasey
Copy link
Contributor

Tried installing ghostscript using the deb CNB and @joshwlewis is correct. We need to be careful with packages we add to the build image but not the run image or find some way to detect this build/runtime discrepancy.

@joshwlewis joshwlewis marked this pull request as ready for review September 4, 2024 15:38
@joshwlewis joshwlewis requested a review from a team as a code owner September 4, 2024 15:38
@joshwlewis joshwlewis merged commit 7dfd9dd into main Sep 4, 2024
10 checks passed
@joshwlewis joshwlewis deleted the jwl/heroku-24-ghostscript branch September 4, 2024 21:01
dzuelke added a commit that referenced this pull request Sep 12, 2024
It's now already included after the recent re-introduction of ghostscript in #324
dzuelke added a commit that referenced this pull request Sep 23, 2024
* Add some missing runtime libraries to heroku-22

- libgeoip1 because of libgeoip-dev
- libhashkit2 because of libhashkit-dev
- libmemcachedutil2 because of libmemcached-dev
- libnetpbm10 because of libnetpbm10-dev
- libwmf-0.2-7 because of libwmf-dev

GUS-W-16381871

* Add some missing runtime libraries to heroku-24

- libgirepository-1.0-1 because of libgirepository1.0-dev and libgirepository-1.0-dev
- libidn12 because of libidn-dev
- libmemcachedutil2t64 because of libmemcached-dev
- libwebpdecoder3 because of libwebp-dev
- libwmf-0.2-7 because of libwmf-dev

GUS-W-16381871

* Remove explicit libidn12 install from heroku-24 again

It's now already included after the recent re-introduction of ghostscript in #324

* Drop libgeoip1 from heroku-22 again

As discussed in #317, we removed this from heroku-24, and it hasn't come up as an issue report.

* Drop libgirepository-1.0-1 amd64-only install from heroku-24 again

As discussed in #317
@jrochkind
Copy link

Hi, this is effecting me, can anyone say if it's available on heroku-24 publicly yet, or if not expected timeline? Thank you!

@edmorley
Copy link
Member

edmorley commented Oct 24, 2024

@jrochkind Hi! This was released in https://github.com/heroku/base-images/releases/tag/v135 which was rolled out to the Common Runtime on Sept 24/25th (and checking Private Spaces deployments, rollout there finished ~29th):
https://devcenter.heroku.com/changelog-items/2991

eg:

$ heroku run bash
...
~ $ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.1 LTS
Release:	24.04
Codename:	noble

~ $ dpkg --list | grep ghostscript
ii  ghostscript                       10.02.1~dfsg1-0ubuntu7.3          amd64        interpreter for the PostScript language and for PDF

@jrochkind
Copy link

thanks very much for this!

joshwlewis added a commit that referenced this pull request Oct 25, 2024
* Reintroduce ghostscript for heroku-24

* Update installed-packages lists for heroku-24 w/ ghostscript
joshwlewis pushed a commit that referenced this pull request Oct 25, 2024
* Add some missing runtime libraries to heroku-22

- libgeoip1 because of libgeoip-dev
- libhashkit2 because of libhashkit-dev
- libmemcachedutil2 because of libmemcached-dev
- libnetpbm10 because of libnetpbm10-dev
- libwmf-0.2-7 because of libwmf-dev

GUS-W-16381871

* Add some missing runtime libraries to heroku-24

- libgirepository-1.0-1 because of libgirepository1.0-dev and libgirepository-1.0-dev
- libidn12 because of libidn-dev
- libmemcachedutil2t64 because of libmemcached-dev
- libwebpdecoder3 because of libwebp-dev
- libwmf-0.2-7 because of libwmf-dev

GUS-W-16381871

* Remove explicit libidn12 install from heroku-24 again

It's now already included after the recent re-introduction of ghostscript in #324

* Drop libgeoip1 from heroku-22 again

As discussed in #317, we removed this from heroku-24, and it hasn't come up as an issue report.

* Drop libgirepository-1.0-1 amd64-only install from heroku-24 again

As discussed in #317
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.

5 participants