Code Monkey home page Code Monkey logo

docker-drawio-desktop-headless's Introduction

docker-drawio-desktop-headless's People

Contributors

dependabot[bot] avatar himura2la avatar rlespinasse avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-drawio-desktop-headless's Issues

issues with png export

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?

UML frame appears broken in export

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:

frame-bug-bad

It should look like this:

frame-bug-good

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

Add fonts-liberation dependency

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)image

This is what I would expect:
image

Thanks for your work and help

This image doesn't support apps based on electron 16

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.

Errors output is empty in case of error

Linked to #2

intended use

By using drawio-desktop in a headless environment, the error output can contains

  • electron app error/warning output
  • drawio-desktop error output.

the environment variable ELECTRON_DISABLE_SECURITY_WARNINGS (default true) remove all electron app error/warning from the output.

command 1 executed

docker run -it -w /data -v $(pwd):/data rlespinasse/drawio-desktop-headless -x unknown-file.drawio

expected output 1

Error: input file/directory not found

observed output 1

no logs.

command 2 executed

docker run -it -e ELECTRON_DISABLE_SECURITY_WARNINGS=false -w /data -v $(pwd):/data rlespinasse/drawio-desktop-headless -x unknown-file.drawio

expected output 2

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

observed output 3

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

system used

$ 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

not exporting

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!

intended use

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.

command executed

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

expected output

a png file named infra.png
a log statement with powderbooking_uml_infra.drawio -> infra.png

observed output

Nothing. No log statements, no file. It hangs after the given timeout window. I have also tried it with a 60s timeout.

system used

$ 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

Export with user permissions fails

Problem Description

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

Replicate issue

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

Why is this a problem?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.