version: '3'
services:
  kong:
    image: kong:2.2.1-ubuntu
    container_name: kong
    restart: always
    privileged: true

    environment:
      KONG_ADMIN_LISTEN: '0.0.0.0:8001'
      KONG_DATABASE: postgres
      KONG_PG_DATABASE: kong
      KONG_PG_HOST: kong-database
      KONG_PG_USER: kong_postgres_user
      KONG_PG_PASSWORD: kong_postgres_password
      KONG_ADMIN_ERROR_LOG: /dev/stderr
      KONG_ADMIN_ACCESS_LOG: /dev/stdout
      KONG_PROXY_ACCESS_LOG: /dev/stdout
      KONG_PROXY_ERROR_LOG: /dev/stderr

    depends_on:
      - kong-database

    ports:
      - "9000:8000"
      - "9001:8001"
      - "9443:8443"
      - "9444:8444"

  kong-database:
    image: postgres:9.6
    container_name: kong-database
    restart: always
    privileged: true

    environment:
      POSTGRES_DB: kong
      POSTGRES_USER: kong_postgres_user
      POSTGRES_PASSWORD: kong_postgres_password

    ports:
      - "9002:5432"

    volumes:
      - /data/kong/data/postgresql:/var/lib/postgresql/data

  konga:
    image: pantsel/konga:0.14.9
    container_name: konga
    restart: always
    privileged: true

    environment:
      DB_ADAPTER: postgres
      DB_HOST: kong-database
      DB_DATABASE: konga
      DB_USER: kong_postgres_user
      DB_PASSWORD: kong_postgres_password
      NODE_ENV: production

    depends_on:
      - kong
      - kong-database

    ports:
      - "9003:1337"

数据库初始化脚本init_db.sh

docker run -it --rm \
    --link kong-database:kong-database \
    --network kong_default \
    -e "KONG_DATABASE=postgres" \
    -e "KONG_PG_DATABASE=kong" \
    -e "KONG_PG_HOST=kong-database" \
    -e "KONG_PG_USER=kong_postgres_user" \
    -e "KONG_PG_PASSWORD=kong_postgres_password" \
    kong:2.2.1-ubuntu kong migrations bootstrap --v


docker run -it --rm \
    pantsel/konga:0.14.9 \
    -c prepare \
    -a postgres \
    -u postgresql://kong_postgres_user:kong_postgres_password@172.17.0.1:9002/konga

步骤:

  1. docker-compose up -d
  2. sh init_db.sh
  3. docker-compose down;docker-compose up -d
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐