Kong with Konga and db storage on docker-compose?

Hi All,

I am very new to Kong and have been testing out many different docker-compose files to try and get a combination that I need to run, but have had poor luck so I am oping that someone can help.

What I need is a docker-compose file that will pull up the latest Kong and latest Konga along with utilizing a database (Postgresql and/or Mongodb) to store the Kong and Konga changes.

All of the docker-compose.yml files that I have come across, like:

Pulls up the latest versions, it seems, but does not store the Konga data in a database.

While

uses Postgresql for Kong, and MongoDB for Konga, but is using an old version of Konga (1.0.0 Release Candidate) and the latest Konga does not work well since there seems to be a compatibility issue in needing Kong 1.2 or newer.

I would like to fire up the latest of each in a known working docker-compose and have not worked enough with docker-compose nor Konga & Konga to get it all working correctly.

Later, once I have a working docker-compose.yml then maybe I can investigate how to extend it so that I can also fire up a Letsencrypt container to give SSL protection to the Kong API Gateway as it will be the only thing running on this physical machine which is a Debian 10 (x86_64) system.

I there anyone here that can help me to get a good working docker-compose.yml as I have spent about 4 days trying to get different versions to work by modifying the docker hub pull tags in the from the above github sites, but keep failing?

Any help would be truly appreciated.
Thanks in advance

If you like the kongpose one, except for the Konga version, just alter the image it is using. By changing the dockerfile to the tag you want:

https://github.com/asyrjasalo/kongpose/blob/master/konga/Dockerfile -> change ‘latest’ to ‘next’.

Explanation:

  • The docker-compose file references to the ./konga directory, by using the build property. He could also directly target the dockerhub with the image property like he is doing with the konga-database container, but he wanted to add some instructions to seed userdata.
  • You want to use the ‘next’ tag of Konga, because in contrast to what the latest tag suggests, Konga does not have its latest changes committed to the latest tag. Instead he used ‘next’, which you can see on Docker hub: https://hub.docker.com/r/pantsel/konga/tags

Hello,

I actually previously tried what you are suggesting as an initial attempt to update and run the latest versions together and the results did not work out as far as running in that Kong crashed.

I tried, in each of their respective directories for each Dockerfile tag:

kong:latest
konga:next

but this combination does not work.

Are you able to do this and bring it up well with “docker-compose up”?

If so, then did you try to add a service “json-placeholder.typi.com” (for example) and then add a route as I found in some combinations that it would fire up, but would not allow me to add the route through Konga.

Cheers

Ah it worked with just updating Konga, but if I update the Kong container it fails on the migrations. Not sure why.

Maybe you can use my docker-compose file, to which I believe most of the credits go to Kong: I believe I found it somewhere in of their repos. I slightly altered it, but can’t remember exactly what. So i’ve not written it myself and it may not be really clean because I did not use it for any serious stuff, but it boots up for me with both the latest Kong and Konga. I think you might at least want to add a volume to the konga container, because now everytime you boot it up you need to add a new user and create a new connection again.

Hope it helps though!

The docker-compose file:

version: '3.7'

volumes:
  kong_data: {}

networks:
  kong-net:
external: false

services:
  kong-migrations:
image: "${KONG_DOCKER_TAG:-kong:latest}"
command: kong migrations bootstrap
depends_on:
  - db
environment:
  KONG_DATABASE: postgres
  KONG_PG_DATABASE: ${KONG_PG_DATABASE:-kong}
  KONG_PG_HOST: db
  KONG_PG_USER: ${KONG_PG_USER:-kong}
  KONG_PG_PASSWORD: kong
networks:
  - kong-net
restart: on-failure

  kong-migrations-up:
image: "${KONG_DOCKER_TAG:-kong:latest}"
command: kong migrations up && kong migrations finish
depends_on:
  - db
environment:
  KONG_DATABASE: postgres
  KONG_PG_DATABASE: ${KONG_PG_DATABASE:-kong}
  KONG_PG_HOST: db
  KONG_PG_USER: ${KONG_PG_USER:-kong}
  KONG_PG_PASSWORD: kong
networks:
  - kong-net
restart: on-failure

  kong:
image: "${KONG_DOCKER_TAG:-kong:latest}"
user: "${KONG_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_PG_DATABASE:-kong}
  KONG_PG_HOST: db
  KONG_PG_USER: ${KONG_PG_USER:-kong}
  KONG_PROXY_ACCESS_LOG: /dev/stdout
  KONG_PROXY_ERROR_LOG: /dev/stderr
  KONG_PG_PASSWORD: kong
networks:
  - kong-net
ports:
  - "9000:8000/tcp"
  - "9001:8001/tcp"
  - "8443:8443/tcp"
healthcheck:
  test: ["CMD", "kong", "health"]
  interval: 10s
  timeout: 10s
  retries: 10
restart: on-failure

  db:
image: postgres:9.5
environment:
  POSTGRES_DB: ${KONG_PG_DATABASE:-kong}
  POSTGRES_USER: ${KONG_PG_USER:-kong}
  POSTGRES_PASSWORD: kong
healthcheck:
  test: ["CMD", "pg_isready", "-U", "${KONG_PG_USER:-kong}"]
  interval: 30s
  timeout: 30s
  retries: 3
restart: on-failure
stdin_open: true
tty: true
ports:
  - "5432:5432"
networks:
  - kong-net
volumes:
  - ./kong_data:/var/lib/postgresql/data

  konga:
image: pantsel/konga:next
depends_on:
  - kong
ports:
  - 1339:1337
networks:
  - kong-net
container_name: konga-local
environment:
  - NODE_ENV=production

  redis:
image: redis
networks:
  - kong-net

the docker-compose.override.yml file:

version: '3.7'

services:
  kong:
    ports:
      - "9000:8000/tcp"
      - "9001:8001/tcp"

Hi All,

Just wanted to report that “José Abraham” did an update to his github docker-compose to all for Konga persistence and it was exactly what I needed.

(Here it is in case someone else had the same issues)

I appreciate all of the help
Thanks

2 Likes

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ