我正在编写一个lua脚本,它将使用它的Lua API在HAproxy中运行。
我的脚本使用的是socket包,我希望将其安装到我的机器上。
目前我在docker内部运行,我的dockerfile看起来像这样:
FROM haproxy:1.7
RUN apt-get update -y && apt-get install curl luarocks -y
RUN luarocks install luasocket
EXPOSE 80 9000
COPY 500error.json.http /etc/haproxy/errorfiles/
COPY hello_world.lua /etc/haproxy/scripts/我的脚本有下一行:
local http = require('socket.http')这在运行lua解释器时工作正常,但在运行haproxy时就不行了:
[ALERT] 298/104833 (8) : parsing [/usr/local/etc/haproxy/haproxy.cfg:5] : lua runtime error: /etc/haproxy/scripts/hello_world.lua:1: module 'socket.http' not found:我应该如何正确地将其加载到haproxy?
发布于 2017-11-06 02:48:04
您可以在请求package.cpath模块之前输出luasocket和luasocket值。
这个值是lua用来加载库的存储路径。
https://stackoverflow.com/questions/47124011
复制相似问题