Tag

install konga docker

Browsing

About Kong API Gateway

Kong is an API gateway and platform. That means it is a form of middleware between computing clients and your API-based applications. Kong easily and consistently extends the features of your APIs. Some of the popular features deployed through Kong include authentication, security, traffic control, serverless, analytics & monitoring, request/response transformations and logging.

You can read more about what is Kong and concepts in Kong

How to install Kong on Docker

Step1: Create a Docker network

docker network create my-network

Step2: Install Postgress and prepare Postgres DB for Kong

docker run -d --name kong-database --network=my-network \
-e "POSTGRES_USER=kong" -e "POSTGRES_DB=kong" -e "POSTGRES_PASSWORD=kong" \
-p 5432:5432 postgres:9.6

docker run --rm --network=my-network \
-e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" \
-e "KONG_PG_PASSWORD=kong" kong:latest kong migrations bootstrap

Step3: Install and start Kong

docker run -d --name kong --network=my-network \
-e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" \
-e "KONG_PG_PASSWORD=kong" -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
-p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 kong:latest

List docker containers

docker ps

Check Kong is started?

curl -X POST --url http://localhost:8001/services/ --data 'name=my-api' --data 'url=http://localhost:8080'

if Kong is started, you will receive a response like this

{
   "code":5,
   "name":"unique constraint violation",
   "message":"UNIQUE violation detected on '{name=\"my-api\"}'",
   "fields":{
      "name":"my-api"
   }
}

You can also check Kong is started by call curl -i http://localhost:8001/

What is Konga?

Konga is a fully-featured open-source, multi-user GUI, that makes the hard task of managing multiple Kong installations easy way.

It can be integrated with MySQL, postgresSQL, MongoDB databases out of the box, and provides the GUI for better understanding and maintain architecture.

Konga Features

  • Manage all Kong Admin API Objects.
  • Import Consumers from remote sources (Databases, files, APIs etc.).
  • Manage multiple Kong Nodes.
  • Backup, restore and migrate Kong Nodes using Snapshots.
  • Monitor Node and API states using health checks.
  • Email & Slack notifications.
  • Multiple users.
  • Easy database integration (MySQL, postgresSQL, MongoDB).

Install Konga

Prepare Konga database

docker run --rm --network=my-network pantsel/konga -c prepare -a postgres -u postgresql://kong:kong@kong-database:5432/konga_db

In the above command, you need to specify username, password and database Postgress in connection string postgresql://user:pass@kong-database-container-name:5432/konga-db-name

Install and start Konga

docker run -p 1337:1337 \
     --network=my-network \
     -e "DB_ADAPTER=postgres" \
     -e "DB_HOST=kong-database" \
     -e "DB_USER=kong" \
     -e "DB_PASSWORD=kong" \
     -e "DB_DATABASE=konga_db" \
     -e "KONGA_HOOK_TIMEOUT=120000" \
     -e "NODE_ENV=production" \
     --name konga \
     pantsel/konga

Access Konga at http://localhost:1337

Connect Konga to Kong

After installing Konga successfully, you need to connect Konga to Kong by accessing the connections link and creating a new connection. At this screen, you need to fill name and Kong Admin URL like this

Next, you need to activate the created connection by clicking on activate button.

If successful, you will receive a sidebar menu with full features like this: