:diagram-server-url: https://kroki.io/
:diagram-server-type: kroki_io
Kroki Configuration Guide
This guide provides comprehensive instructions for configuring Kroki with docToolchain, including the background story of why multiple attribute sets exist.
Overview
Kroki is a service that converts text-based diagrams (PlantUML, Mermaid, GraphViz, etc.) into images without requiring local tool installations. However, configuring Kroki in docToolchain can be confusing due to historical evolution of diagram extensions.
The Two Extensions
There are two different AsciiDoc extensions that support Kroki:
asciidoctor-diagram: The All-Rounder
The original asciidoctor-diagram
extension existed before Kroki and supported local tools. In version 2.1.0, Kroki support was added:
This extension can use both local tools AND delegate to Kroki servers.
asciidoctor-kroki: The Specialist
The specialized asciidoctor-kroki
extension was built exclusively for Kroki:
:kroki-server-url: https://kroki.io/
This extension is optimized specifically for Kroki integration.
Recommended Configuration
Defensive Configuration Strategy
To ensure compatibility with both extensions, use all attributes:
// Kroki configuration (compatible with all extensions)
:diagram-server-url: https://kroki.io/
:diagram-server-type: kroki_io
:kroki-server-url: https://kroki.io/
Configuration in docToolchainConfig.groovy
asciidoctorAttributes = [
// Defensive Kroki configuration
'diagram-server-url': 'https://kroki.io/',
'diagram-server-type': 'kroki_io',
'kroki-server-url': 'https://kroki.io/',
// Other attributes...
'toc': 'left',
'icons': 'font'
]
Enterprise Setup: Local Kroki Server
For organizations that prefer not to send diagrams to external services:
Docker Setup
# Start Kroki locally
docker run -d --name kroki -p 8000:8000 yuzutech/kroki
# Verify it's running
curl http://localhost:8000/health
Configuration for Local Server
// Local Kroki server configuration
:diagram-server-url: http://localhost:8000/
:diagram-server-type: kroki_io
:kroki-server-url: http://localhost:8000/
Or in docToolchainConfig.groovy:
asciidoctorAttributes = [
'diagram-server-url': 'http://localhost:8000/',
'diagram-server-type': 'kroki_io',
'kroki-server-url': 'http://localhost:8000/',
]
Practical Examples
PlantUML Sequence Diagram
|
![]() |
Mermaid Flowchart
|
![]() |
GraphViz Diagram
|
![]() |
Supported Diagram Types
Kroki supports numerous diagram types:
-
PlantUML
-
Mermaid
-
GraphViz
-
Ditaa
-
BlockDiag
-
BPMN
-
C4 (with PlantUML)
-
And many more
For a complete list, visit kroki.io.
Troubleshooting
Diagrams Not Rendering
-
Check server connectivity: [source,bash] ---- curl https://kroki.io/health ----
-
Verify attribute configuration:
-
Ensure all three attributes are set for maximum compatibility
-
Check for typos in attribute names
-
-
Test with simple diagram: [source,asciidoc] ---- [plantuml] …. A → B …. ----
Local Server Issues
-
Container not starting: [source,bash] ---- docker logs kroki ----
-
Port conflicts: [source,bash] ---- # Use different port docker run -d --name kroki -p 8080:8000 yuzutech/kroki ----
-
Firewall blocking access:
-
Ensure port 8000 (or your chosen port) is accessible
-
Check corporate firewall settings
-
Network Configuration
For corporate environments:
// Configure proxy if needed
System.setProperty("http.proxyHost", "proxy.company.com")
System.setProperty("http.proxyPort", "8080")
System.setProperty("https.proxyHost", "proxy.company.com")
System.setProperty("https.proxyPort", "8080")
Advanced Configuration
Custom Kroki Instance with Additional Services
Some diagram types require additional containers:
# Full Kroki setup with all services
docker-compose up -d
# Or selective services
docker run -d --name kroki-mermaid yuzutech/kroki-mermaid
docker run -d --name kroki-bpmn yuzutech/kroki-bpmn
Performance Optimization
For high-volume documentation:
asciidoctorAttributes = [
'kroki-fetch-diagram': 'true', // Cache diagrams locally
'kroki-default-format': 'svg', // Use SVG for better quality
]
Security Considerations
Network Security
-
Use HTTPS for external Kroki servers
-
Consider VPN for remote team access to local instances
-
Implement proper firewall rules
Data Privacy
-
Evaluate whether diagram content contains sensitive information
-
Consider local deployment for confidential projects
-
Review data retention policies of external services
Why Use Defensive Configuration?
This approach offers several benefits:
✅ Future-proof: Works with extension updates
✅ Flexible: docToolchain can switch between extensions
✅ Robust: No breaking changes with upgrades
✅ Team-friendly: Team members don’t need to know implementation details
Further Resources
Contributing
Found an issue with this guide or have improvements? Please contribute:
-
Report issues on GitHub
-
Submit pull requests with corrections
-
Share your configuration experiences
Your feedback helps improve the documentation for everyone!
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.