Skip to content

Instantly share code, notes, and snippets.

@liyangau
Last active July 29, 2022 13:23
Show Gist options
  • Save liyangau/ac14fbba39c5772e59d5eac676c803dd to your computer and use it in GitHub Desktop.
Save liyangau/ac14fbba39c5772e59d5eac676c803dd to your computer and use it in GitHub Desktop.
All in one Kong deployment with Postgres DB
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: The API Gateway
#######################################
kong-ce:
image: kong:2.5-ubuntu
container_name: kong
networks:
- kong-net
restart: on-failure
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
KONG_PROXY_LISTEN: 0.0.0.0:8000
KONG_ADMIN_LISTEN: 0.0.0.0:8001
ports:
- "8000-8001:8000-8001/tcp"
networks:
kong-net:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment