Kong / kong

🦍 The Cloud-Native API Gateway and AI Gateway.
https://konghq.com/install/#kong-community
Apache License 2.0
38.78k stars 4.77k forks source link

can not find myplugin by http://kong:8001/ #4867

Closed chenyanter closed 5 years ago

chenyanter commented 5 years ago

Summary

i write a plugin, and install follow https://docs.konghq.com/1.1.x/plugin-development/distribution/#load-the-plugin Manually i can find load myplugin when kong startup but i can't find myplugin by api http://kong:8001/

Dockerfile

FROM kong:1.2 RUN apk update && apk upgrade && \ apk add --no-cache bash git openssh RUN mkdir /plugins && \ cd /plugins && \ git clone http://git.myserver.com/devops/kong-plugin-myplugin.git && \ cp /etc/kong/kong.conf.default /etc/kong/kong.conf && \ sed -i 's/#plugins = bundled/plugins = bundled,myplugin/g' /etc/kong/kong.conf && \ sed -i 's/#lua_package_path = /lua_package_path = \/plugins\/kong-plugin-myplugin\/?.lua;/g' /etc/kong/kong.conf && \ sed -i 's/init.lua; /init.lua;;/g' /etc/kong/kong.conf

Additional Details & Logs

james-callahan commented 5 years ago

Try:

curl http://kong:8001/

http://kong:8001/plugins is the list of configured plugins.

chenyanter commented 5 years ago

@james-callahan Thanks for fast reply this is my issues description error,i update the description curl http://kong:8001/ can not find myplugin also image

chenyanter commented 5 years ago

some code in kong/kong/init.lua i can find myplugin in config `

singletons.configuration = config

`

some code in kong/kong/conf_loader.lua `

do -- merge plugins local plugins = {}

if #conf.plugins > 0 and conf.plugins[1] ~= "off" then
  for i = 1, #conf.plugins do
    local plugin_name = pl_stringx.strip(conf.plugins[i])
    if plugin_name ~= "off" then
      if plugin_name == "bundled" then
        plugins = tablex.merge(constants.BUNDLED_PLUGINS, plugins, true)

      else
        plugins[plugin_name] = true
      end
    end
  end
end

conf.loaded_plugins = setmetatable(plugins, _nop_tostring_mt)

end

` conf.loaded_plugins = setmetatable(plugins, _nop_tostring_mt) myplugin lost after this line, i read _nop_tostring_mt comment, but can‘t understand why i can‘t find myplugin with kong http://kong:8001/

chenyanter commented 5 years ago

so sorry, this is my program, close it