One minute
安装Kong的Skywalking插件
Dockerfile:
FROM kong:latest
MAINTAINER chl <chalichen@21cn.com>
RUN export KONG_NGINX_HTTP_LUA_SHARED_DICT="tracing_buffer 128m"
RUN luarocks install kong-plugin-skywalking --local
ENV KONG_NGINX_HTTP_LUA_SHARED_DICT="tracing_buffer 128m"
kong-conf
plugins = bundled,skywalking
lua_package_path = ${user.home}/.luarocks/share/lua/5.1/?.lua;;
docker-compose.yml
version: "3.8"
services:
kong-database:
container_name: kong-database
image: postgres:9.6
restart: always
volumes:
- /opt/db-data:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
- TZ=CST-8
- POSTGRES_USER=kong
- POSTGRES_DB=kong
- POSTGRES_PASSWORD=kong
networks:
front:
ipv4_address: 172.20.83.102
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 5s
timeout: 5s
retries: 5
kong-migration:
image: kong:latest
command: "kong migrations bootstrap"
networks:
front:
ipv4_address: 172.20.83.103
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-database
- KONG_PG_DATABASE=kong
- KONG_PG_PASSWORD=kong
links:
- kong-database
depends_on:
- kong-database
kong1:
build: ./kong
# image: kong:latest
container_name: kong
volumes:
- /opt/kong-conf:/etc/kong/
ports:
- "8000:8000"
- "8443:8443"
- "8001:8001"
- "8444:8444"
networks:
front:
ipv4_address: 172.20.83.104
links:
- kong-database
depends_on:
consul1:
kong-database:
condition: service_healthy
environment:
TZ: CST-8
privileged: "true"
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_ADMIN_LISTEN: '0.0.0.0:8001'
# KONG_CASSANDRA_CONTACT_POINTS: kong-database
# KONG_DATABASE: postgres
# KONG_PG_DATABASE: kong
# KONG_PG_HOST: kong-database
KONG_PG_PASSWORD: kong
# KONG_PG_USER: kong
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
depends_on:
- kong-database
restart: on-failure
konga-prepare:
image: pantsel/konga:latest
command: "-c prepare -a postgres -u postgresql://kong:kong@kong-database:5432/konga"
networks:
front:
ipv4_address: 172.20.83.105
restart: on-failure
environment:
- TZ=CST-8
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-database
- KONG_PG_DATABASE=konga
- KONG_PG_PASSWORD=kong
links:
- kong-database
depends_on:
- kong-database
konga:
image: pantsel/konga:latest
container_name: konga
restart: always
networks:
front:
ipv4_address: 172.20.83.106
environment:
TZ: CST-8
DB_ADAPTER: postgres
DB_URI: postgresql://kong:kong@kong-database:5432/konga
NODE_ENV: production
links:
- kong-database
depends_on:
- kong1
- konga-prepare
ports:
- "1337:1337"
networks:
front:
external:
name: mac1
driver: macvlan
# driver_opts:
# com.docker.network.enable_ipv6: "true"
ipam:
driver: macvlan
config:
- subnet: 172.20.83.0/24
Read other posts