标签:aliyun efault work str contain 工具 调试 operator docke
lua-resty-repl 是一个方便的openresty 包,我们可以用来方便的调试openresty
以下是一个基于容器运行的一个试用
FROM openresty/openresty:alpine-fat
RUN /bin/sed -i ‘s,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g‘ /etc/apk/repositories
RUN apk update && apk add git
COPY --from=ochinchina/supervisord:latest /usr/local/bin/supervisord /usr/local/bin/supervisord
RUN /usr/local/openresty/luajit/bin/luarocks install lua-resty-repl
ENTRYPOINT [ "/usr/local/bin/supervisord" ]
version: "3"
services:
api:
build: ./
image: dalongrong/openresty:lua-resty-repl
volumes:
- "./nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf"
- "./supervisor.conf:/etc/supervisor.conf"
ports:
- "80:80"
- "9001:9001"
[inet_http_server]
port = :9001
master_process off;
worker_processes 1;
error_log stderr notice;
daemon off;
events {
worker_connections 1024;
}
?
http {
server {
listen 80;
lua_code_cache off;
include mime.types;
default_type application/octet-stream;
gzip on;
resolver 127.0.0.11 ipv6=off;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
location / {
content_by_lua_block {
require(‘resty.repl‘).start()
}
}
}
}
docker-compose build
docker-compose up -d
docker-compose exec api sh
openresty -c /usr/local/openresty/nginx/conf/nginx.conf
http://localhost/?username=dalong&age=333
ngx.req.get_uri_args()
效果
lua-resty-repl 是一个不错的openresty 调试工具,可以帮助我们调试一些问题,相比使用ngx.say 以及ngx.log 方便了好了很多
https://github.com/saks/lua-resty-repl
https://github.com/rongfengliang/lua-resty-repl-learning
标签:aliyun efault work str contain 工具 调试 operator docke
原文地址:https://www.cnblogs.com/rongfengliang/p/13083533.html