yuzutech / kroki

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

Kroki with docker-compose and SSL #1344

Closed tfboy closed 1 year ago

tfboy commented 1 year ago

I'm integrating Kroki to work with Wiki.js and am nearly there, except that my Wiki runs in SSL and so I'd need Kroki to do the same. I did find some documentation about using it with docker - https://github.com/yuzutech/kroki/blob/main/docs/modules/setup/pages/configuration.adoc#enabling-ssl-on-the-server But if using with docker-compose and a .yml file, I can't figure out how to get it working. I have my private key file and certificate file (same as those used by Wiki.js), but need to understand how to have them read by the Java web engine Kroki uses. Can anyone provide any pointers? Many thanks!

tfboy commented 1 year ago

OK, I've managed to answer my own question. You can insert the environment variables directly into the docker-compose.yml file. The private key and certificate have to be transformed into one long string (which is what the doc does creating the .env file). You can then bring these into the docker-compose.yml file along witht he SSL=true variable.

So this is what I have ended up with:

services:
  kroki:
    image: yuzutech/kroki
    depends_on:
      - blockdiag
      - mermaid
      - bpmn
      - excalidraw
    environment:
      - KROKI_BLOCKDIAG_HOST=blockdiag
      - KROKI_MERMAID_HOST=mermaid
      - KROKI_BPMN_HOST=bpmn
      - KROKI_EXCALIDRAW_HOST=excalidraw
      - KROKI_SSL_CERT=-----BEGIN CERTIFICATE-----M<TRUNCATED>A==-----END CERTIFICATE-----
      - KROKI_SSL_KEY=-----BEGIN RSA PRIVATE KEY-----M<TRUNCATED>HANJa6kA-----END RSA PRIVATE KEY-----
      - KROKI_SSL=true
    ports:
      - "8000:8000"
  blockdiag:
    image: yuzutech/kroki-blockdiag
    expose:
      - "8001"
  mermaid:
    image: yuzutech/kroki-mermaid
    expose:
      - "8002"
  bpmn:
    image: yuzutech/kroki-bpmn
    expose:
      - "8003"
  excalidraw:
    image: yuzutech/kroki-excalidraw
    expose:
      - "8004"
ggrossetie commented 1 year ago

Yes that's correct. For reference, here's the documentation: https://docs.kroki.io/kroki/setup/configuration/#_enabling_ssl_on_the_server

Feel free to open a pull request to add an example in the documentation when using Docker composer.