How to run gitbook on a headless server (make Calibre run in headless server)?

When use gitbook to generate ebook, Calibre reports this:

RuntimeError: X server required. If you are running on a headless machine, use xvfb

After xvfb is installed, it does not work either.

How to make gitbook/Calibre work on a headless server?

asked Oct 20, 2014 by Eric Z Ma (44,280 points)

1 Answer

 
Best answer

You need to wrap the command ebook-convert with xvfb-run. However, in gitbook (lib/generate/ebook/index.js), ebook-convert is called directly.

You may change gitbook to call xvfb-run ebook-convert. However, when you upgrade gitbook, you lost the change.

My solution is to add this wrapper so that calling ebook-convert is actually invoking this wrapper:

Saved to /usr/local/bin/ebook-convert (since /usr/local/bin/ is before /usr/bin/ in my $PATH):

#!/bin/bash

echo "Run xvfb-run /usr/bin/ebook-convert $@"

xvfb-run /usr/bin/ebook-convert "$@"
answered Oct 20, 2014 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...