Writing Kong custom plugin

1,530 views
Skip to first unread message

Jim D

unread,
Jan 27, 2016, 2:50:05 PM1/27/16
to Kong
Hi. I am in Kong Docker image and I added my plugin (both directory and added it to yml) but I cannot  find how to compile it and run tests?
Tutorial says: sudo make test-plugins. But which dir? And can't find test-plugins
Any help would be good. Thanks

Kong does not see my plugin even though I added it to everywhere tutorial says. (I also restarted Kong) Do I need to recompile Kong?

Marco

unread,
Feb 3, 2016, 7:09:39 PM2/3/16
to Kong
After creating the plugin, execute "luarocks make *.rockspec" (where *.rockspec is the rockspec file), that will install it on the system. Only then it will be available from within Kong.

Jimmy Toan

unread,
Feb 28, 2016, 1:56:35 PM2/28/16
to Kong
Can  you give me the link or document more detail about it.
I run Kong in a docker container. How to create file rockspec (structure, content, template) and where to put it. 
I can't create new plugin with few guide on https://getkong.org/docs/0.7.x/plugin-development/
I found this guide http://streamdata.io/blog/developing-an-helloworld-kong-plugin/ but it is for old Kong version, and can not apply to docker container.  Where to put folder new plugin and lua file? How to compile it?

Please help me ASAP. Thank you so much.

Thijs Schreijer

unread,
Mar 1, 2016, 7:59:18 AM3/1/16
to Kong
Your problem is not Kong related. Kong uses regular Lua paths make sure you set them up properly (or install using LuaRocks).


Same for the rockspec, it's a LuaRocks file format.


Browse luarocks.org for some simple (Lua only) rockspec examples, like this one; https://luarocks.org/manifests/tieske/copas-2.0.1-1.rockspec
and then check the Kong rockspec to see how it installs its own plugins.

hth
Thijs

Op zondag 28 februari 2016 19:56:35 UTC+1 schreef Jimmy Toan:
Reply all
Reply to author
Forward
0 new messages