yuzutech / kroki

Creates diagrams from textual descriptions!
https://kroki.io
MIT License
2.88k stars 215 forks source link

Cannot run most Kroki companion containers on ARM #1221

Closed fviolette closed 2 years ago

fviolette commented 2 years ago

Hello,

I'd like to run Kroki with docker-compose to allow for rather large, 5000++ line Exclidraw files to render.

Configuration

M1 Macbook Pro, macOS Monterey 12.3.

Test with Docker compose

I'm running Kroki with docker-compose up -d and the following configuration — note the 0.15.1 tags:

version: "3"
services:
  kroki:
    image: yuzutech/kroki:0.15.1
    depends_on:
      - blockdiag
      - mermaid
      - bpmn
      - excalidraw
    environment:
      - KROKI_BLOCKDIAG_HOST=blockdiag
      - KROKI_MERMAID_HOST=mermaid
      - KROKI_BPMN_HOST=bpmn
      - KROKI_EXCALIDRAW_HOST=excalidraw
    ports:
      - "8000:8000"
  blockdiag:
    image: yuzutech/kroki-blockdiag:0.15.1
    expose:
      - "8001"
  mermaid:
    image: yuzutech/kroki-mermaid:0.15.1
    expose:
      - "8002"
  bpmn:
    image: yuzutech/kroki-bpmn:0.15.1
    expose:
      - "8003"
  excalidraw:
    image: yuzutech/kroki-excalidraw:0.15.1
    expose:
      - "8004"

The core and blockdiag services do start and render images, but mermaid, bpmn, and excalidraw don't.

Here are the errors:

bpmn ``` bpmn_1 | Unable to start the service ErrorEvent { bpmn_1 | target: WebSocket { bpmn_1 | _events: [Object: null prototype] { open: [Function], error: [Function] }, bpmn_1 | _eventsCount: 2, bpmn_1 | _maxListeners: undefined, bpmn_1 | _binaryType: 'nodebuffer', bpmn_1 | _closeCode: 1006, bpmn_1 | _closeFrameReceived: false, bpmn_1 | _closeFrameSent: false, bpmn_1 | _closeMessage: '', bpmn_1 | _closeTimer: null, bpmn_1 | _extensions: {}, bpmn_1 | _protocol: '', bpmn_1 | _readyState: 3, bpmn_1 | _receiver: null, bpmn_1 | _sender: null, bpmn_1 | _socket: null, bpmn_1 | _bufferedAmount: 0, bpmn_1 | _isServer: false, bpmn_1 | _redirects: 0, bpmn_1 | _url: 'ws://127.0.0.1:40775/devtools/browser/5699345e-f590-4db5-882e-11e1988b1cf4', bpmn_1 | _req: null, bpmn_1 | [Symbol(kCapture)]: false bpmn_1 | }, bpmn_1 | type: 'error', bpmn_1 | message: 'socket hang up', bpmn_1 | error: Error: socket hang up bpmn_1 | at connResetException (internal/errors.js:607:14) bpmn_1 | at Socket.socketOnEnd (_http_client.js:499:23) bpmn_1 | at Socket.emit (events.js:388:22) bpmn_1 | at endReadableNT (internal/streams/readable.js:1336:12) bpmn_1 | at processTicksAndRejections (internal/process/task_queues.js:82:21) { bpmn_1 | code: 'ECONNRESET' bpmn_1 | } bpmn_1 | } ```
mermaid ``` mermaid_1 | Unable to start the service ErrorEvent { mermaid_1 | target: WebSocket { mermaid_1 | _events: [Object: null prototype] { open: [Function], error: [Function] }, mermaid_1 | _eventsCount: 2, mermaid_1 | _maxListeners: undefined, mermaid_1 | _binaryType: 'nodebuffer', mermaid_1 | _closeCode: 1006, mermaid_1 | _closeFrameReceived: false, mermaid_1 | _closeFrameSent: false, mermaid_1 | _closeMessage: '', mermaid_1 | _closeTimer: null, mermaid_1 | _extensions: {}, mermaid_1 | _protocol: '', mermaid_1 | _readyState: 3, mermaid_1 | _receiver: null, mermaid_1 | _sender: null, mermaid_1 | _socket: null, mermaid_1 | _bufferedAmount: 0, mermaid_1 | _isServer: false, mermaid_1 | _redirects: 0, mermaid_1 | _url: 'ws://127.0.0.1:40661/devtools/browser/01be8073-7e9c-4907-b76d-6ac5cfac8717', mermaid_1 | _req: null, mermaid_1 | [Symbol(kCapture)]: false mermaid_1 | }, mermaid_1 | type: 'error', mermaid_1 | message: 'socket hang up', mermaid_1 | error: Error: socket hang up mermaid_1 | at connResetException (internal/errors.js:607:14) mermaid_1 | at Socket.socketOnEnd (_http_client.js:499:23) mermaid_1 | at Socket.emit (events.js:388:22) mermaid_1 | at endReadableNT (internal/streams/readable.js:1336:12) mermaid_1 | at processTicksAndRejections (internal/process/task_queues.js:82:21) { mermaid_1 | code: 'ECONNRESET' mermaid_1 | } mermaid_1 | } ```
excalidraw ``` excalidraw_1 | Unable to start the service Error: Protocol error (Target.setDiscoverTargets): Target closed. excalidraw_1 | at /snapshot/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:71:63 excalidraw_1 | at new Promise () excalidraw_1 | at Connection.send (/snapshot/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:70:16) excalidraw_1 | at Function.create (/snapshot/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:118:26) excalidraw_1 | at ChromeLauncher.launch (/snapshot/app/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:109:56) excalidraw_1 | at processTicksAndRejections (internal/process/task_queues.js:95:5) excalidraw_1 | at async createBrowser (/snapshot/app/src/browser-instance.js:4:19) excalidraw_1 | at async /snapshot/app/src/index.js:8:19 ```

Possibly related issues

https://github.com/puppeteer/puppeteer/issues/7916

ggrossetie commented 2 years ago

Could you please run the same command (docker-compose up -d) using version 0.16.0? Do you get the exact same errors?

fviolette commented 2 years ago

I didn't mention it since I thought using 0.16.0 could be the problem, but yes, same issues.

ggrossetie commented 2 years ago

I was able to run build and run the Mermaid companion container. I'm trying to set up docker buildx to build for both amd64 and arm64.

fviolette commented 2 years ago

Thank you. Happy to test further :-)

ggrossetie commented 2 years ago

Not quite yet... 😣

$ docker run -p8002:8002 yuzutech/kroki-mermaid:0.17.0-rc.2
qemu-x86_64: Could not open '/lib/ld-musl-x86_64.so.1': No such file or directory
ggrossetie commented 2 years ago

Finally, using version 0.17.0-rc.5 seems to be working!

$ uname -a
Darwin 6d41b60d-08da-4939-be64-24505f2f8774 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101 arm64
$ curl localhost:8000/mermaid/svg/eNpLy8kvT85ILCpR8AniUgCCzBQAQwIF4A==
ggrossetie commented 2 years ago

Apart from erd, everything seems to be working on ARM but I won't push away the 0.17.0 release further. @fviolette Could you please check on your end that everything is working? You need to replace 0.15.1 by 0.17.0-rc.5 on your docker-compose.yml file.

fviolette commented 2 years ago

It works! 🎉 Thanks for pushing it so quickly.

I validated with examples from the Kroki home page (and custom ones for my own needs, like Excalidraw). Only erd gives me this error:

Skipping erd block. POST http://localhost:8000/erd/svg - server returns an empty response or a 404 status code
Site generation complete!
ggrossetie commented 2 years ago

Only erd gives me this error:

Erd is written in Haskell and we are using GHC (via stack) to produce a binary. It's unclear if all the tooling is compatible with ARM or not, so we will need to experiment.

I think we should close this issue and open a specific issue for erd.