Skip to content

Kong Plugin Installation Guide

This guide provides instructions for installing the custom Kong plugin. For detailed information about other installation methods, please refer to the official Kong documentation.

Installation with Docker Compose

Prerequisites

  • Docker and Docker Compose installed
  • Kong plugin source code (provided as a zip file)

Steps

  1. Extract the plugin zip file to a local directory.

  2. Create or modify your docker-compose.yml:

services:
  kong-database:
    image: postgres:13
    container_name: kong-database
    environment:
      POSTGRES_USER: kong
      POSTGRES_DB: kong
      POSTGRES_PASSWORD: kongpass
    networks:
      - kong-net
    ports:
      - "5432:5432"

  kong-migrations:
    image: kong/kong-gateway:3.9.0.1
    container_name: kong-migrations
    depends_on:
      - kong-database
    environment:
      KONG_DATABASE: postgres
      KONG_PG_HOST: kong-database
      KONG_PG_USER: kong
      KONG_PG_PASSWORD: kongpass
    command: kong migrations bootstrap
    networks:
      - kong-net

  kong-gateway:
    image: kong/kong-gateway:3.9.0.1
    container_name: kong-gateway
    depends_on:
      - kong-database
      - kong-migrations
    ports:
      - "8000:8000"
      - "8443:8443"
      - "8001:8001"
      - "8444:8444"
      - "8002:8002"
      - "8445:8445"
      - "8003:8003"
      - "8004:8004"
    environment:
      KONG_DATABASE: postgres
      KONG_PG_HOST: kong-database
      KONG_PG_USER: kong
      KONG_PG_PASSWORD: kongpass
      KONG_PROXY_ACCESS_LOG: /dev/stdout
      KONG_LOG_LEVEL: debug
      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
      KONG_ADMIN_GUI_URL: http://localhost:8002
      # Plugin configuration
      KONG_LUA_PACKAGE_PATH: /tmp/custom_plugins/?.lua;;
      KONG_PLUGINS: bundled,kong-plugin-http-mirror
    volumes:
      # Mount your plugin directory
      - /path/to/extracted/plugin:/tmp/custom_plugins/kong/plugins/kong-plugin-http-mirror
    networks:
      - kong-net

networks:
  kong-net:
    driver: bridge

Important: Replace /path/to/extracted/plugin with the actual path where you extracted the plugin files on your host machine.

  1. Start Kong using Docker Compose:

    docker-compose up -d
    

  2. Enable the plugin by making a POST request:

    curl -X POST http://127.0.0.1:8001/plugins/ \
      --data "name=kong-plugin-http-mirror" \
      --data "config.mirror_request_body=false" \
      --data "config.mirror_endpoints=http://your-mirror-endpoint:port"
    

Verification

To verify the plugin installation:

  1. Check if the plugin appears in the list of available plugins:

    curl http://localhost:8001/plugins/available | grep kong-plugin-http-mirror
    

  2. Visit Kong Manager UI at http://localhost:8002 to confirm the plugin is listed in the plugins section.

Other Installation Methods

For instructions on installing the plugin in other environments: - Kubernetes deployment: Kong Kubernetes Documentation - Binary installation: Kong Binary Documentation