openresty / lua-resty-core

New FFI-based API for lua-nginx-module
809 stars 273 forks source link

nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: module 'resty.core' not found: #452

Open Pranali4796 opened 10 months ago

Pranali4796 commented 10 months ago

we are trying to update our nginx from 1.20 to 1.24 or 1.25 with latest lua nginx. but facing issue in doing so .

Using the latest stable version https://github.com/openresty/lua-nginx-module/archive/refs/tags/v0.10.26rc1.tar.gz

I am using nginx : Nginx: https://nginx.org/packages/mainline/rhel/8/SRPMS/nginx-1.25.3-1.el8.ngx.src.rpm

Luajit: wget https://github.com/openresty/luajit2/archive/refs/tags/v2.1-20231117.tar.gz

Lua-nginx: https://github.com/openresty/lua-nginx-module/archive/refs/tags/v0.10.25.tar.gz

njs version: https://github.com/nginx/njs/archive/refs/tags/0.8.2.tar.gz

I am getting error nginx: [warn] lua_load_resty_core is deprecated (the lua-resty-core library is required since ngx_lua v0.10.16) in /etc/nginx/nginx.conf:58 2023/12/18 09:08:27 [warn] 1#1: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:43 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:43 2023/12/18 09:08:27 [warn] 1#1: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:44 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:44 2023/12/18 09:08:27 [warn] 1#1: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:836 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:836 2023/12/18 09:08:27 [warn] 1#1: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:837 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:837 2023/12/18 09:08:27 [warn] 1#1: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:1009 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:1009 2023/12/18 09:08:27 [warn] 1#1: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:1010 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:1010 2023/12/18 09:08:27 [warn] 1#1: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:1562 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:1562 2023/12/18 09:08:27 [warn] 1#1: the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:1563 nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /etc/nginx/conf.d/infra.conf:1563 2023/12/18 09:08:27 [alert] 1#1: failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: module 'resty.core' not found: no field package.preload['resty.core'] no file '/etc/nginx/webui/lua/callhome/resty/core.lua' no file '/etc/nginx/webui/lua/hostadmin-mfa/resty/core.lua' no file '/etc/nginx/webui/lua/common/resty/core.lua' no file '/etc/nginx/webui/lua/eca/resty/core.lua' no file '/etc/nginx/webui/lua/fips-compliance-check/resty/core.lua' no file '/etc/nginx/webui/lua/smtp/resty/core.lua' no file '/etc/nginx/webui/lua/smart-card/resty/core.lua' no file './resty/core.lua' no file '//share/luajit-2.1/resty/core.lua' no file '/usr/local/share/lua/5.1/resty/core.lua' no file '/usr/local/share/lua/5.1/resty/core/init.lua' no file '//share/lua/5.1/resty/core.lua' no file '//share/lua/5.1/resty/core/init.lua' no file './resty/core.so' no file '/usr/local/lib/lua/5.1/resty/core.so' no file '//lib/lua/5.1/res in /etc/nginx/nginx.conf:151 nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: module 'resty.core' not found: no field package.preload['resty.core'] no file '/etc/nginx/webui/lua/callhome/resty/core.lua' no file '/etc/nginx/webui/lua/hostadmin-mfa/resty/core.lua' no file '/etc/nginx/webui/lua/common/resty/core.lua' no file '/etc/nginx/webui/lua/eca/resty/core.lua' no file '/etc/nginx/webui/lua/fips-compliance-check/resty/core.lua' no file '/etc/nginx/webui/lua/smtp/resty/core.lua' no file '/etc/nginx/webui/lua/smart-card/resty/core.lua' no file './resty/core.lua' no file '//share/luajit-2.1/resty/core.lua' no file '/usr/local/share/lua/5.1/resty/core.lua' no file '/usr/local/share/lua/5.1/resty/core/init.lua' no file '//share/lua/5.1/resty/core.lua' no file '//share/lua/5.1/resty/core/init.lua' no file './resty/core.so' no file '/usr/local/lib/lua/5.1/resty/core.so' no file '//lib/lua/5.1/res in /etc/nginx/nginx.conf:151

From lines from error "nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: module 'resty.core' not found:" It is suggesting to use complete openresty package from https://openresty.org/en/download.html Can we just use resty.core module insted of whole package? If yes which version should i pick?

oowl commented 10 months ago

First, Openresty is a bundle of Nginx distribution, So I do not recommend building Nginx with lua-nginx-module to use the lua module, it can not guarantee all the functions of lua-nginx-module doc works fine due to Openresty bundle many patch and module to do some feature. You can see lua-nginx-module test CI bundles many repo codes to test all functions. https://github.com/openresty/lua-nginx-module/blob/master/.travis.yml#L81

Second, back to your issues, it's very clearly pointed out that the resty.core module can not be found. You need to clone lua-resty-core module to your lualib path location of the Nginx build prefix that will let luajit interrupt find the resty.core module.

Pranali4796 commented 10 months ago

Facing error: [root@a143b7d21bd5 nginx]# "/usr/sbin/nginx" "-e" "/dev/stderr" "-g" "daemon off;" 2023/12/22 05:55:47 [alert] 1702#1702: failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://opy.org/en/download.html (reason: /rusty/lua-resty-core-0.1.28rc1/lib/resty/core/regex.lua:14: module 'resty.lrucache' not found: no field package.preload['resty.lrucache'] no file '/rusty/lua-resty-core-0.1.28rc1/lib/resty/lrucache.lua' no file '/etc/nginx/webui/lua/callhome/resty/lrucache.lua' no file '/etc/nginx/webui/lua/hostadmin-mfa/resty/lrucache.lua' no file '/etc/nginx/webui/lua/common/resty/lrucache.lua' no file '/etc/nginx/webui/lua/eca/resty/lrucache.lua' no file '/etc/nginx/webui/lua/fips-compliance-check/resty/lrucache.lua' no file '/etc/nginx/webui/lua/smtp/resty/lrucache.lua' no file '/etc/nginx/webui/lua/smart-card/resty/lrucache.lua' no file './resty/lrucache.lua' no file '//share/luajit-2.1/resty/lrucache.lua' no file '/usr/local/share/lua/5.1/resty/lrucache.lua' no file '/usr/local/share/lua/5.1/resty/lrucache/init.lua' no file '// in /etc/nginx/nginx.conf:67 nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.reason: /rusty/lua-resty-core-0.1.28rc1/lib/resty/core/regex.lua:14: module 'resty.lrucache' not found: no field package.preload['resty.lrucache'] no file '/rusty/lua-resty-core-0.1.28rc1/lib/resty/lrucache.lua' no file '/etc/nginx/webui/lua/callhome/resty/lrucache.lua' no file '/etc/nginx/webui/lua/hostadmin-mfa/resty/lrucache.lua' no file '/etc/nginx/webui/lua/common/resty/lrucache.lua' no file '/etc/nginx/webui/lua/eca/resty/lrucache.lua' no file '/etc/nginx/webui/lua/fips-compliance-check/resty/lrucache.lua' no file '/etc/nginx/webui/lua/smtp/resty/lrucache.lua' no file '/etc/nginx/webui/lua/smart-card/resty/lrucache.lua' no file './resty/lrucache.lua' no file '//share/luajit-2.1/resty/lrucache.lua' no file '/usr/local/share/lua/5.1/resty/lrucache.lua' no file '/usr/local/share/lua/5.1/resty/lrucache/init.lua' no file '// in /etc/nginx/nginx.conf:67

lynch1981 commented 10 months ago

to solve this issue, you can install lua-resty-lurcache to /usr/local/share/lua/5.1

Just modify Makefile like this, and run make install

LUA_VERSION := 5.1
PREFIX ?=          /usr/local
LUA_INCLUDE_DIR ?= $(PREFIX)/include
LUA_LIB_DIR ?=     $(PREFIX)/share/lua/$(LUA_VERSION)
INSTALL ?= install

.PHONY: all test install lint

download v0.13.tar.gz

Pranali4796 commented 10 months ago

Hello @lynch1981 I added lua-resty-lurcache Still facing few config errors like [root@a143b7d21bd5 nginx]# "/usr/sbin/nginx" "-e" "/dev/stderr" "-g" "daemon off;" nginx: [emerg] open() "/var/lib/nginx/tmp/nginx.pid" failed (2: No such file or directory)

lynch1981 commented 10 months ago

You start nginx with root privileges, so it's not a permissions issue It looks like the path "/var/lib/nginx/tmp" does not exist