This method is exposed in the form of Gateway Aggregation in Microsoft's design pattern.
Use the gateway to aggregate multiple individual requests into a single request. This pattern is useful when the client needs to make multiple calls to different back-end systems in order to perform the operation.
In general, creating a service with a microservices architecture creates multiple connections between the application and the server. This makes connection information management and error handling complicated. Therefore, it is conceivable to put something like a reverse proxy in between so that it looks like one to the application. This is gateway aggregation.
This time, I used something called Kong, but Sentinel and Gloo are also famous.
kong https://hub.docker.com/_/kong
konga https://hub.docker.com/r/pantsel/konga/
What is konga? It's a Web UI for kong. The commercial version of kong has a WebUI, but it is not the OSS version. Therefore, we use OSS called konga to serve WebUI.
DockerCompose
docker-compose.yml
version: '2.1'
services:
kong:
image: kong
ports:
- 0.0.0.0:8000:8000
- 8443:8443
- 8001:8001
- 8444:8444
environment:
- "KONG_PROXY_ACCESS_LOG=/dev/stdout"
- "KONG_ADMIN_ACCESS_LOG=/dev/stdout"
- "KONG_PROXY_ERROR_LOG=/dev/stderr"
- "KONG_ADMIN_ERROR_LOG=/dev/stderr"
- "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl"
- "KONG_DATABASE=postgres"
- "KONG_PG_HOST=kong-db"
- "KONG_PG_USER=kong"
- "KONG_PG_PASSWORD=kong"
- "KONG_CASSANDRA_CONTACT_POINTS=kong-db"
depends_on:
- "kong-migrate"
restart: "on-failure:3"
kong-migrate:
image: kong
depends_on:
- "kong-db"
environment:
KONG_DATABASE: "postgres"
KONG_PG_HOST: "kong-db"
KONG_PG_USER: "kong"
KONG_PG_PASSWORD: "kong"
KONG_CASSANDRA_CONTACT_POINTS: "kong-db"
command: "kong migrations bootstrap"
restart: "on-failure:3"
kong-db:
image: "postgres:9.6"
environment:
POSTGRES_USER: "kong"
POSTGRES_PASSWORD: "kong"
POSTGRES_DB: "kong"
volumes:
- ./kong_data:/var/lib/postgresql/data
konga:
image: pantsel/konga
ports:
- 1337:1337
environment:
- "DB_ADAPTER=postgres"
- "DB_HOST=konga-db"
- "DB_USER=konga"
- "DB_PASSWORD=konga"
restart: "on-failure:3"
depends_on:
- konga-db
konga-db:
image: "postgres:9.6"
environment:
POSTGRES_USER: "konga"
POSTGRES_PASSWORD: "konga"
POSTGRES_DB: "konga"
volumes:
- ./konga_data:/var/lib/postgresql/data
Select from the CONNECTIONS pane on the left to create a CONNECTION.
At that time, enter http: // kong: 8001 /
in Kong Admin Url.
No SSL, as it is for easy local verification. The domain is kong
, not localhost.
Recommended Posts