docker 安装 kong 网关
建立数据库
- 创建网络
1docker network create kong-net
- 建立数据库
1docker run -d --name kong-database \
2 --network=kong-net \
3 -p 5432:5432 \
4 -e "POSTGRES_USER=kong" \
5 -e "POSTGRES_DB=kong" \
6 -e "POSTGRES_PASSWORD=kong123" \
7 postgres:9.6
- 创建 kong 数据
1docker run --rm --network=kong-net \
2 -e "KONG_DATABASE=postgres" \
3 -e "KONG_PG_HOST=kong-database" \
4 -e "KONG_PG_PASSWORD=kong123" \
5 -e "KONG_PASSWORD=kong123" \
6 kong:latest kong migrations bootstrap
创建 kong
- 创建 kong gateway
1 docker run -d --name kong \
2 --network=kong-net \
3 -e "KONG_DATABASE=postgres" \
4 -e "KONG_PG_HOST=kong-database" \
5 -e "KONG_PG_USER=kong" \
6 -e "KONG_PG_PASSWORD=kong123" \
7 -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
8 -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
9 -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
10 -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
11 -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
12 -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
13 -p 8000:8000 \
14 -p 8443:8443 \
15 -p 127.0.0.1:8001:8001 \
16 -p 127.0.0.1:8444:8444 \
17 kong:latest
安装 konga
1docker pull pantsel/konga:latest
1docker run --rm pantsel/konga:latest \
2 -c prepare \
3 -a postgres \
4 -u postgresql://kong:kong123@172.18.0.1:5432/konga
1docker run -d -p 1337:1337 \
2 --network kong-net \
3 --name konga \
4 -e "NODE_ENV=production" \
5 -e "DB_ADAPTER=postgres" \
6 -e "DB_URI=postgresql://kong:kong123@172.18.0.1:5432/konga" \
7 pantsel/konga