I'd like to run xvfb on Heroku. On my mac, I used the dmg to install it. Would anyone have any idea how to go about this on Heroku?
I came across these buildpacks (http://github.com/douglasjsellers/heroku-xvfb-buildpack) - but following the instructions didn't seem to solve the problem as xvfb is still not installed properly. Also, I tried installing the xvfbwrapper (https://pypi.python.org/pypi/xvfbwrapper/0.1.0), but it's still not working on Heroku (apologies for what is potentially a noob question).
Here is the error I get in my logs off of Heroku:
2015-02-24T02:09:16.035298+00:00 app[web.6]: cmd=['Xvfb', '-help']
2015-02-24T02:09:16.035564+00:00 app[web.6]: Program install error!
2015-02-24T02:09:16.035302+00:00 app[web.6]: OSError=[Errno 2] No such file or directory
Here is the code:
temp = tempfile.mkstemp(suffix='.html')
html = os.fdopen(temp[0], "r+")
html.write(cv)
html.seek(0, 0)
display = Display(visible=0, size=(800, 600))
display.start()
# Open the file on Selenium to load the JavaScript
driver = webdriver.Firefox()
driver.get("file://" + temp[1])
I found this question while researching how to update Xvfb for Cedar-14, and I managed to get #2 to work. So here's how:
I used buildpack-apt to install x11-xkb-utils xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic libxfont1 xvfb
.
After running the apt buildpack, you need to patch Xvfb a bit to make everything work smoothly. For that, I used my own run-bash buildpack, but everything that lets you run a bash script during Heroku compile will work. Here's the script I used to patch Xvfb and index the fonts: https://gist.github.com/fxtentacle/960cdb96ece01add8686
Now you can use heroku run bash
to check with XAUTHORITY=/tmp/xvfb-run.2NG0xl/Xauthority Xvfb ":99" -screen 0 1280x1024x24 -nolisten tcp
that the Xvfb is working.
Yes, it is possible, but complicated. I followed some of what fxtentacle did (in their answer), but this may be simpler. These instructions provide for a minimal Xvfb setup; it still prints out a bunch of warnings.
Use heroku-buildpack-apt to install the xvfb
and libnotify4
debian packages. Then use this buildpack to fix the /usr/bin/xkbcomp
issue:
https://github.com/captain401/heroku-buildpack-xvfb
Then you can use xvfb-run $PROGRAM
to run your application.
I'm wondering the same thing. Seems like you already found this guy's issue. All the buildpacks mentioned are 1+ years old, and don't work anymore.
Two viable seeming options:
Compile a self-contained xvfb binary a la https://github.com/kenshin23/xvfb-portable-binary that runs on Heroku's current OS and architecture, rebuild when they update.
Install all dependencies from the apt package manager into someplace like ~/.apt, and run from there, as in the latest buildpack-apt. For me, this option dies with sh: 1: /usr/bin/xkbcomp: not found
. Xvfb is looking in /
, while apt installed the command to ~/.apt/usr/bin/xkbcomp
. Haven't figured out how to tell Xvfb to look in ~/.apt/
.