简体   繁体   中英

Running HAProxy with Lua Scripts

I am trying to build HAProxy-1.9 with USE_LUA=1 flag to enable lua support. This the make command I am using:

sudo make TARGET=linux USE_DL=1 USE_CRYPT_H=1 USE_LUA=1 LUA_LIB=/usr/bin/lua5.3 LUA_INC=/usr/include/lua5.3/ LUA_LIB_NAME=lua53

When I execute the make command I receive the following error:

  LD      haproxy
 /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: cannot find -llua53
 collect2: error: ld returned 1 exit status
 make: *** [Makefile:976: haproxy] Error 1

From what I have gathered it seems that a one of the library file (guessing a socket file) is either missing or, I have provided a wrong directory. I am using OpenSuse Tumbleweed .

EDIT 1

I was able to make haproxy from source by changing TARGET=linux to TARGET=generic . After the make file stopped, no errors were reported on stdout. However, haproxy.service was not installed.

I previously had haproxy installed using zypper . The only reason I removed it was to reinstall it with USE_LUA=1 flag because I was not sure whether it was possible to edit haproxy post compilation to change a compile time configuration.

After reinstalling, it is working. However, I believe there is an error with lua-load . When I try lua-load /usr/share/haproxy/auth-request.lua I get the following error from running journalctl -xe: error in lua file '/tmp/auth-request.lua': cannot open /tmp/auth-request.lua: Permission denied . The permission set on the file was haproxy:haproxy as in the haproxy.cfg file. I have tried also tried modifying user root group root in haproxy.cfg and chown /tmp/auth-request.lua root:root . The error is still there.

I may have deviated somewhat from the original question. I would appreciate it is still possible to solve this problem. If more information or context is required, it can be provided.

EDIT 2

Most recently I tried adding read and execute permissions for all users on /tmp/auth-request.lua . ls -l output:

-rwxr-xr-x 1 root root 3957 Feb 25 02:24 /tmp/auth-request.lua

Okay after some painstaking hours, I was able to fix the permission issue as per EDIT 2 in the post. I moved my Lua script to the haproxy config directory and that seemed to have worked. Although, I am not too sure whether /etc/haproxy is a good location to keep Lua scripts but, for now it has worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM