Installing Kong in a custom folder with lua packages and dependencies

I’m trying to install Kong in a custom folder with lua packages and dependencies.
I use openresty to build https://github.com/Kong/kong-build-tools build-openresty.sh . Rewriting the paths from /usr/local to the desired ones (/data/kong).
Then Kong build build-kong.sh.
It turns out the folder with Kong, openresty, lib, share; path /data/kong

Run Kong and get error:
./kong start -c /data/kong/kong.conf ERROR: ./kong:9: module 'kong.cmd.init' not found: no field package.preload['kong.cmd.init'] no file './kong/cmd/init.lua' no file './kong/cmd/init/init.lua' no file '/data/kong/openresty/site/lualib/kong/cmd/init.ljbc' no file '/data/kong/openresty/site/lualib/kong/cmd/init/init.ljbc' no file '/data/kong/openresty/lualib/kong/cmd/init.ljbc' no file '/data/kong/openresty/lualib/kong/cmd/init/init.ljbc' no file '/data/kong/openresty/site/lualib/kong/cmd/init.lua' no file '/data/kong/openresty/site/lualib/kong/cmd/init/init.lua' no file '/data/kong/openresty/lualib/kong/cmd/init.lua' no file '/data/kong/openresty/lualib/kong/cmd/init/init.lua' no file './kong/cmd/init.lua' no file '/data/kong/openresty/luajit/share/luajit-2.1.0-beta3/kong/cmd/init.lua' no file '/usr/local/share/lua/5.1/kong/cmd/init.lua' no file '/usr/local/share/lua/5.1/kong/cmd/init/init.lua' no file '/data/kong/openresty/luajit/share/lua/5.1/kong/cmd/init.lua' no file '/data/kong/openresty/luajit/share/lua/5.1/kong/cmd/init/init.lua' no file '/data/kong/openresty/site/lualib/kong/cmd/init.so' no file '/data/kong/openresty/lualib/kong/cmd/init.so' no file '/data/kong/lib/lua/5.1/kong/cmd/init.so' no file '/data/kong/openresty/site/lualib/kong.so' no file '/data/kong/openresty/lualib/kong.so' no file '/data/kong/lib/lua/5.1/kong.so' stack traceback: ./kong:9: in function 'file_gen' init_worker_by_lua:48: in function <init_worker_by_lua:46> [C]: in function 'xpcall' init_worker_by_lua:55: in function <init_worker_by_lua:53>

If set global variable (ENV) LUA_PATH=UA_PATH="./?.lua;/data/kong/share/lua/5.1/?.lua;"
Run Kong and get error:
/data/kong/bin$ ./kong start -c /data/kong/kong.conf
2020/02/22 10:38:27 [warn] ulimit is currently set to "1024". For better performance set it to at least "4096" using "ulimit -n" Error: /data/kong/share/lua/5.1/kong/cmd/start.lua:64: nginx: [error] init_by_lua error: init_by_lua:2: module 'kong' not found: no field package.preload['kong'] no file '/data/kong/share/lua/5.1/kong.lua' no file '/data/kong/openresty/site/lualib/kong.ljbc' no file '/data/kong/openresty/site/lualib/kong/init.ljbc' no file '/data/kong/openresty/lualib/kong.ljbc' no file '/data/kong/openresty/lualib/kong/init.ljbc' no file '/data/kong/openresty/site/lualib/kong.lua' no file '/data/kong/openresty/site/lualib/kong/init.lua' no file '/data/kong/openresty/lualib/kong.lua' no file '/data/kong/openresty/lualib/kong/init.lua' no file '/data/kong/share/lua/5.1/kong.lua' no file '/data/kong/openresty/site/lualib/kong.so' no file '/data/kong/openresty/lualib/kong.so' no file '/data/kong/lib/lua/5.1/kong.so' stack traceback: [C]: in function 'require' init_by_lua:2: in main chunk

I tried LUA_CPATH, LUA_PACKAGE_PATH, LUA_PACKAGE_СPATH, but did not help

  • Kong version 2.0.1
  • openresty 1.15.8.2
  • openssl 1.1.1d
  • pcre 8.43

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ