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
Production deploy failing - slug too big #1135
Comments
I'm gonna try and slim down the slug |
production deploy via travis is failing with a slug over the hard limit of 500MB on heroku. we need to get it under 300MB soft limit. Is there some "writing into the slug" going on? Like some caching or something in the file system? |
|
|
i can see c1e0699 is where we added puppeteer. |
the promoted slug, from staging to prod, will have bits missing -- i've found the bits. It's the pdf generation. puppeteer brings in a headless chrome to do it -- and chrome has gotten bigger over time.
|
I rolled back recent puppeteer upgrades - and that doesn't help. it still brings in the current security patched/stable chrome -- and that's too big for us. I'm gonna leave it with for now. Someone will need to find a way to generated pdfs without all of chrome (i like wicked pdf gem) -- or something else clever. |
some last bit of info - the and heroku counts the compressed size - so you'll see it adds up to over 500M while running, but needs to gzip to less than 500M (preferrably under 300M) |
also there's some writing to local file system still here that we should remove and put into a service like redis.
|
Wkhtmlpdf uses a super old version of WebKit which means it'll fail to render any reasonably modern CSS. I'm really not sure what to do here, will do some research. |
@Br3nda AFAIK this app doesn't use active_storage at all (active_storage is fairly recent in Rails world) so, while we should adjust that setting to silence the warning, active_storage is not really writing to local disk in prod |
Seems this is caused by a bug in puppeteer 1.18.0 puppeteer/puppeteer#4610 - fixed in 1.18.1 apparently. I'll do the upgrade and see what happens |
Hmmm puppeteer/puppeteer#4610 refers to an older version of Puppeteer (current version is 5.3.0) so there is no Puppeteer upgrade to fix this 😞 . |
I had a look at the vendored ruby gems:
We could get rid of skylight pretty easily but 10M won't fix this for us.
are pretty tied into Rails so removing them seems disruptive. I think we'll have to look at replacing/moving puppeteer somehow. |
I installed heroku:repo and ran the following to try and reduce slug size:
I also added the following env var to the production heroku app:
These got the slug size to 427 MB so deploys are working again. |
I don't know of a viable alternative to puppeteer for PDF rendering in the app. We could move puppeteer out to a separate service but that's a goodly chunk of work and would increase the monthly hosting costs a bit so I think we want to avoid doing that as long as possible. |
Wicked pdf gem is a plausible option - have some same-licence opensource code that does this already - i'll have a play and see if it's smaller - we need more room to move. |
I think JY at Ackama recently did some pdf rendering work with a different gem too and I think he said it went pretty well/was relatively painless so we could always ask him what that was if an alternative is needed. |
@Br3nda I've used wicked_pdf on a few projects. The main challenge was that it was based on very old webkit so rendering any kind of modern CSS didn't work (e.g. flexbox). That said, the PDF rendering needs of this app are pretty simple so if you can tweak to the markup for the print view enough then wicked_pdf could be a good option. |
the vocab sheet 'save as PDF' function in production at the moment is not working. It downloads a pdf but then says the file is empty when you try to open it. Saving a pdf via the print menu works fine. Is this related to this issue? |
The text was updated successfully, but these errors were encountered: