Last active
July 16, 2021 00:15
-
-
Save liyangau/faf00c6c696e62bf3e4e26e2f8576473 to your computer and use it in GitHub Desktop.
All in one Kong Hybrid deployment with Postgres DB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.1' | |
services: | |
####################################### | |
# Postgres: Kong Database | |
####################################### | |
kong-db: | |
image: postgres:12-alpine | |
container_name: kong-db | |
networks: | |
- kong-net | |
environment: | |
POSTGRES_DB: kong | |
POSTGRES_USER: kong | |
POSTGRES_PASSWORD: kong | |
healthcheck: | |
test: ["CMD", "pg_isready", "-U", "kong"] | |
interval: 10s | |
timeout: 5s | |
retries: 5 | |
restart: on-failure | |
####################################### | |
# Kong database migration | |
####################################### | |
kong-migrations: | |
image: kong:2.5-ubuntu | |
command: kong migrations bootstrap | |
container_name: kong-migrations | |
networks: | |
- kong-net | |
depends_on: | |
kong-db: | |
condition: service_healthy | |
environment: | |
KONG_DATABASE: postgres | |
KONG_PG_HOST: kong-db | |
KONG_PG_DATABASE: kong | |
KONG_PG_USER: kong | |
KONG_PG_PASSWORD: kong | |
restart: on-failure | |
####################################### | |
# Kong: Control Plane | |
####################################### | |
kong-cp: | |
image: kong:2.5-ubuntu | |
container_name: kong-cp | |
networks: | |
- kong-net | |
restart: on-failure | |
depends_on: | |
kong-db: | |
condition: service_healthy | |
volumes: | |
- ${PWD}/cert/:/cert | |
environment: | |
KONG_ADMIN_LISTEN: 0.0.0.0:8001 | |
KONG_ROLE: control_plane | |
KONG_DATABASE: postgres | |
KONG_PG_HOST: kong-db | |
KONG_PG_DATABASE: kong | |
KONG_PG_USER: kong | |
KONG_PG_PASSWORD: kong | |
KONG_CLUSTER_CERT: /cert/cluster.crt | |
KONG_CLUSTER_CERT_KEY: /cert/cluster.key | |
KONG_PROXY_LISTEN: "off" | |
KONG_STREAM_LISTEN: "off" | |
ports: | |
- "8001:8001/tcp" | |
####################################### | |
# Kong: Data Plane | |
####################################### | |
kong-dp: | |
image: kong:2.5-ubuntu | |
container_name: kong-dp | |
restart: on-failure | |
depends_on: | |
- kong-cp | |
networks: | |
- kong-net | |
volumes: | |
- ${PWD}/cert/:/cert | |
environment: | |
KONG_ADMIN_LISTEN: "off" | |
KONG_ROLE: data_plane | |
KONG_DATABASE: "off" | |
KONG_CLUSTER_CERT: /cert/cluster.crt | |
KONG_CLUSTER_CERT_KEY: /cert/cluster.key | |
KONG_CLUSTER_CONTROL_PLANE: kong-cp:8005 | |
ports: | |
- "8000:8000/tcp" | |
networks: | |
kong-net: | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment