Skip to content

Instantly share code, notes, and snippets.

@luscas
Created August 25, 2025 16:50
Show Gist options
  • Select an option

  • Save luscas/0b64973265d22b23117ba6c662f8a2cb to your computer and use it in GitHub Desktop.

Select an option

Save luscas/0b64973265d22b23117ba6c662f8a2cb to your computer and use it in GitHub Desktop.
Kong + Konga + Redis
version: "3.9"
volumes:
kong-db:
driver: local
networks:
internal:
external: false
services:
kong-database:
image: postgres:9.5
deploy:
restart_policy:
condition: any
volumes:
- kong-db:/var/lib/postgresql/data
networks:
- internal
environment:
POSTGRES_USER: kong
POSTGRES_DB: kong
POSTGRES_PASSWORD: kong
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 10s
timeout: 5s
retries: 5
kong-migration-bootstrap:
image: kong:latest
command: kong migrations bootstrap
deploy:
restart_policy:
condition: on-failure
networks:
- internal
depends_on:
- kong-database
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-database
KONG_PG_USER: kong
KONG_PG_PASSWORD: kong
kong-migration-up:
image: kong:latest
command: kong migrations up
deploy:
restart_policy:
condition: on-failure
networks:
- internal
depends_on:
- kong-database
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-database
KONG_PG_USER: kong
KONG_PG_PASSWORD: kong
kong:
image: kong:latest
user: root
build:
context: .
dockerfile: Dockerfile
networks:
- internal
deploy:
restart_policy:
condition: any
depends_on:
- kong-database
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-database
- KONG_PG_USER=kong
- KONG_PG_PASSWORD=kong
- KONG_PROXY_ACCESS_LOG=/dev/stdout
- KONG_ADMIN_ACCESS_LOG=/dev/stdout
- KONG_PROXY_ERROR_LOG=/dev/stderr
- KONG_ADMIN_ERROR_LOG=/dev/stderr
- KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
- KONG_PROXY_ADMIN_API_PORT=8001
- KONG_PLUGINS=bundled,kong-jwt2header,kong-upstream-jwt,kong-spec-expose
- KONG_LUA_PACKAGE_PATH=./?.lua;./?/init.lua;
ports:
- 80:8000
- 443:8443
- 8001:8001
- 8444:8444
healthcheck:
test: ["CMD-SHELL", "curl -I -s -L http://127.0.0.1:8000 || exit 1"]
interval: 5s
retries: 10
restart: on-failure
konga:
image: pantsel/konga
networks:
- internal
deploy:
restart_policy:
condition: on-failure
depends_on:
- kong-database
environment:
NODE_ENV: development
ports:
- 1337:1337
extra_hosts:
- "host.docker.internal:host-gateway"
cache:
image: redis:6
restart: always
deploy:
restart_policy:
condition: any
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 1s
timeout: 3s
retries: 5
ports:
- 6379:6379
networks:
- internal
FROM kong:latest
USER root
RUN luarocks install kong-jwt2header && \
luarocks install kong-upstream-jwt && \
luarocks install kong-spec-expose
USER kong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment