wolfi-dev / os

Main package repository for production Wolfi images
Other
821 stars 249 forks source link

[Wolfi Package Request]: drawio #31977

Open karlhaworth opened 2 weeks ago

karlhaworth commented 2 weeks ago

What software would you like us to add to wolfi-os. Ideally include a URL to the project and its source.

drawio to be used in mkdocs-drawio-exporter

which versions of the software should we include?

most recent

Add some justification for why this specific package and versions are important.

I want a drawio executable so that I can set the drawio_executable option in mkdocs-drawio-exporter allowing me to use my internal developer portal of backstage with Chainguard Images and drawio exporters so that I can have multi-page diagrams displayed in my technical documentation.

Please check all that apply

karlhaworth commented 2 weeks ago

I had tried this here -> https://github.com/wolfi-dev/os/compare/main...AmericanAirlines:wolfi-dev-os:drawio-24.7.17--new-package but I'm not sure I made good progress.

I also forked the repo and made some mods that I thought may be needed.

pipeline:
  - uses: git-checkout
    with:
      repository: https://github.com/karlhaworth/drawio-desktop
      # tag: ${{package.version}}-r${{package.epoch}}
      # expected-commit: 4e857e8bb3a0afecb1bca529579e8f239cf9c470
tuananh commented 2 weeks ago

@karlhaworth the one you need is drawio CLI right? not the desktop one?

karlhaworth commented 2 weeks ago

@tuananh I need a way to use the drawio executable in the image with the plugin above which deals with exports.

I believe you are correct after digging into the plugin fully.

Here is the exporter using the executable and CLI using the flags -> https://github.com/LukeCarrier/mkdocs-drawio-exporter/blob/3fa8822b9c85d4bd94c8c8a2ed111cacf83ee873/mkdocs_drawio_exporter/exporter.py#L363

edit: It doesn't seem there's a CLI though? This seems the closest -> https://github.com/rlespinasse/docker-drawio-desktop-headless as https://github.com/rlespinasse/drawio-cli?tab=readme-ov-file is deprecated but neither are from jgraph 🤔

Also the headless uses the desktop version -> https://github.com/rlespinasse/docker-drawio-desktop-headless/blob/v1.x/Dockerfile#L16

tuananh commented 2 weeks ago

i honestly have no idea how to do this one without building the whole electron app.

also, the release pipeline for drawio-desktop seems to need access to a private repo jgraph/drawio-dev which is not public.

https://github.com/jgraph/drawio-desktop/blob/bad25d2fc6c085bb161f5a440b91e8e5890c8ae0/.github/workflows/electron-builder.yml#L35

tuananh commented 2 weeks ago

i think it can be packaged to tar.xz and then we can extract the cli from there. i can put together a PR later this week

image

karlhaworth commented 2 weeks ago

I got an APK to build after adding another pkg -> https://github.com/wolfi-dev/os/compare/main...AmericanAirlines:wolfi-dev-os:drawio-24.7.17--new-package

At this point now when attempting to build an image with it.

❯ docker run --rm --workdir /work -v ${PWD}:/work packages.aa.com/cgr-hub/chainguard/apko \
  build apko.yaml drawio:test drawio.tar --arch aarch64
2024/10/28 16:18:05 INFO Building images for 1 architectures: [arm64]
2024/10/28 16:18:05 ERRO request failed error="Get \"@local%20/work/packages/apk-configuration\": unsupported protocol scheme \"\"" method=GET url=@local%20/work/packages/apk-configuration
2024/10/28 16:18:05 WARN ignoring missing keys for @local /work/packages: failed to perform key discovery: Get "@local%20/work/packages/apk-configuration": GET @local%20/work/packages/apk-configuration giving up after 1 attempt(s): Get "@local%20/work/packages/apk-configuration": unsupported protocol scheme ""
2024/10/28 16:18:05 INFO setting apk repositories: [@local /work/packages https://packages.wolfi.dev/os]
Error: building layers: building layers: for arch "arm64": installing apk packages: error getting package dependencies: solving "drawio@local" constraint: could not find package either named so:ld-linux-x86-64.so.2 or that provides so:ld-linux-x86-64.so.2 for drawio
2024/10/28 16:18:06 INFO error during command execution: building layers: building layers: for arch "arm64": installing apk packages: error getting package dependencies: solving "drawio@local" constraint: could not find package either named so:ld-linux-x86-64.so.2 or that provides so:ld-linux-x86-64.so.2 for drawio

I have both the packages below that I thought should help with this 🤔

    - glibc
    - ld-linux
karlhaworth commented 2 weeks ago

Branch updated

/ $ drawio
[8:1029/141110.416268:FATAL:setuid_sandbox_host.cc(163)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /usr/local/bin/chrome-sandbox is owned by root and has mode 4755.

I think I have ideas on what to do here. Chugging away while time allows

karlhaworth commented 2 weeks ago

🤔

/ $ drawio
drawio: error while loading shared libraries: libffmpeg.so: cannot open shared object file: No such file or directory
/ $ ls /usr/local/bin
LICENSE.electron.txt     chrome_100_percent.pak   drawio                   libGLESv2.so             libvulkan.so.1           resources.pak            vk_swiftshader_icd.json
LICENSES.chromium.html   chrome_200_percent.pak   icudtl.dat               libffmpeg.so             locales                  snapshot_blob.bin
chrome-sandbox           chrome_crashpad_handler  libEGL.so                libvk_swiftshader.so     resources                v8_context_snapshot.bin
karlhaworth commented 2 weeks ago

Making it further. I've seen docs around this.

/ $ drawio --no-sandbox --help --disable-gpu
[57:1030/164144.280471:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[57:1030/164154.877474:ERROR:ozone_platform_x11.cc(245)] Missing X server or $DISPLAY
[57:1030/164154.877631:ERROR:env.cc(258)] The platform failed to initialize.  Exiting.
karlhaworth commented 2 weeks ago

Branch currently results in the below

/ $ Xvfb "${XVFB_DISPLAY:?}" ${XVFB_OPTIONS} & timeout 30 drawio --no-sandbox --help --disable-gpu
[14:1030/183901.408374:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[14:1030/183911.598138:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[14:1030/183911.598634:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[14:1030/183911.630819:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[14:1030/183911.634519:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[14:1030/183911.637524:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[14:1030/183911.638823:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[14:1030/183911.638957:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
Illegal instruction
tuananh commented 1 week ago

im stuck there as well. this is harder than I initially thought.