-
-
Save andrzj/60ba737dbf9f1ce0d6cd03cce25ea7f7 to your computer and use it in GitHub Desktop.
example docker-compose.yml for kong, postgres and konga
This file contains hidden or 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" | |
networks: | |
kong-net: | |
driver: bridge | |
services: | |
####################################### | |
# Postgres: The database used by Kong | |
####################################### | |
kong-database: | |
image: postgres:9.6 | |
restart: always | |
networks: | |
- kong-net | |
environment: | |
POSTGRES_USER: ${KONG_PG_USER:-kong} | |
POSTGRES_DB: ${KONG_PG_DATABASE:-kong} | |
POSTGRES_PASSWORD: ${KONG_PG_PASSWORD:-kong} | |
ports: | |
- "5432:5432" | |
healthcheck: | |
test: ["CMD", "pg_isready", "-U", "${KONG_PG_USER:-kong}"] | |
interval: 30s | |
timeout: 30s | |
retries: 5 | |
stdin_open: true | |
tty: true | |
volumes: | |
- ./kong-pgdata:/var/lib/postgresql/data | |
####################################### | |
# Kong database migration | |
####################################### | |
kong-migration: | |
image: "${KONG_DOCKER_TAG:-kong:latest}" | |
command: kong migrations bootstrap | |
networks: | |
- kong-net | |
restart: on-failure | |
environment: | |
KONG_DATABASE: postgres | |
KONG_PG_HOST: kong-database | |
KONG_PG_DATABASE: ${KONG_PG_DATABASE:-kong} | |
KONG_PG_USER: ${KONG_PG_USER:-kong} | |
KONG_PG_PASSWORD: ${KONG_PG_PASSWORD:-kong} | |
links: | |
- kong-database | |
depends_on: | |
kong-database: | |
condition: service_healthy | |
####################################### | |
# Kong: The API Gateway | |
####################################### | |
kong: | |
image: "${KONG_DOCKER_TAG:-kong:latest}" | |
restart: always | |
networks: | |
- kong-net | |
environment: | |
KONG_PG_HOST: kong-database | |
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_PG_DATABASE: ${KONG_PG_DATABASE:-kong} | |
KONG_PG_USER: ${KONG_PG_USER:-kong} | |
KONG_PG_PASSWORD: ${KONG_PG_PASSWORD:-kong} | |
KONG_ADMIN_ACCESS_LOG: /dev/stdout | |
KONG_ADMIN_ERROR_LOG: /dev/stderr | |
KONG_PROXY_ACCESS_LOG: /dev/stdout | |
KONG_PROXY_ERROR_LOG: /dev/stderr | |
depends_on: | |
- kong-database | |
- kong-migration | |
healthcheck: | |
test: ["CMD", "curl", "-f", "http://kong:8001"] | |
interval: 5s | |
timeout: 2s | |
retries: 15 | |
ports: | |
- "8000:8000/tcp" | |
- "8001:8001/tcp" | |
- "8443:8443/tcp" | |
- "8444:8444/tcp" | |
####################################### | |
# Konga database prepare | |
####################################### | |
konga-prepare: | |
image: "${KONGA_DOCKER_TAG:-pantsel/konga:latest}" | |
command: "-c prepare -a postgres -u postgresql://${KONG_PG_USER:-kong}:${KONG_PG_PASSWORD:-kong}@kong-database:5432/konga_db" | |
networks: | |
- kong-net | |
restart: on-failure | |
links: | |
- kong-database | |
depends_on: | |
kong-database: | |
condition: service_healthy | |
####################################### | |
# Konga: Kong GUI | |
####################################### | |
konga: | |
image: "${KONGA_DOCKER_TAG:-pantsel/konga:latest}" | |
restart: always | |
networks: | |
- kong-net | |
environment: | |
TOKEN_SECRET: ${KONGA_SECRET:-somerandomsecret} | |
DB_ADAPTER: postgres | |
DB_HOST: kong-database | |
DB_USER: ${KONG_PG_USER:-kong} | |
DB_DATABASE: ${KONG_PG_DATABASE:-kong} | |
DB_PASSWORD: ${KONG_PG_PASSWORD:-kong} | |
NODE_ENV: ${KONGA_NODE_ENV:-development} | |
depends_on: | |
kong-database: | |
condition: service_healthy | |
ports: | |
- "1337:1337" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment