Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kong - custom plugins returning: custom-plugin plugin is enabled but not installed;

I have an instance of Kong that I am running using Dockerfile with contents:

FROM kong:1.4.0

WORKDIR /files
COPY plugins kong/plugins
ENV KONG_LOG_LEVEL=debug
ENV KONG_PLUGINS custom-plugin
ENV KONG_LUA_PACKAGE_PATH /files/?.lua;;

However, on docker run, this returns

error loading plugin schemas: on plugin 'custom-plugin': custom-plugin plugin is enabled but not installed;

module 'kong.plugins.custom-plugin.handler' not found:No LuaRocks module found for kong.plugins.custom-plugin

I have confirmed that the files are in the correct structure, nested within the kong/plugins directory at runtime.

Can anyone help with solving this issue?

like image 956
fuzzi Avatar asked Dec 02 '25 03:12

fuzzi


1 Answers

Check these resources out:

  • https://github.com/luarocks/luarocks/wiki/installation-instructions-for-unix

  • https://luarocks.org/

  • https://luarocks.org/modules/seifchen/kong-path-whitelist

  • https://github.com/Kong/kong/issues/4696

Bug Report from Kong: https://github.com/Kong/kong/issues/4696

I don't think it's the luarocks' problem
Indeed, I installed kong in docker whose image is built by a dockerfile.
In my docker file, I went into the folder which store the custom plugins,and then traverse and luarocks make them by shell.It looks like:

#install private plugins
cd APIGPlugins

for dir in `ls`; do
    if [ -d $dir ]; then
      cd $dir;
      luarocks make;
      cd ../;
    fi
done
and then, I run the docker images for a container by the directive:

sudo docker run -d --name kong \
    -e "KONG_DATABASE=off" \
    -e "KONG_DECLARATIVE_CONFIG=/etc/kong/kong.yml" \
    -e "KONG_PLUGINS=apig-response-transform" \
    -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
    -p 8000:8000 \
    -p 8443:8443 \
    -p 8001:8001 \
    -p 8444:8444 \
    kong-plugin:v4
As u see, I set the kong plugin by the docker run env variable parameter for enable the plugin instead of setting in the kong.conf.
The logs were generated by directive of docker logs "container ID"
It works when I tried to install another custom plugin in this way,but not work when install the custom plugin I described before

Update

you need to install the lua-package manager luarocks

  • Documentaton Link

  • Download Link

like image 72
Dean Van Greunen Avatar answered Dec 05 '25 16:12

Dean Van Greunen