Deploying a draw.io App
Introduction
Draw.io (diagrams.net) delivers a powerful, browser-based diagramming experience. This guide shows how to containerize draw.io with a Dockerfile, add optional branding, and deploy it to Klutch.sh over HTTP.
Prerequisites
- GitHub repository containing your Dockerfile.
- Klutch.sh project ready in klutch.sh/app.
Project structure
.└── DockerfileSample Dockerfile
FROM jgraph/drawio:latest
# Default draw.io portENV PORT=8080EXPOSE 8080Recommended environment variables
PORT=8080– internal port for the web UI.DRAWIO_BASE_URL– public URL, e.g.,https://example-app.klutch.sh(helps with embedded assets).DRAWIO_DEFAULT_LANG=en– set a default language.DRAWIO_OFFLINE=true– disable remote asset fetching if you prefer offline mode.
Persistence
Draw.io is stateless by default. If you customize and need to persist config, attach a volume:
- Mount path:
/var/lib/drawio - Size: minimal unless storing exports or custom assets
Networking
- Protocol: HTTP
- Internal port:
8080 - Users reach
https://example-app.klutch.shwhile Klutch.sh routes to port8080inside the container.
Health check (recommended)
curl -I http://localhost:8080Deployment on Klutch.sh
- Push your Dockerfile to GitHub.
- In klutch.sh/app, create a new app and select GitHub as the source.
- Klutch.sh automatically detects the Dockerfile in the repository root.
- Select HTTP traffic and set the internal port to
8080. - Add environment variables for
PORT,DRAWIO_BASE_URL, and any branding/offline options. - Optionally attach a persistent volume at
/var/lib/drawioif you store custom assets. - Deploy. After the app starts, open the URL to begin creating diagrams.
Verification
-
UI: open
https://example-app.klutch.shand confirm the draw.io editor loads. -
Quick check:
Terminal window curl -I https://example-app.klutch.sh
Next steps
- Connect to cloud storage (Google Drive, OneDrive, etc.) from within the app if desired.
- Restrict access via your edge controls if hosting internal diagrams.
- Set up backups for any persistent path you add.