kong安装 (postgres/kong/konga)

1. 下载需要的包

docker pull postgres:9.6

docker pull kong:latest

docker pull pantsel/konga:latest

2.

(1) 创建kong-net网络,所有kong相关都在此网络中

docker network create kong-net


创建kong-net网络

(2) 用docker创建postgres数据库

docker run -d --name kong-database \

--network=kong-net \

-p 5432:5432 \

-e "POSTGRES_USER=kong" \

-e "POSTGRES_DB=kong" \

-v /etc/localtime:/etc/localtime \

postgres:9.6

(3) 用docker执行kong的migrations,生成数据库表结构

docker run --rm \

--network=kong-net \

-e "KONG_DATABASE=postgres" \

-e "KONG_PG_HOST=kong-database" \

-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \


kong:latest kong migrations bootstrap


(4)启动kong

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 \

-v /etc/localtime:/etc/localtime \

kong:latest

(5) 启动konga(选项参考konga文档) https://github.com/pantsel/konga#installation

docker run -d --network kong-net -p 1337:1337 --name konga -e "NODE_ENV=production" -e "TOKEN_SECRET=123456789" -v /etc/localtime:/etc/localtime pantsel/konga:latest

(6) 启动的 docker kong 相关



参考:

开源API网关系统(Kong教程)入门到精通

https://www.jianshu.com/p/a68e45bcadb6

微服务与API 网关(上): 为什么需要API网关?

https://mp.weixin.qq.com/s?__biz=MzA5MzQ2NTY0OA==&mid=2650797020&idx=1&sn=48bb5a4e232a3680c8890ccb7e581b0a&chksm=88562e83bf21a7950cdac1680498d433a042f219568add78d8d45eb39c30f8a8a3f7588e39df&scene=21#wechat_redirect

Kong文档

https://docs.konghq.com/1.4.x/admin-api/

使用docker启动kong和kong-dashboard

https://blog.csdn.net/qf0129/article/details/93644705

docker安装kong

https://blog.csdn.net/laogouhuli/article/details/92766778

你可能感兴趣的:(kong安装 (postgres/kong/konga))