Support overriding Chrome binary via IBEAM_CHROME_BINARY_PATH (+ --disable-dev-shm-usage)#282
Support overriding Chrome binary via IBEAM_CHROME_BINARY_PATH (+ --disable-dev-shm-usage)#282Srain021 wants to merge 2 commits into
Conversation
…m-usage Allow overriding the browser binary path via IBEAM_CHROME_BINARY_PATH. This helps on hosts where Google Chrome is not available but a compatible Chromium build is (for example on aarch64 Linux, where Debian provides chromium). When the env var is unset, Selenium's default Chrome lookup is preserved, so this change is opt-in and non-breaking. Also add --disable-dev-shm-usage unconditionally. It avoids /dev/shm sizing limits inside containers and is a no-op otherwise, which is a common recommendation for Selenium in Docker. Tested on aarch64 Linux with Debian bookworm chromium + chromium-driver: headless login + TOTP auto-entry completed successfully and the session persisted across container restarts.
|
Hey @Srain021 - great contribution, I appreciate you spotting this issue and proposing a fix. Also appreciate the details and the questions. To address them:
I think it would be reasonable to add
Very much in line, fantastic choice 👍
The documentation currently lives in the WiKi, hence if you could write a small section for Troubleshooting we could include it there: https://github.com/Voyz/ibeam/wiki/Troubleshooting |
…HM_USAGE Per review feedback on Voyz#282, make the --disable-dev-shm-usage flag opt-in via a new IBEAM_DISABLE_DEV_SHM_USAGE env var (default False) instead of applying it unconditionally. Users running in containers with constrained /dev/shm can opt in; everyone else gets unchanged behaviour.
|
Apologies for the slow turnaround — this is my first time contributing to an open-source project, so it took me a bit to work through the review carefully. Thanks for your patience! Pushed
Suggested Wiki addition (Troubleshooting → "Browser fails to start")Symptom: IBeam fails on startup with errors such as Two opt-in environment variables can help:
|
|
Hey @Srain021 - appreciate you making adjustments. And it's not a slow turnaround at all - you're welcome to take your time with this. The Troubleshoot wiki addition has been very obviously written by an AI. Please go through it and tidy it up and I'll be happy to add it in. |
|
Fair point — rewritten. Let me know if this reads better: Chrome binary not found** On hosts without Google Chrome in the default location (e.g. aarch64 Linux where Debian ships IBEAM_CHROME_BINARY_PATH=/usr/bin/chromiumChrome crashes in a container
|
Problem
On hosts where Google Chrome is not available (for example aarch64 Linux, which does not have an official Google Chrome build), IBeam cannot start the browser even though a compatible Chromium build is installed. I hit this on a Debian bookworm container running on aarch64 hardware: stock
voyz/ibeam:0.5.11with the default Chrome path crashes during renderer initialization, while the Debian-packaged Chromium binary works correctly from the same image.There is no existing IBeam env var to point Selenium at an alternative browser binary, so the only workaround today is to vendor IBeam and patch
driver.pylocally.Fix
Two related changes in
ibeam/src/login/driver.pyandibeam/src/var.py:IBEAM_CHROME_BINARY_PATH. When set, it is passed to Selenium asoptions.binary_location. When unset, Selenium's default Chrome lookup is preserved, so this change is opt-in and does not affect existing deployments.--disable-dev-shm-usageto the Chrome options unconditionally. It avoids/dev/shmsizing limits inside containers (a common Selenium-in-Docker recommendation) and is benign otherwise.The new env var follows the same pattern as the existing
IBEAM_CHROME_DRIVER_PATH.Testing
Tested on aarch64 Linux (Debian bookworm-slim) with
apt install chromium chromium-driver:IBEAM_CHROME_BINARY_PATH=/usr/bin/chromium+IBEAM_CHROME_DRIVER_PATH=/usr/bin/chromedriverWithout
IBEAM_CHROME_BINARY_PATHset, behavior is identical to the pre-patch state.Open Questions
--disable-dev-shm-usageacceptable, or would you prefer it gated behind a separate env var (e.g.IBEAM_DISABLE_DEV_SHM_USAGE)?IBEAM_CHROME_BINARY_PATHmirrorsIBEAM_CHROME_DRIVER_PATH. Happy to rename if a different convention is preferred.env.list.exampleupdate for discoverability, or would you rather keep the patch minimal and update docs separately?