Skip to content

Maintenance: Fork wkhtmltopdf to remove unneeded binaries and reduce slug size - #2804

Merged
kevinrobinson merged 2 commits into
masterfrom
patch/wkhtmltopdf-gem
Apr 8, 2020
Merged

kevinrobinson merged 2 commits into
masterfrom
patch/wkhtmltopdf-gem

Conversation

@kevinrobinson

@kevinrobinson kevinrobinson commented Apr 8, 2020

Copy link
Copy Markdown
Contributor

Heroku has a slug size limit, and we ran into it a few weeks ago. I figured it was from checking in large image assets related to reading, but turns out it was also driven by updating the wkhtmltopdf-binary gem.

That gem bundles up binaries for wkhtmltopdf on different platforms, and in that release it increased its coverage for more OS versions, which meant the size of the gem increased ~5x to almost 300MB, which is already at the soft limit for slug size just on its own. On a dyno:

$ du -sh vendor/bundle/ruby/2.6.0/gems/* | sort -hr
288M	vendor/bundle/ruby/2.6.0/gems/wkhtmltopdf-binary-0.12.5.4

This PR adds comments to that issue upstream in the Gemfile, and swaps to a fork of the gem that limits the binaries to only Ubuntu 18 and OSX, which is all we need for this project. That lets us keep the same developer setup and not add any other config complexity, while reducing the slug size by ~250MB of inert bytes, so we can deploy again.

For posterity, I also tried dropping in rposborne/wkhtmltopdf-heroku but it didn't just work, so instead of investigating that I switched to forking.

@kevinrobinson

Copy link
Copy Markdown
Contributor Author

selfie

@kevinrobinson
kevinrobinson merged commit 498c3e7 into master Apr 8, 2020
@kevinrobinson
kevinrobinson deleted the patch/wkhtmltopdf-gem branch April 8, 2020 18:44
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.

1 participant