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

Manual install steps #50

Open
kminder opened this issue May 7, 2021 · 8 comments
Open

Manual install steps #50

kminder opened this issue May 7, 2021 · 8 comments

Comments

@kminder
Copy link

kminder commented May 7, 2021

I'm trying to add lua-resty-jwt to Kubernetes ingress-nginx. In their recent versions they have stopped using luarocks and are installing Lua modules manually.
See https://github.com/kubernetes/ingress-nginx/blob/master/images/nginx/rootfs/build.sh#L597
I've tried installing both lua-resty-jwt and lua-resty-hmac as shown below but it isn't working.

export LUA_RESTY_JWT_VERSION=0.2.3
export LUA_RESTY_HMAC_VERSION=0.05

get_src 35ae361abfdc1b7039df9ef9d0e0fe2b8a6e6e381ef99addde186f5fed6b2023 \
        "https://github.com/cdbattags/lua-resty-jwt/archive/refs/tags/v$LUA_RESTY_JWT_VERSION.tar.gz"

get_src a8bb37a5d272545d57fbd1a78be54cca5b96d6c1048e396b137bdacab575fc6a \
        "https://github.com/jkeys089/lua-resty-hmac/archive/refs/tags/v$LUA_RESTY_HMAC_VERSION.tar.gz"

cd "$BUILD_PATH/lua-resty-hmac-$LUA_RESTY_HMAC_VERSION"
make install

cd "$BUILD_PATH/lua-resty-jwt-$LUA_RESTY_JWT_VERSION"
install -d /usr/local/lib/lua/resty
install lib/resty/*.lua /usr/local/lib/lua/resty

When the /etc/nginx/conf.lua lines below execute...

local jwt = require "resty.jwt"
local jwt_obj = jwt:load_jwt(token)

I get this error...

2021/05/06 22:42:09 [error] 22#22: *40 lua entry thread aborted: runtime error: /etc/nginx/conf.lua:77: attempt to index local 'jwt' (a number value)

So are there any suggested instructions for installing lua-resty-jwt manually without luarocks?

@cdbattags
Copy link
Owner

So I compared against https://github.com/jkeys089/lua-resty-hmac/blob/master/Makefile and it looks to be that straightforward but I can add a PR to test the make in the workflow for builds.

Relevant files:

Feel free to attempt a PR to do the same if you don't want to wait on me!

@cdbattags
Copy link
Owner

cdbattags commented May 7, 2021

Do you have a link to your sample Dockerfile to test?

Maybe a minimal sample repo?

@cdbattags
Copy link
Owner

cdbattags commented May 7, 2021

Are you missing the LUA_VERSION perhaps in the install -d path?

@cdbattags
Copy link
Owner

Ah, looks like you need the module add:

https://github.com/jkeys089/lua-resty-hmac/blob/master/Makefile#L16

@kminder
Copy link
Author

kminder commented May 7, 2021

Unless I'm misunderstanding, the "missing"
$(INSTALL) resty_modules/lualib/resty/*.lua $(DESTDIR)$(LUA_LIB_DIR)/resty
seems unlikely to be related. I note that the repo https://github.com/jkeys089/lua-resty-hmac has no such resty_modules nor does https://github.com/jkeys089/lua-resty-hmac/archive/refs/tags/v0.05.tar.gz. Furthermore none of the other lua-resty-* modules I checked included this step. For example...
https://github.com/openresty/lua-resty-string/blob/master/Makefile#L12
https://github.com/ledgetech/lua-resty-http/blob/master/Makefile#L19

@kminder
Copy link
Author

kminder commented May 10, 2021

This may be something to unique 0.2.3. I reverted to 0.2.2 and I'm not hitting the same issue.

@Joelgullander
Copy link

Any chance this would be added soon?

@Joelgullander
Copy link

Also would like this as I am in the same situation with the ingress-nginx not supporting luarocks

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

3 participants