Chef-server redindex error(module cjson not found)


#1

ohai guys,

Im seeing some weirdness with chef-server(12.0.8) when trying to run chef-server-ctl reindex and was hoping you could help me out.

The chef-server is pointed to an external solr DB. However, when running the reindex cmd, I seem to get the following error.

Any thoughts? thanks!

2016/11/18 14:48:31 [error] 17936#0: *49072129 lua entry thread aborted: runtime error: /var/opt/opscode/nginx/etc/scripts/dispatch_route.lua:2: module 'cjson' not found:
no field package.preload['cjson']
no file '/var/opt/opscode/nginx/etc/scripts/cjson.lua'
no file '/usr/local/nginx-1.8.0//cjson.lua'
no file './cjson.lua'
no file '/usr/local/lj2.0.4/share/luajit-2.0.4/cjson.lua'
no file '/usr/local/share/lua/5.1/cjson.lua'
no file '/usr/local/share/lua/5.1/cjson/init.lua'
no file '/usr/local/lj2.0.4/share/lua/5.1/cjson.lua'
no file '/usr/local/lj2.0.4/share/lua/5.1/cjson/init.lua'
no file './cjson.so'
no file '/usr/local/lib/lua/5.1/cjson.so'
no file '/usr/local/lj2.0.4/lib/lua/5.1/cjson.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
coroutine 0:
[C]: in function 'require'
/var/opt/opscode/nginx/etc/scripts/dispatch_route.lua:2: in function </var/opt/opscode/nginx/etc/scripts/dispatch_route.lua:1>, client: 127.0.0.1, server: <REDACTED>, request: "GET /_route/organizations/myorg HTTP/1.1", host: "127.0.0.1"

#2

Got this sorted out.

After doing some digging, I found a C version of the module located at /opt/opscode/embedded/lualib/cjson.so. However, the Nginx config didn’t have the path defined. So, I added the following line to /var/opt/opscode/nginx/etc/nginx.conf and was able to successfully reindex.

lua_package_cpath “/opt/opscode/embedded/lualib/?.so;;”;