lapis 是基於openresty 擴展的,因此直接將支持prometheus的模塊構建進openresty 就能夠了
我使用的是nginx-module-vts 模塊html
我已經構建好了支持的基礎鏡像,能夠直接配置便可,具體的能夠看下面的參考資料nginx
version: "3" services: api: build: ./ ports: - "8080:8080" volumes: - "./web:/web"
FROM dalongrong/lapis-1.7.0:metrics ENTRYPOINT [ "lapis","server" ]
FROM dalongrong/openresty-nginx-module-vts:fat RUN apk add openssl-dev WORKDIR /web RUN /usr/local/openresty/luajit/bin/luarocks install lapis
worker_processes ${{NUM_WORKERS}}; error_log stderr notice; daemon off; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; vhost_traffic_status_zone; server { listen ${{PORT}}; lua_code_cache ${{CODE_CACHE}}; vhost_traffic_status_filter_by_set_key $uri uris::$server_name; vhost_traffic_status_filter_by_host on; location / { vhost_traffic_status_bypass_limit on; default_type text/html; content_by_lua ' require("lapis").serve("app") '; } location /status { vhost_traffic_status_display; vhost_traffic_status_display_format html; } location /static/ { alias static/; } location /favicon.ico { alias static/favicon.ico; } } }
docker-compose up -d
https://github.com/rongfengliang/openresty-nginx-module-vts
https://github.com/rongfengliang/openresty_nginx-module-vts_prometheus_grafana
https://github.com/rongfengliang/lapis-dockergit