[openstreetmap/openstreetmap-website] QT_QPA_PLATFORM for phantomjs headless (#2569)

Andy Allan notifications at github.com
Wed Mar 25 13:36:25 UTC 2020


While investigating #2556 I found a problem with our phantomjs config. After running vagrant up, phantomjs is in a non-working state:

```
vagrant at ubuntu-bionic:/srv/openstreetmap-website$ /usr/bin/phantomjs --version
qt.qpa.screen: QXcbConnection: Could not connect to display 
Could not connect to any X display.
```
This turns out to be expected, since the [debian/ubuntu build of phantomjs doesn't use the patched+bundled version of QT that is in the official phantomjs builds](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=817277).

We [already have code to handle this situation](https://github.com/openstreetmap/openstreetmap-website/blob/9b61ec2912dfd15a5edd7ffc5ac3526cd61c9f9a/test/application_system_test_case.rb#L7) in the test suite, namely:

```
ENV["QT_QPA_PLATFORM"] = "phantom" if IO.popen(["phantomjs", "--version"], :err => :close).read.empty?
```

... but this doesn't work on our vagrant boxes, because:

```
vagrant at ubuntu-bionic:/srv/openstreetmap-website$ QT_QPA_PLATFORM=phantom /usr/bin/phantomjs --version
This application failed to start because it could not find or load the Qt platform plugin "phantom"
in "".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
```

I don't know where the "phantom" in `ENV["QT_QPA_PLATFORM"] = "phantom"` comes from. Should this be `"offscreen"`? Or will that break a different situation?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2569
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20200325/a879fad7/attachment.htm>


More information about the rails-dev mailing list