2

We are trying to install community plugin Kong Service Virtualization. As I am completely new to kong, I am not able find any solution where detailed installation steps have been given like where and how to add that plugin, how to edit kong.conf etc. Can anyone help me with the issue. Thanks in advance.

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
DevSay
  • 886
  • 1
  • 14
  • 32

2 Answers2

3

you can install any plugin in kong using luarocks

For example here is one sample docker file

FROM kong
ENV LUA_PATH /usr/local/share/lua/5.1/?.lua;/usr/local/kong-oidc/?.lua;;
# For lua-cjson
ENV LUA_CPATH /usr/local/lib/lua/5.1/?.so;;

# Install unzip for luarocks, gcc for lua-cjson
RUN yum install -y unzip gcc 
RUN luarocks install luacov

here one example of oidc plugin : https://github.com/nokia/kong-oidc

we can install plugin using : luarocks install <plugin name>

build your own custom docker image and use kong image as base docker image.

here whole example working Dockerfile

FROM kong:latest  
USER root
RUN apk update && apk add git unzip luarocks
RUN luarocks install kong-oidc  
USER kong
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
1

Here is an example of the Dockerfile I use for install the kong-oidc plugin with dependencies:

FROM kong:2.0.2-alpine

USER root

ENV KONG_PLUGINS=bundled,oidc

# Add libs
ADD lib/resty/openidc.lua /usr/local/openresty/lualib/resty/openidc.lua

# Add oidc plugin
ADD plugins/oidc /usr/local/share/lua/5.1/kong/plugins/oidc

# Install dependencies
RUN luarocks install lua-resty-http
RUN luarocks install lua-resty-session
RUN luarocks install lua-resty-jwt 0.2.2

USER kong

I'm adding the oidc plugin from my source code instead luarocks because the repository is unmaintained, and you will need to update some dependencies to make it work.

If you need a functional example of Kong + OpenID + Keycloak, check this repository and this article.

Diego Rojas
  • 237
  • 5
  • 11