Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create custom-plugin on Docker container #24

Closed
francisco-andrade opened this issue Feb 23, 2016 · 3 comments
Closed

Cannot create custom-plugin on Docker container #24

francisco-andrade opened this issue Feb 23, 2016 · 3 comments

Comments

@francisco-andrade
Copy link

Hi there,

I'm looking around on how to create custom-plugin, but as far as I understood, I'll have to build the kong source to include my custom plugin.
Since this container always download the rpm file, I cannot compile my plugin's source.

I'm following the steps on this tutorial: http://streamdata.io/blog/developing-an-helloworld-kong-plugin/

If I misunderstood something, please help me.

Thanks!
Francisco Andrade

@Tieske
Copy link
Member

Tieske commented Feb 23, 2016

Plugins are just Lua code files (source code). You just need to place them in your Lua path such that Kong can find them.

When developing your plugin on the other hand, you probably do want to setup the kong dev environment to be able to quicker iterate over changes and bug fixes you make.

@Tieske
Copy link
Member

Tieske commented Feb 23, 2016

just noticed this is Docker related, which probably means that before starting a container you need to copy the files in, and modify the configuration to include your custom plugin. Dunno how one would do that with Docker.

@francisco-andrade
Copy link
Author

Thanks for the help Tieske :)

I was able to create custom-plugins changing somethings at the repository before building the image.

I copied the kong-${KONG_VERSION}-0.rockspec file from /usr/local/lib/luarocks/rocks/kong/${KONG_VERSION}-0/kong-${KONG_VERSION}-0.rockspec and added these lines inside the modules param:

["kong.plugins.my-plugin.handler"] = "kong/plugins/my-plugin/handler.lua",
["kong.plugins.my-plugin.access"] = "kong/plugins/my-plugin/access.lua",
["kong.plugins.my-plugin.schema"] = "kong/plugins/my-plugin/schema.lua",

At kong.yml I added the lines:

custom_plugins:

  • my-plugin

I created the directory custom-plugins with the plugin access.lua, handler.lua and schema.lua files. And added these two lines into the Dockerfile:

COPY custom-plugins/my-plugin/* /usr/local/share/lua/5.1/kong/plugins/my-plugin/
COPY kong-${KONG_VERSION}-0.rockspec /usr/local/lib/luarocks/rocks/kong/${KONG_VERSION}-0/kong-${KONG_VERSION}-0.rockspec

@francisco-andrade francisco-andrade changed the title Cannot create custom-plugin Cannot create custom-plugin on Docker container Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants