Skip to main content
The KrakenD Playground uses Docker Compose to orchestrate a complete API Gateway environment with observability, authentication, and backend services.

Services Overview

The docker-compose.yml defines the following services:

Core Services

  • krakend_ce - KrakenD Community Edition API Gateway with automatic configuration reload
  • fake_api - Simple busybox-based HTTP server serving static files from the data/ directory
  • web - Express JS Single Page Application that consumes the KrakenD API

Observability Stack

  • grafana - Metrics visualization dashboard (Grafana 9.1.2)
  • influxdb - Time-series database for storing KrakenD metrics (InfluxDB 1.8.10)
  • jaeger - Distributed tracing UI and collector
  • elasticsearch - Document store for logs (Elasticsearch 8.4.1)
  • kibana - Log visualization and analysis (Kibana 8.4.1)
  • logstash - Log processing pipeline (Logstash 8.4.1)

Authentication & Messaging

  • keycloak - Identity Provider (IdP) for JWT token generation and validation
  • jwt_revoke - JWT token revoker using KrakenD bloomfilter client
  • rabbitmq - Message broker for async agent demonstrations

Port Mappings

ServiceHost PortContainer PortDescription
krakend_ce80808080KrakenD API Gateway main endpoint
krakend_ce80908090KrakenD admin/debug port
krakend_ce12341234Additional KrakenD port
fake_api800080Fake backend API
web30003000Demo web application
grafana40003000Grafana dashboard
influxdb80868086InfluxDB HTTP API
jaeger1668616686Jaeger UI
jaeger1426814268Jaeger collector
elasticsearch192009200Elasticsearch HTTP API
elasticsearch93009300Elasticsearch transport
kibana56015601Kibana UI
logstash1220112201/udpLogstash GELF UDP input
logstash50445044Logstash Beats input
rabbitmq1567215672RabbitMQ Management UI
jwt_revoke90008080JWT revoker service
keycloak80858080Keycloak admin console

Volume Mounts

KrakenD Configuration

volumes:
  - ./config/krakend:/etc/krakend
Mounts the KrakenD configuration directory, enabling automatic reload when krakend.json changes.

Grafana Provisioning

volumes:
  - "./config/grafana/datasources/all.yml:/etc/grafana/provisioning/datasources/all.yml"
  - "./config/grafana/dashboards/all.yml:/etc/grafana/provisioning/dashboards/all.yml"
  - "./config/grafana/krakend:/var/lib/grafana/dashboards/krakend"
  - "./data/jwk/symmetric.json:/opt/krakend/jwk-symmetric.json"
Pre-configures Grafana with datasources and KrakenD dashboards.

Logstash Pipeline

volumes:
  - ./config/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
Defines the log processing pipeline configuration.

Fake API Data

volumes:
  - ./data:/var/www/
Serves static XML, JSON, and RSS files as mock backend responses.

Keycloak Realms

volumes:
  - ./config/keycloak/realms:/opt/keycloak/data/import
Imports pre-configured realm with test users and roles.

Service Dependencies

KrakenD Dependencies

krakend_ce:
  depends_on:
    - fake_api
    - jaeger
KrakenD waits for the fake API backend and Jaeger tracing service to start.

JWT Revoker Dependencies

jwt_revoke:
  depends_on:
    - krakend_ce
  restart: always
The JWT revoker service depends on KrakenD being available and automatically restarts on failure.

Environment Variables

InfluxDB

environment:
  - "INFLUXDB_DB=krakend"
  - "INFLUXDB_USER=krakend-dev"
  - "INFLUXDB_USER_PASSWORD=pas5w0rd"
  - "INFLUXDB_ADMIN_USER=admin"
  - "INFLUXDB_ADMIN_PASSWORD=supersecretpassword"
Creates the KrakenD database with credentials for metrics storage.

Elasticsearch

environment:
  - "discovery.type=single-node"
  - "xpack.security.enabled=false"
  - "xpack.security.transport.ssl.enabled=false"
  - "xpack.security.http.ssl.enabled=false"
  - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
Configures Elasticsearch in single-node mode with security disabled for development and 1GB heap size.

Logstash

environment:
  - "xpack.monitoring.elasticsearch.url=http://elasticsearch:9200"
Connects Logstash monitoring to Elasticsearch.

Keycloak

environment:
  - KEYCLOAK_ADMIN=admin
  - KEYCLOAK_ADMIN_PASSWORD=admin
Sets the Keycloak administrator credentials.

Special Configuration

KrakenD Auto-reload

The KrakenD service uses the :watch image variant in development:
image: krakend
volumes:
  - ./config/krakend:/etc/krakend
command: ["run", "-d", "-c", "/etc/krakend/krakend.json"]
Changes to krakend.json are automatically detected and applied without restarting the container.

Init Process

init: true
KrakenD runs with an init process to properly handle signals and zombie processes.

Build docs developers (and LLMs) love