Kong is a natural micro-services gateway. Her official introduction is: Kong is a native cloud, efficient, scalable, distributed API gateway. Since 2015, after github open, wide attention, has been harvested 1.9w + of the star, its core value is high performance and scalability.
Kong to build the steps of:
First, create a docker network
docker network create kong-net
Second, install postgres database
kong support postgres9.5 above and Apache Cassandra database.
docker run -d --name kong-database \
--network=kong-net \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
postgres:9.6
Three, Kong database initialization
docker run --rm \
--network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
kong:0.14.1 kong migrations up
Fourth, start the test
docker run -d --name kong \
--network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-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 8001:8001 \
-p 8444:8444 \
kong:0.14.1
test,
curl -i http://localhost:8001
Five, docker running Kong Dashboard
Kong Dashboard interface or Konga is a good management tool, here we dashboard, for example.
1. Create and run the dashboard.
docker run -d \
--network=kong-net \
--link kong:kong -p 8008:8080 pgbi/kong-dashboard start \
--kong-url http://kong:8001 \
--basic-auth kong=kong
2, visit the administration section
Address: HTTP: // your_server_ip: 8008 , login name: kong, Password: kong
Six, docker run postgre admin
1, create and run postgre admin 4 containers.
docker run -d -p 8009:80 \
--network=kong-net \
--link kong-database:kong-database \
-e "[email protected]" \
-e "[email protected]" \
-d dpage/pgadmin4
2, visit the administration section
Address: HTTP: // your_server_ip: 8009 , login name: [email protected], Password: [email protected]