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

feat(preview-service): install chromium browser as a dependency at build time not runtime #2019

Merged
merged 8 commits into from
Jun 18, 2024

Conversation

iainsproat
Copy link
Contributor

@iainsproat iainsproat commented Feb 6, 2024

Description & motivation

Currently pupeeteer will download its own version of Chromium. This slows startup time when puppeteer is run, and consumes network bandwidth.

This is unnecessary if chromium is installed on the image and puppeteer configured to use the existing installed version

This PR also tidies up the DockerFile to install chromium using its package rather than installing all dependencies individually.

Changes:

To-do before merge:

Screenshots:

Validation of changes:

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References

@iainsproat iainsproat marked this pull request as ready for review February 6, 2024 17:52
@iainsproat
Copy link
Contributor Author

Fails on arm64 apple with

/speckle-server/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267
                reject(new Error([
                       ^

Error: Failed to launch the browser process!
The hardware on this system lacks support for the sse3 instruction set.
The upstream chromium project no longer supports this configuration.
For more information, please read and possibly provide input to their
bug tracking system at http://crbug.com/1123353


TROUBLESHOOTING: https://pptr.dev/troubleshooting

    at Interface.onClose (/speckle-server/node_modules/@puppeteer/browsers/lib/cjs/launch.js:267:24)
    at Interface.emit (node:events:529:35)
    at Interface.close (node:internal/readline/interface:534:10)
    at Socket.onend (node:internal/readline/interface:260:10)
    at Socket.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.19.0

@iainsproat iainsproat marked this pull request as draft June 18, 2024 09:34
@iainsproat iainsproat changed the title fix(preview-service): install chromium browser as a dependency fix(preview-service): install chromium browser as a dependency at build time not runtime Jun 18, 2024
@iainsproat iainsproat changed the title fix(preview-service): install chromium browser as a dependency at build time not runtime feat(preview-service): install chromium browser as a dependency at build time not runtime Jun 18, 2024
@iainsproat iainsproat closed this Jun 18, 2024
@iainsproat iainsproat reopened this Jun 18, 2024
@iainsproat
Copy link
Contributor Author

Fails on arm64 apple

Works with:

docker build -f ./packages/preview-service/Dockerfile -t preview-service .
docker run --rm -p 3001:3001 -e PG_CONNECTION_STRING=postgres://speckle:speckle@host.docker.internal/speckle preview-service

Executing into the running container, the executable works at /usr/bin/chromium.

@iainsproat iainsproat marked this pull request as ready for review June 18, 2024 19:47
@iainsproat iainsproat merged commit aed61ad into main Jun 18, 2024
21 of 23 checks passed
@iainsproat iainsproat deleted the iain/fix-forward-puppeteer branch June 18, 2024 19:47
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