Giter Club home page Giter Club logo

heroku-buildpack-xvfb-google-chrome's Introduction

heroku-buildpack-xvfb-google-chrome

This buildpack downloads and installs Xvfb and Google Chrome from your choice of release channels.

Note that Google Chrome now has a --headless flag, so for many applications, Xvfb may not be required. If so, consider this buildpack instead.

Only supported on Cedar-14

Note that this buildpack only works on Cedar-14 stack. For the Heroku-16 stack only the Headless Chrome buildpack is supported. For more details see Known Issues for Heroku CI.

Channels

You can choose your Chrome release channel by specifying GOOGLE_CHROME_CHANNEL as a config var for your app, in your app.json (for Heroku CI and Review Apps), or in your pipeline settings (for Heroku CI).

Valid values are stable, beta, and unstable. If unspecified, the stable channel will be used.

Shims and Command Line Flags

This buildpack installs shims that always add --disable-gpu and --no-sandbox to any google-chrome command as you'll have trouble running Chrome on a Heroku dyno otherwise.

You'll have two of these shims on your path: google-chrome and google-chrome-$GOOGLE_CHROME_CHANNEL. They both point to the binary of the selected channel.

Selenium

To use Selenium with this buildpack, you'll also need Chrome's webdriver. This buildpack does not install chromedriver, but there is a chromedriver buildpack also available.

Additionally, chromedriver expects Chrome to be installed at /usr/bin/google-chrome, but that's a read-only filesystem in a Heroku slug. You'll need to tell Selenium/chromedriver that the chrome binary is at /app/.apt/usr/bin/google-chrome instead.

To make that easier, this buildpack makes $GOOGLE_CHROME_BIN, and $GOOGLE_CHROME_SHIM available as environment variables. With them, you can use the standard location locally and the custom location on Heroku. An example configuration for Ruby's Capybara:

chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil)

chrome_opts = chrome_bin ? { "chromeOptions" => { "binary" => chrome_bin } } : {}

Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.new(
     app,
     browser: :chrome,
     desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(chrome_opts)
  )
end

Releasing a new version

Make sure you publish this buildpack in the buildpack registry

heroku buildpacks:publish heroku/xvfb-google-chrome master

heroku-buildpack-xvfb-google-chrome's People

Contributors

joshwlewis avatar gudmundur avatar raulb avatar appleton avatar jabrown85 avatar kwlockwo avatar fivetanley avatar deioo avatar

Watchers

James Cloos avatar Evan Anthony avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.