开启微服务-4-docker安装kong,konga

阅读次数: 816

  • A+
所属分类:建站

分3步骤

1.安装postgresSQL

2.安装kong

3.安装konga

1.安装postgresSQL

docker run -d --name kong-postgres\
              --network=kong-net \
               -v /usr/local/docker/pgsql/data:/var/lib/postgresql/data \
              -p 5432:5432 \
              -e "POSTGRES_USER=postgres" \
              -e "POSTGRES_PASSWORD=postgres" \
              -e "POSTGRES_DB=postgres" \
              postgres:9.6

a.进入pg

docker exec -it kong-postgres /bin/bash

b. 创建数据库账户 kong, 密码kong,数据库 kong

su postgres
psql
create user kong with password 'kong';
create database kong owner kong;

c.创建数据库账户 konga,密码konga 数据库 konga

create user konga with password 'konga';
create database konga owner konga;

d.退出

\q
exit //退出容器

2.kong安装

a.初始化数据库

docker run --rm \
         --network=kong-net \
         -e "KONG_DATABASE=postgres" \
         -e "KONG_PG_HOST=kong-postgres" \
         -e "KONG_PG_PORT=5432" \
         -e "KONG_PG_USER=kong" \
         -e "KONG_PG_PASSWORD=kong" \
         -e "KONG_PG_DATABASE=kong" \
         kong:latest kong migrations bootstrap

b.启动kong

docker run -d --name kong \
         --network=kong-net \
         -e "KONG_DATABASE=postgres" \
         -e "KONG_PG_HOST=kong-postgres" \
         -e "KONG_PG_PASSWORD=kong" \
         -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:latest

3.konga安装

a.拉取镜像

docker pull pantsel/konga:latest

b.初始化数据库

docker run --rm pantsel/konga:latest -c prepare -a postgres -u postgresql://konga:konga@172.18.0.2:5432/konga

c.运行konga

docker run -d -p 1337:1337 \
            --network=kong-net \
           -e "DB_ADAPTER=postgres" \
           -e "DB_HOST=172.18.0.2" \
           -e "DB_PORT=5432" \
           -e "DB_USER=konga" \
           -e "DB_PASSWORD=konga" \
           -e "DB_DATABASE=konga" \
           -e "DB_PG_SCHEMA=public"\
           -e "NODE_ENV=production" \
           --name konga \
           pantsel/konga

d.验证测试

http://ip:1337    创建账号密码

4.创建服务+创建路由

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: