1. 程式人生 > >【學習】-【kong】搭建kong服務

【學習】-【kong】搭建kong服務

前置環境:

  • docker

拉取映象

  • docker pull postgres:9.4
  • docker pull kong:0.13.1-centos

run映象

  • 構建通訊網路
docker network create kong-net
  • 安裝資料庫
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.13.1-centos kong migrations up
  • 初始化資料庫
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.13.1-centos kong migrations up
  • 執行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 \
    kong:0.13.1-centos
  • 安裝kong-dashboad
  • docker run -d --name kong-dashboard -p 30092:8080 pgbi/kong-dashboard:v3.3.0 start --kong-url http://www.byrdmacip.com:8001 --basic-auth kxp=123456
  • 後續更新中