Someone answered me in a private message and pointed out I must be running in a chroot.
This is indeed the issue. Removing the chroot global option fixes this. I'll see if I can find a way to keep running haproxy all the while running in a chroot. -Hugues On Mon, Dec 14, 2015 at 6:13 PM, Hugues Alary <[email protected]> wrote: > Hey there, > > I've been playing with haproxy 1.6.2 and the LUA feature and I'm running > into the following issue: > > I wrote a LUA script that loads an external library called "lua-requests". > > I installed luarocks, then installed lua-requests via luarocks. > > Now, my LUA scripts contains the following line: > > local requests = require("requests") > > But when I run HAProxy, I get the following error: > > [ALERT] 347/175818 (4914) : Lua function 'send_varnish_ban': runtime > error: /etc/haproxy/send_varnish_ban.lua:2: module 'requests' not found: > no field package.preload['requests'] > no file '/usr/local/share/lua/5.3/requests.lua' > no file '/usr/local/share/lua/5.3/requests/init.lua' > no file '/usr/local/lib/lua/5.3/requests.lua' > no file '/usr/local/lib/lua/5.3/requests/init.lua' > no file '/usr/share/lua/5.3/requests.lua' > no file '/usr/share/lua/5.3/requests/init.lua' > no file './requests.lua' > no file './requests/init.lua' > no file '/usr/local/lib/lua/5.3/requests.so' > no file '/usr/lib/x86_64-linux-gnu/lua/5.3/requests.so' > no file '/usr/lib/lua/5.3/requests.so' > no file '/usr/local/lib/lua/5.3/loadall.so' > no file './requests.so'. > > But, the file /usr/local/share/lua/5.3/requests.lua does exist (ls does > show me the file). I even copied/pasted it into my /etc/haproxy/ folder, > and HAProxy still can't find it. > > I tried changing the permissions of the file to 777 just to make sure this > wasn't the problem, still no luck. > > Typing require("requests.lua") in the LUA interactive interpreter works > perfectly. > > I added a print(package.path) in my HAProxy LUA script, and the value > seems correct: " > /usr/local/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?/init.lua;/usr/local/lib/lua/5.3/?.lua;/usr/local/lib/lua/5.3/?/init.lua;/usr/share/lua/5.3/?.lua;/usr/share/lua/5.3/?/init.lua;./?.lua;./?/init.lua > " > > I've been fiddling for the past few hours with no luck. > > Any idea why HAProxy can't seem to find a file that clearly exists? > > Thanks! > -Hugues >

