jgraph / docker-drawio

Dockerized draw.io based on whichever is the most secure image at the time.
GNU General Public License v3.0
1.48k stars 359 forks source link

Add subfolder url and other question. #107

Closed DeAlexPesh closed 1 year ago

DeAlexPesh commented 1 year ago

Hi.

  1. How to mount a program in a subfolder? ex: http://domain.com/drawio/
  2. DRAWIO_CONFIG no work, but in log all good. Menu Extras -> Configuration doesn't work either.
    ...
    window.DRAW_MATH_URL = 'math/es5';
    window.DRAWIO_CONFIG = {
    "language": "ru",
    "customFonts": [],
    "compressXml": true,
    "plugins": [
    "plugins/explore.js",
    "plugins/svgdata.js",
    "plugins/sql.js",
    "plugins/props.js",
    "plugins/trees/trees.js"
    ],
    "createTarget": false,
    "search": true,
    "showStartScreen": false,
    "autosave": true,
    "autosaveDelay": 5000,
    "ui": "atlas"
    };
    urlParams['sync'] = 'manual'; //Disable Real-Time
    ...
  3. jgraph/export-server no work export. Log:
    warn: Handled exception: Could not find Chromium (rev. 1095492). This can occur if either
    1. you did not perform an installation before running the script (e.g. `npm install`) or
    2. your cache path is incorrectly configured (which is: /usr/local/drawio/.cache/puppeteer).
    For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration. req=ip=::ffff:172.28.0.4 format=pdf w=0 h=0 bg=%23ffffff  {"stack":"Error: Could not find Chromium (rev. 1095492). This can occur if either\n 1. you did not perform an installation before running the script (e.g. `npm install`) or\n 2. your cache path is incorrectly configured (which is: /usr/local/drawio/.cache/puppeteer).\nFor (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.\n    at ChromeLauncher.resolveExecutablePath (/usr/local/drawio/draw-image-export2/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:127:27)\n    at ChromeLauncher.executablePath (/usr/local/drawio/draw-image-export2/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:206:25)\n    at ChromeLauncher.launch (/usr/local/drawio/draw-image-export2/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:93:37)\n    at async handleRequest (/usr/local/drawio/draw-image-export2/export.js:554:17)"}
    ::ffff:172.28.0.4 - - [15/Mar/2023:17:06:53 +0000] "POST / HTTP/1.1" 500 - "http://domain.com:3085/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"

This my docker-compose config, but...

/app/compose/.env

DRAWIO_BASE_URL=https://domain.com/drawio
DRAWIO_LIGHTBOX_URL=https://domain.com/drawio
DRAWIO_VIEWER_URL=https://domain.com/drawio/js/viewer.min.js
DRAWIO_CONFIG='{
  "customFonts": [],
  "compressXml": true,
  "plugins": [
    "plugins/explore.js",
    "plugins/svgdata.js",
    "plugins/sql.js",
    "plugins/props.js",
    "plugins/trees/trees.js"
  ],
  "createTarget": false,
  "search": true,
  "showStartScreen": false,
  "autosave": true,
  "autosaveDelay": 5000,
  "ui": "atlas"
}'

/app/compose/drawio.yml

version: "3"
services:
 drawio-plantuml:
  image: plantuml/plantuml-server:jetty
  container_name: "drawio-plantuml"
  ports:
   - "127.0.0.1:3085:8080"
  volumes:
   - "plantuml_data:/tmp/jetty"
   - "/app/drawio/fonts:/usr/share/fonts/drawio"
  environment:
   - BASE_URL=uml
   - ALLOW_PLANTUML_INCLUDE=true
  networks:
   - drawio
  logging:
   driver: "json-file"
   options:
    max-size: "200k"
    max-file: "5"
  restart: always

 drawio-img:
  image: jgraph/export-server:latest
  container_name: "drawio-img"
  expose:
   - "8000"
  volumes:
   - "/app/drawio/fonts:/usr/share/fonts/drawio"
  environment:
   - DRAWIO_SERVER_URL=\${DRAWIO_BASE_URL}
  networks:
   - drawio
  logging:
   driver: "json-file"
   options:
    max-size: "200k"
    max-file: "5"
  restart: always

 drawio:
  image: jgraph/drawio:latest
  container_name: "drawio"
  ports:
   - "3086:8080"
  links:
   - drawio-plantuml:drawio-plantuml
   - drawio-img:drawio-img
  depends_on:
   - drawio-plantuml
   - drawio-img
  environment:
   - LETS_ENCRYPT_ENABLED=false
   - DRAWIO_SELF_CONTAINED=1
   - PLANTUML_URL=http://drawio-plantuml:8080/uml/
   - EXPORT_URL=http://drawio-img:8000/
   - DRAWIO_BASE_URL=${DRAWIO_BASE_URL}
   - DRAWIO_CONFIG=${DRAWIO_CONFIG}
   - DRAWIO_VIEWER_URL=${DRAWIO_VIEWER_URL}
   - DRAWIO_LIGHTBOX_URL=${DRAWIO_LIGHTBOX_URL}
  networks:
   - drawio
  logging:
   driver: "json-file"
   options:
    max-size: "200k"
    max-file: "5"
  restart: always

networks:
 drawio:
  driver: bridge
  name: drawio

volumes:
 plantuml_data:
DeAlexPesh commented 1 year ago

Everything is so bad?

DeAlexPesh commented 1 year ago
upstream http_drawio {
  ip_hash;
  server 127.0.0.1:8080
}

...

  location /draw {
    rewrite ^([^.]*[^/])$ $1/ permanent;
  }
  location ~ ^/draw/(.*)$ {
    proxy_buffering off;
    proxy_redirect off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;

    proxy_pass http://http_drawio/$1;
  }

...
davidjgraph commented 11 months ago

https://github.com/jgraph/docker-drawio/issues/120