Skip to content

Instantly share code, notes, and snippets.

@ekojs
Created October 17, 2020 12:38
Show Gist options
  • Save ekojs/92d1e72d6dc18c792b30b5a7658d672d to your computer and use it in GitHub Desktop.
Save ekojs/92d1e72d6dc18c792b30b5a7658d672d to your computer and use it in GitHub Desktop.
My Kong Setup
version: '3.7'
networks:
kong-net:
external: false
services:
kong-migrations:
image: kong
command: "kong migrations bootstrap && kong migrations up && kong migrations finish"
depends_on:
- db
environment:
KONG_DATABASE: postgres
KONG_PG_DATABASE: kong
KONG_PG_HOST: db
KONG_PG_USER: kong
KONG_PG_PASSWORD_FILE: /run/secrets/kong_postgres_password
secrets:
- kong_postgres_password
networks:
- kong-net
restart: on-failure
kong:
image: kong
#build: ./conf
user: kong
depends_on:
- db
environment:
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_ADMIN_LISTEN: '0.0.0.0:8001'
KONG_CASSANDRA_CONTACT_POINTS: db
KONG_DATABASE: postgres
KONG_PG_DATABASE: kong
KONG_PG_HOST: db
KONG_PG_USER: kong
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_PG_PASSWORD_FILE: /run/secrets/kong_postgres_password
secrets:
- kong_postgres_password
networks:
- kong-net
ports:
- "80:8000/tcp"
- "443:8443/tcp"
- "127.0.0.1:8001:8001/tcp"
- "127.0.0.1:8444:8444/tcp"
healthcheck:
test: ["CMD", "kong", "health"]
interval: 10s
timeout: 10s
retries: 10
restart: on-failure
db:
image: postgres:9.6
environment:
POSTGRES_DB: kong
POSTGRES_USER: kong
POSTGRES_PASSWORD_FILE: /run/secrets/kong_postgres_password
secrets:
- kong_postgres_password
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 30s
timeout: 30s
retries: 3
restart: on-failure
stdin_open: true
tty: true
networks:
- kong-net
volumes:
- ./data:/var/lib/postgresql/data
api:
image: docker_api_web
restart: always
container_name: api
networks:
- kong-net
volumes:
- ./api:/var/www/html
secrets:
kong_postgres_password:
file: ./POSTGRES_PASSWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment