Skip to content

Axway amplify Unified Catalog integration with Kong Community edition

rathna-axway edited this page Feb 5, 2021 · 10 revisions

Axway amplify Unified Catalog integration with Kong Community edition

Step by step guide to setup and test Kong Community edition and Axway amplify

Install Kong via Docker

  • Create docker network
docker network create kong-net
  • Start Cassandra database
docker run -d --name kong-database \
               --network=kong-net \
               -p 9042:9042 \
               cassandra:3
  • Bootstrap Database
docker run --rm \
     --network=kong-net \
     -e "KONG_DATABASE=cassandra" \
     -e "KONG_PG_HOST=kong-database" \
     -e "KONG_PG_USER=kong" \
     -e "KONG_PG_PASSWORD=kong" \
     -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
     kong:latest kong migrations bootstrap
  • Start Kong
docker run -d --name kong \
     --network=kong-net \
     -e "KONG_DATABASE=cassandra" \
     -e "KONG_PG_HOST=kong-database" \
     -e "KONG_PG_USER=kong" \
     -e "KONG_PG_PASSWORD=kong" \
     -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
     -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 127.0.0.1:8001:8001 \
     -p 127.0.0.1:8444:8444 \
     kong:latest

Create a Service

curl -i -X POST \
  --url http://localhost:8001/services/ \
  --data 'name=petstore' \
  --data 'url=https://petstore.swagger.io' \
  --data 'tags=spec_local_petstore.json'

Create a Route

curl -i -X POST \
http://localhost:8001/services/petstore/routes \
--data 'paths[]=/petstore' \
--data name=petstore

Add key auth plugin to route

curl -i -X POST \
  --url http://localhost:8001/routes/petstore/plugins/ \
  --data 'name=key-auth'

Add ACL plugin to route

curl --location --request POST 'http://localhost:8001/routes/petstore/plugins' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "acl",
    "config": {
        "allow": [
            "amplify.group1"
        ]
    }
}'

Add http log plugin globally

curl -X POST http://localhost:8001/plugins/ \
--data "name=http-log" \
--data "config.http_endpoint=http://host.docker.internal:9000/requestlogs" \
--data "config.method=POST" \
--data "config.timeout=1000" \
--data "config.keepalive=1000" \
--data "config.flush_timeout=2" \
--data "config.retry_count=15"

Add additional parameter for tracing

curl -X POST http://localhost:8001/plugins/ \
--data "name=correlation-id" \
--data "config.header_name=Kong-Request-ID" \
--data "config.generator=uuid" \
--data "config.echo_downstream=false"

Build and start Kong traceability and discovery agent

$ make build-trace run-trace
  • Traceability agent creates service and catalog.
  • Subscribe to catalog API
    • It creates an application, apikey and assign appropriate acl
$ make build-disc run-disc

Test Route on Kong

curl --location --request GET 'http://localhost:8000/petstore/v2/store/inventory' \
--header 'apikey: 123456'

Test API Observer screen on amplify

Clone this wiki locally