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

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

Merged
merged 2 commits into from Apr 8, 2020

Conversation

kevinrobinson
Copy link
Contributor

@kevinrobinson kevinrobinson commented Apr 8, 2020

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
Contributor Author

kevinrobinson commented Apr 8, 2020

selfie

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

None yet

1 participant