Docker-compose 部署kong + konga

首先确保系统安装了docker和docker-compose

然后新建docker-compose.yaml文件,编辑如下内容

 version: '2'
 networks:
   kong-net:
     driver: bridge
 services:
   kong-database:
     image: postgres:9.6
     container_name: kong-database
     restart: always
     networks:
       - kong-net
     environment:
       POSTGRES_USER: kong
       POSTGRES_DB: kong
       POSTGRES_PASSWORD: kong
     ports:
       - "5432:5432"
#kong数据库的初始化应用,执行一遍即可注释
   kong-migration:
      container_name: kong-migration
      image: kong:latest
      command: "kong migrations bootstrap"
      networks:
        - kong-net
      restart: on-failure
      environment:
        KONG_PG_HOST: kong-database
        KONG_DATABASE: postgres
        KONG_PG_USER: kong
        KONG_PG_PASSWORD: kong
        KONG_CASSANDRA_CONTACT_POINTS: kong-database
      links:
        - kong-database
      depends_on:
        - kong-database

    # 启动kong
   kong:
      container_name: kong
      image: kong:latest
      restart: always
      networks:
        - kong-net
      environment:
        TZ: Asia/Shanghai
        KONG_DATABASE: postgres
        KONG_PG_HOST: kong-database
        KONG_PG_USER: kong
        KONG_PG_PASSWORD: kong
        KONG_CASSANDRA_CONTACT_POINTS: kong-database
        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
      depends_on:
        - kong-migration
        - kong-database
      ports:
        - "8001:8001"
        - "8000:8000"
        - "8443:8443"
        - "8444:8444"
#konga数据库的初始化应用,执行一遍即可注释
   konga-prepare:
     container_name: konga-prepare
     image: pantsel/konga:latest
     command: "-c prepare -a postgres -u postgresql://kong:kong@kong-database:5432/konga"
     networks:
       - kong-net
     restart: on-failure
     links:
       - kong-database
     depends_on:
       - kong
       - kong-database
#启动kong,使用postgres数据库存储数据
   konga:
     container_name: konga
     image: pantsel/konga:latest
     restart: always
     networks:
       - kong-net
     environment:
       DB_ADAPTER: postgres
       DB_HOST: kong-database
       DB_USER: kong
       DB_DATABASE: konga
       DB_PASSWORD: kong
     depends_on:
       - kong
       - kong-database
     ports:
       - "1337:1337"

docker-compose启动容器

docker-compose -f docker-compose.yml up -d

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值