Skip to content

Instantly share code, notes, and snippets.

@tuannguyenssu
Created October 9, 2019 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuannguyenssu/6066e256b095f28870add8c406ce836c to your computer and use it in GitHub Desktop.
Save tuannguyenssu/6066e256b095f28870add8c406ce836c to your computer and use it in GitHub Desktop.
version: "3.7"
#######################################
# Network: local-docker-net
#######################################
networks:
local-docker-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
#######################################
kong-postgres-database:
image: postgres:9.6
restart: unless-stopped
networks:
- local-docker-net
environment:
POSTGRES_USER: kong
POSTGRES_DB: kong
ports:
- "5432:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 5s
timeout: 5s
retries: 5
#######################################
# Kong database migration
#######################################
kong-migration:
image: kong
command: "kong migrations bootstrap"
networks:
- local-docker-net
restart: on-failure
environment:
KONG_PG_HOST: kong-postgres-database
depends_on:
- kong-postgres-database
#######################################
# Kong: The API Gateway
#######################################
kong:
image: kong
restart: unless-stopped
networks:
- local-docker-net
environment:
KONG_PG_HOST: kong-postgres-database
KONG_DATABASE: postgres
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_LOG_LEVEL: debug
KONG_ADMIN_LISTEN: 0.0.0.0:8001, 0.0.0.0:8444 ssl
# KONG_PROXY_LISTEN: 0.0.0.0:8000
# KONG_PROXY_LISTEN_SSL: 0.0.0.0:8443
# KONG_ADMIN_LISTEN: 0.0.0.0:8001,
# KONG_ADMIN_LISTEN_SSL: 0.0.0.0:8444
depends_on:
- kong-migration
- kong-postgres-database
healthcheck:
test: ["CMD", "curl", "-f", "http://kong:8001"]
interval: 5s
timeout: 2s
retries: 15
# volumes:
# - ./kong/dev/stdout:/dev/stdout
# - ./kong/dev/stderr:/dev/stderr
ports:
- "8001:8001"
- "8444:8444"
- "8000:8000"
- "8443:8443"
#######################################
# Konga database prepare
#######################################
konga-prepare:
image: pantsel/konga
command: "-c prepare -a postgres -u postgresql://kong@kong-postgres-database:5432/konga_db"
networks:
- local-docker-net
restart: on-failure
links:
- kong-postgres-database
depends_on:
- kong-postgres-database
#######################################
# Konga: Kong GUI
#######################################
konga:
image: pantsel/konga
restart: unless-stopped
networks:
- local-docker-net
environment:
DB_ADAPTER: postgres
DB_HOST: kong-postgres-database
DB_USER: kong
TOKEN_SECRET: km1GUr4RkcQD7DewhJPNXrCuZwcKmqjb
DB_DATABASE: konga_db
NODE_ENV: production
depends_on:
- kong-migration
- kong-postgres-database
- kong
volumes:
- ./konga/data:/app/kongadata
ports:
- "1337:1337"
#######################################
# Prometheus
#######################################
prometheus:
image: prom/prometheus
restart: unless-stopped
networks:
- local-docker-net
depends_on:
- kong-migration
- kong-postgres-database
- kong
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
#######################################
# Grafana
#######################################
grafana:
image: grafana/grafana
restart: unless-stopped
networks:
- local-docker-net
depends_on:
- kong-migration
- kong-postgres-database
- kong
- prometheus
# volumes:
# - ./grafana:/etc/grafana
ports:
- "3000:3000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment