i have this bookmarking app running on rails 7 ruby 3.1.2 and i want to take screenshots. i have added puppeteer to my package.json with grover to my Gemfile and it is working just fine locally but when i deploy to fly i get this error
Could not find Chromium (rev. 1083080). This can occur if either 1. you did not perform an installation before running the script (e.g. npm install) or 2. your cache path is incorrectly configured (which is: /root/.cache/puppeteer). For (2), check out our guide on configuring puppeteer at Configuration | Puppeteer.
following instructions from other posts in the forum i updated my Dockerfile but i am still getting errors
If there is some reason that gem won’t work for you, I’d like to hear why to see if there is something more I need to support. But even if that gem isn’t of interest of you, a byproduct of my work will be a demo that you can run and steal from.
thank you for taking the time to look into my issue
the way i see it this is a problem with puppeteer not being present. as far as i understood grover gem uses puppeteer to generate screenshots.
Rails deciding to generate a Dockerfile as well must be like throwing a major spanner into the fly cogs
The setup with puppeteer and grover is working just fine locally but at the same time it doesn’t have to be those exact tools so if you are aware of a way to get screenshots that is already supported by fly i would love to hear about it.
also there is no time pressure, i am happy waiting couple of weeks for a resolution
i have previously used watir on VPS where installed literally every package imaginable but with the same disappointing outcome. the underlying problem is the same, in order to grab a screenshot those gems need to start up an actual browser session that will visit a given url.
As the saying goes, Good artists copy, Great artists steal
thanks for putting the demo together! it works great
i ended up coping the commands for google-chrome and the ENVs for now
i don’t really plan to use the Dockerfile from rails anyway. as you might have figured out by now i am not a big fan of Docker
i am now able to get screenshot in my app for the first time since i first deployed it
Hey, I had a similar issue, Grover complaining about not finding node:
2024-11-29T21:47:45Z app[080e394b57edd8] sea [info][0fba5ab5-fc08-408a-9942-a3164d37594b] Errno::ENOENT (No such file or directory - node):
The Dockerfile resulting from rails generate dockerfile adds node to the build stage only. So I added it to the final stage, and Grover now works for me. @rubys not sure if this is a reasonable solution; might want to add it to dockerfile-rails
FROM base # final stage
# ...
+# Copy Node.js installation from the build stage
+COPY --from=build /usr/local/node /usr/local/node
# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
@@ -82,9 +84,8 @@ USER 1000:1000
ENV GROVER_NO_SANDBOX="true" \
PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium" \
RAILS_LOG_TO_STDOUT="1" \
-
-RAILS_LOG_TO_STDOUT="1" \
- RAILS_SERVE_STATIC_FILES="true"
+ RAILS_SERVE_STATIC_FILES="true" \
+ PATH="/usr/local/node/bin:$PATH"