“网关服务kong基础”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
→‎ins
→‎ins
 
第1行: 第1行:
 +
[[category:devops]]
 
=ins=
 
=ins=
  
第99行: 第100行:
  
 
</pre>
 
</pre>
 +
 
=references=
 
=references=
 
[https://www.cnblogs.com/xuwujing/p/15182016.html  网关服务Kong和konga介绍安装使用教程]
 
[https://www.cnblogs.com/xuwujing/p/15182016.html  网关服务Kong和konga介绍安装使用教程]

2024年9月23日 (一) 02:08的最新版本

ins

cat docker-compose.yml 
version: '3'
services: 
  kong-database:
    image: postgres:9.6
    restart: always  #每次总是启动
    networks: 
      - kong-net
    environment:
      POSTGRES_USER: kong
      POSTGRES_DB: kong
      POSTGRES_PASSWORD: kong
    ports:
      - "5432:5432"
#######################
# 执行数据库迁移
######################
  kong-migration:
    image: kong:latest
    command: "kong migrations bootstrap"
    networks: 
      - kong-net
    restart: on-failure
    environment:
      - KONG_DATABASE=postgres
      - KONG_PG_DATABASE=kong
      - KONG_PG_PASSWORD=kong
      - KONG_PG_HOST=kong-database
    links: 
      - kong-database #连接的是kong-database服务的
    depends_on:
      - kong-database #依赖于kong-database服务

#####################
# kong gateway
#####################
  kong:
    image: kong:latest
    restart: always
    networks:
      - kong-net
    environment:
      KONG_DATABASE: postgres
      KONG_PG_HOST: kong-database
      KONG_PG_PASSWORD: kong
      KONG_PROXY_LISTEN: 0.0.0.0:8000
      KONG_PROXY_LISTEN_SSL: 0.0.0.0:8443
      KONG_ADMIN_LISTEN: 0.0.0.0:8001
    depends_on:
      - kong-migration
    links: 
      - kong-database
    healthcheck:
      test: ["CMD", "curl", "-f", "http://kong:8001"]
      interval: 5s
      timeout: 2s
      retries: 15
    ports:
      - "8001:8001"
      - "8000:8000"
      - "8443:8443"
#######################
#以下两个是konga  GUI
#######################
  konga-prepare:
    image: registry.cn-hangzhou.aliyuncs.com/evan886/my_k8s_containers:konga-2024
    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服务
      - kong-database #依赖kong-database服务

  konga:
    image: registry.cn-hangzhou.aliyuncs.com/evan886/my_k8s_containers:konga-2024
    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"
networks:
  kong-net:
    driver: bridge

references

网关服务Kong和konga介绍安装使用教程