Mon 11 February 2019 | -- (permalink)
So there's this vendor-supplied toolkit that I needed to get running in a Docker-ized build environment. Toolkit is a bit of a pig, but that's not the problem. The problem is that, while the core tools in the kit run as command line programs (and, indeed, pretty much have to be run that way for reproducable builds), the installation process requires X11. In Docker. Happy joy, not.
So our bag of tricks today includes:
Xvfb
-- a virtual X11 server which uses a plain file as its "frame buffer"xvfbwrapper
-- a Python context manager wrapped aroundXvfb
ratpoison
-- the Rodent-Free X11 window manager
And yes, the basic strategy is just as disgusting as you expected: run
the frelling installer under Xvfb
while using ratpoison
to click
on the buttons. Works surprisingly well, although of course very
fragile. Not currently running under docker build
, only under
docker run
, so may end up having to use docker commit
to get an
image out of this, but such is life.
Other tools which might be necessary or useful for this sort of thing:
xte
andvisgrep
from thexautomation
toolkitdisplay
from a (recent version of) theImageMagick
packageXvnc
if you're trying to usedisplay
from several timezones away
There's some overlap between ratpoison
and xte
, which one you need
depends on details of what you're trying to do.
display -update 1 xwd:Xvfb_screen0
will let you watch Xvfb
's frame
buffer with automatic updates, making it easier for you to debug your
mouse commands just by typing ratpoison
or xte
commands and seeing
what happens. The catch is that only recent versions of display
will work for this due to a bug, now fixed. The version on Debian
Jessie was too old, the version on Debian Stretch is fine (it was time
to upgrade that VM anyway...). In a pinch, plain old xwud
will do.
Running X11 long distance ... doesn't work so well. It's almost
tolerable for a lightweight program like xwud
, but by the time you
get to something like display
it's just painful. Available evidence
suggests that the X11 protocol is just too chatty for this use. But
that's OK, you can solve this with one more layer of kludgery: run
Xvnc
on the server where you're running Docker and display
, then
use a VNC viewer to view the resulting X11 desktop. Even VNC is a bit
slow, but it's a lot better for this than X11.
Whether you're using X11 or VNC, you'll want to tunnel it via SSH unless this is all happening in a safe environment (hint: there is no such thing as a safe environment, just threats people chose not to consider).
May post more on this once I get the wretched thing fully working.
This not a dancing elephant. It's more like a sauropod trying out for ballet.