Note I'm not young enough to know everything
See more on https://www.romainlespinasse.dev/about
Headless version of drawio-desktop
Home Page: https://hub.docker.com/r/rlespinasse/drawio-desktop-headless
License: MIT License
Note I'm not young enough to know everything
See more on https://www.romainlespinasse.dev/about
In addition of dockerhub
Missing libappindicator3-1
during the drawio
installation part.
Found on #13 (comment).
Hi @rlespinasse,
thank you for providing this project. It was very helpful for me and inspired me to create my own version (to be used as a runner image in GitLab). Basically, I use the same commands in the dockerfile, just without entrypoint / cmd in the end.
Instead I have a drawio
file with the following content that I put into /usr/local/bin
#!/usr/bin/env bash
set -euo pipefail
if [[ "${SUPPRESS_UNWANTED_OUTPUT:?}" == "true" ]]; then
xvfb-run -a /opt/drawio/drawio "$@" --no-sandbox --disable-gpu 2>&1 | grep -Fvf "/opt/drawio-desktop/unwanted-output-lines.txt"
else
xvfb-run -a /opt/drawio/drawio "$@" --no-sandbox --disable-gpu 2>&1
fi
While I can use this image inside my CI pipeline to call commands like drawio --help
or to export PDF files, the png export seems to have problems.
The command drawio -x -o flow.png flow.drawio
fails with the following output:
[212:0522/055006.581379:ERROR:validation_errors.cc(117)] Invalid message: VALIDATION_ERROR_DESERIALIZATION_FAILED
[212:0522/055006.581435:ERROR:interface_endpoint_client.cc(702)] Message 2131977360 rejected by interface viz.mojom.CopyOutputResultSender
[212:0522/055006.581524:ERROR:browser_child_process_host_impl.cc(754)] Terminating child process for bad message: Received bad user message: Validation failed for viz.mojom.CopyOutputResultSender.0 [VALIDATION_ERROR_DESERIALIZATION_FAILED]
Error: Export failed: flow.drawio
Did you, by any chance, once have a similar error and know how to fix this?
To follow best practices on semver
The issue template can be based on #2 for example
Please consider the attached Draw.io diagram. It contains two UML frames. While the left one always renders fine, the right one appears as a black box when exported using the Draw.io Desktop Headless Docker image:
It should look like this:
This happens both when exporting to SVG and PNG. The command I used is a plain -x -f svg frame-bug.drawio
.
The export works fine using the draw.io
CLI on macOS. I unfortunately don't have a Linux desktop machine at hand to test it there.
Attachement:
Diagram source file and SVG exports
I tried the docker-drawio-desktop-headless as a GitHub action (using https://github.com/rlespinasse/drawio-export-action) and it worked like a charm. However, the current docker-drawio-desktop-headless uses system fonts and these fonts are very limited in docker instances. I understand why this is the case - limiting storage usage - but could you please add the fonts-liberation package here https://github.com/rlespinasse/docker-drawio-desktop-headless/blob/v1.x/Dockerfile#L7?
The problem is that the default font (Helvetica-12pt) in drawio is not available by default in the docker image, and thus, the resulting PNG images look ugly (with some strings drawn out of the boxes)
Example:
This is what I get after running drawio-export-action: (look at the "Berkeley" node on the right side of the picture)
Thanks for your work and help
Since Drawio Desktop 16.0.2, the version of electron
have move from 13.x
to 16.x
and some issues occur
[10:1231/103312.175604:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[10:1231/103312.190435:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[10:1231/103312.200423:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[10:1231/103312.433884:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[10:1231/103312.530311:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[38:1231/103313.220564:ERROR:viz_main_impl.cc(161)] Exiting GPU process due to errors during initialization
[70:1231/103313.630245:ERROR:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
Instead of doing this manually, we can use a GitHub Action workflow to periodically watch for newly released versions.
Linked to #2
By using drawio-desktop in a headless environment, the error output can contains
the environment variable ELECTRON_DISABLE_SECURITY_WARNINGS (default true
) remove all electron app error/warning
from the output.
docker run -it -w /data -v $(pwd):/data rlespinasse/drawio-desktop-headless -x unknown-file.drawio
Error: input file/directory not found
no logs.
docker run -it -e ELECTRON_DISABLE_SECURITY_WARNINGS=false -w /data -v $(pwd):/data rlespinasse/drawio-desktop-headless -x unknown-file.drawio
Error: input file/directory not found
(node:12) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron. See https://github.com/electron/electron/issues/23506 for more information
Error: input file/directory not found
(node:12) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron. See https://github.com/electron/electron/issues/23506 for more information
$ uname -a
Darwin 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64 i386 MacBookPro15,1 Darwin
$ docker -v
Docker version 20.10.2, build 2291f61
Related to rlespinasse/drawio-export#80
Nice work! This seems to be what I am looking for, but I can't get it to work. I might be a bit too quick, since you only released it 2 days ago. I didn't see any issue templates so I hope I have given you everything you need to know.
I don't have drawio-desktop installed on this machine. Let me know if it is a fault on my side!
I have a repo with UML diagrams: https://gitlab.com/powderbooking/readme/-/tree/3-uml-architecture-diagram
I would like to keep the .drawio
data in git. In my CI/CD pipeline, I want to export those files to .png
files and publish them as artifacts. Therefore, I want to export the .drawio
files using a CLI that can be run inside my pipeline. This way, I do not need to store a large blob inside my repo, yet still get access to the .png
files.
git clone https://gitlab.com/powderbooking/readme.git
cd readme/img
docker run -it -v $(pwd):/data rlespinasse/drawio-desktop-headless -f png -o infra.png -x powderbooking_uml_infra.drawio
a png file named infra.png
a log statement with powderbooking_uml_infra.drawio -> infra.png
Nothing. No log statements, no file. It hangs after the given timeout window. I have also tried it with a 60s timeout.
$ uname -a
Linux ithilien-Aspire-V3-371 4.15.0-132-generic #136-Ubuntu SMP Tue Jan 12 14:58:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ docker -v
Docker version 20.10.2, build 2291f61
Exports create files owned by root
.
Attempting to run with user permissions fails with:
touch: cannot touch '/opt/drawio-desktop/unwanted-lines.txt': Permission denied
Create any diagram called diagram.drawio
, then attempt an export with user-permissions:
$ docker run --rm -it -w /data -v $(pwd):/data \
-u $(id -u):$(id -g) \
rlespinasse/drawio-desktop-headless:v1.24.0 \
-x -o diagram.drawio.png diagram.drawio
touch: cannot touch '/opt/drawio-desktop/unwanted-lines.txt': Permission denied
personally:
Automating image exports on a CI server (Jenkins), files owned by root
cause future attempts to clean a build fail, causing future CI tasks on that branch to fail.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.