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?
Check these resources out:
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
you need to install the lua-package manager luarocks