Deploying a Kroki App
Introduction
Kroki is an open-source diagram rendering service that converts textual diagram definitions into images. Deploying Kroki with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and optional persistent storage for cache and assets—all managed from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample usage, and production tips.
Prerequisites
- A Klutch.sh account (create one)
- A GitHub repository containing your Kroki configuration (GitHub is the only supported git source)
- Docker familiarity; Kroki runs on JVM and Node components
- Optional: persistent storage for cache if you want warm renders across deployments
For platform onboarding, see the Quick Start.
Architecture and ports
- Kroki serves HTTP; set the internal container port to
8000. - If you deploy backing tools or caches, run them as separate Klutch.sh TCP apps exposed on port
8000and connect on native ports. - Persistent storage is optional for cache; mount it if you want faster cold starts.
Repository layout
kroki/├── config/ # Optional config overrides├── Dockerfile # Must be at repo root for auto-detection└── README.mdKeep secrets out of Git; manage them with Klutch.sh environment variables.
Installation (local) and starter commands
Local test with the official image:
docker run --rm -p 8000:8000 yuzutech/krokiOptional start.sh for portability and Nixpacks fallback:
#!/usr/bin/env bashset -euo pipefailexec java -Djava.security.egd=file:/dev/./urandom -jar /opt/kroki/kroki-server.jarMake it executable with chmod +x start.sh.
Dockerfile for Kroki (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):
FROM yuzutech/kroki:0.24.0
WORKDIR /opt/kroki
# Copy custom config if neededCOPY config /opt/kroki/config
EXPOSE 8000CMD ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/opt/kroki/kroki-server.jar"]Notes:
- Pin the image tag for reproducible builds.
- If you add diagram tools or fonts, extend the image accordingly.
Environment variables (Klutch.sh)
PORT=8000KROKI_CACHE_DIR=/opt/kroki/cache(optional if you persist cache)KROKI_MAX_REQUEST_SIZE=1048576(adjust as needed)- Set any tool-specific toggles as env vars if you customize the image.
If you deploy without the Dockerfile and need Nixpacks overrides:
NIXPACKS_BUILD_CMD="echo Kroki uses prebuilt image"NIXPACKS_START_CMD=java -Djava.security.egd=file:/dev/./urandom -jar /opt/kroki/kroki-server.jarNIXPACKS_JDK_VERSION=17
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/opt/kroki/cache— optional cache to speed repeated renders./opt/kroki/config— optional if you edit configs at runtime.
Ensure these paths are writable inside the container.
Deploy Kroki on Klutch.sh (Dockerfile workflow)
- Push your repository (with the Dockerfile at the root) to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Connect the GitHub repository; Klutch.sh automatically detects the Dockerfile.
- Choose HTTP traffic for Kroki.
- Set the internal port to
8000. - Add the environment variables above (cache dir, request size, and any
NIXPACKS_*overrides if you temporarily deploy without the Dockerfile). - Attach persistent volumes for
/opt/kroki/cache(and/opt/kroki/configif used), selecting sizes that fit your caching needs. - Deploy. Your Kroki service will be reachable at
https://example-app.klutch.sh; attach a custom domain if desired.
Sample usage
Render a PlantUML diagram via HTTP:
curl -X GET \ "https://example-app.klutch.sh/plantuml/svg/SoWkIImgAStDuNBCoKnELT2rKt3AJx9pKiX8pSd9oCbCJbMmKiX8pSd9B4bCJbNmKiX8LSZFIyrA0M00"Health checks and production tips
- Add a reverse proxy health check to
/health(if enabled) or/to verify the service. - Enforce HTTPS at the edge; forward HTTP to port 8000 internally.
- Pin image tags and test upgrades carefully, as diagram tool versions may change outputs.
- Monitor disk usage if caching; resize volumes before they fill.
- Keep request size limits and timeouts tuned for your diagrams.
Kroki on Klutch.sh combines reproducible Docker builds with managed secrets, optional persistent cache, and flexible HTTP/TCP routing. With the Dockerfile at the repo root and port 8000 configured, you can deliver fast, reliable diagram rendering without extra YAML or workflow overhead.