Arcentry Enterprise - Image Server
Arcentry's API is capable of rendering PNG images of diagrams on the server-side and serve them to the client via HTTP. This functionality is exposed via the api/v1/image/from-document/DOC_ID and api/v1/image/create-from-diagram endpoints respectively.
Both endpoints create or use an existing document, create a static embed, and then load this embed in a Chrome or Chromium browser using the devTools Protocol via Google's Puppeteer library. Once loaded, a screenshot is created and the raw image data from that screenshot is returned to the client. Finally the loaded browser page is closed and the embeds and/or temporary documents are deleted.
Using (headless) Chrome/Chromium is currently the only solution for high-quality WebGL rendering on the server-side - but as numerous DevOps professionals have pointed out (1, 2, 3, 4, 5) it can come with some instability and operational overhead in production. In this guide, we're aiming to share the best practices for running Chromium rendering with Arcentry Enterprise.https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/706915/chrome-win.zip onto the same machine that runs the Arcentry Enterprise API server and unzip it.
- 706915 in the above link is the revision number for Chromium 79 Stable for 64bit windows, released on January 7th, 2020. To find the revision numbers for other versions, please visit http://omahaproxy.appspot.com/and look at the branch_base_position column.
- If you already have an existing installation of Chrome or Chromium installation on the API server machine, you can skip this step.
- Chrome/Chromium can also be installed on another machine and controlled remotely. To choose this option, please set chromeExecutablePath in arcentry-conf.yml to null and configure a devToolProcotolEndpoint URL instead.
In arcentry-conf.yml set devToolProcotolEndpoint to null and chromeExecutablePath as the path to your executable, e.g.
Specifying chromeExecutablePath tells Arcentry that it is in charge of managing the browser process. This only works for local installs of Chromium. If you'd rather connect to an existing browser process, either on the local or on a remote machine, set chromeExecutablePath to null and instead specify a devToolProcotolEndpoint, e.g.
devToolProcotolEndpoint: "http://localhost:9222" chromeExecutablePath: null
For this to work, Chrome/Chromium must have been started with
chrome.exe --remote-debugging-port=9222 --headless
The --headless flag is optional but recommended. It tells Chrome to run as a background process without a User Interface.
As mentioned initially, certain aspects of this setup, e.g. exact load times, are unfortunately non-deterministic. If you experience stability issues, try increasing the following settings in arcentry-conf.yml.
parallelPageLoadAttempts: 1 diagramRenderCompleteWait: 300 cameraAdjustmentWait: 300