diff --git a/Makefile b/Makefile index 9258fb57..cc8520b6 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ INST_LIBDIR ?= $(INST_PREFIX)/lib64/lua/5.1 INST_LUADIR ?= $(INST_PREFIX)/share/lua/5.1 INST_BINDIR ?= /usr/bin INSTALL ?= install +UNAME ?= $(shell uname) .PHONY: default @@ -21,7 +22,11 @@ help: .PHONY: dev dev: ./utils/update_nginx_conf_dev.sh +ifeq ($(UNAME),Darwin) + luarocks install apisix-*.rockspec --tree=deps --only-deps +else sudo luarocks install apisix-*.rockspec --tree=deps --only-deps +endif ### check: Check Lua srouce code @@ -35,6 +40,13 @@ check: /tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1) +### init: Initialize the runtime environment +.PHONY: init +init: + ./bin/apisix init + ./bin/apisix init_etcd + + ### run: Start the apisix server .PHONY: run run: diff --git a/README.md b/README.md index 00741992..bca0338d 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,23 @@ apisix └── utils ``` +We can use more actions in the `make` command, for example: + +```shell +$ make help +Makefile rules: + + help: Show Makefile rules. + dev: Create a development ENV + check: Check Lua srouce code + init: Initialize the runtime environment + run: Start the apisix server + stop: Stop the apisix server + clean: Remove generated files + reload: Reload the apisix server + install: Install the apisix +``` + ## Quickstart 1. start server: diff --git a/README_CN.md b/README_CN.md index 87e78846..1f95936a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -132,6 +132,23 @@ apisix └── utils ``` +`make` 可以辅助我们完成更多其他功能, 比如: + +```shell +$ make help +Makefile rules: + + help: Show Makefile rules. + dev: Create a development ENV + check: Check Lua srouce code + init: Initialize the runtime environment + run: Start the apisix server + stop: Stop the apisix server + clean: Remove generated files + reload: Reload the apisix server + install: Install the apisix +``` + ## 快速上手 1. 启动 APISIX diff --git a/bin/apisix b/bin/apisix index a565e272..7a5e360f 100755 --- a/bin/apisix +++ b/bin/apisix @@ -1,4 +1,4 @@ -#! /usr/bin/lua +#!/usr/bin/env lua local script_path = debug.getinfo(1).source:sub(2) diff --git a/lua/apisix/plugins/node-status.lua b/lua/apisix/plugins/node-status.lua index a3e82794..e74d9c5b 100644 --- a/lua/apisix/plugins/node-status.lua +++ b/lua/apisix/plugins/node-status.lua @@ -33,7 +33,9 @@ end local function run_loop() - local res, err = core.http.request_self("/apisix/nginx_status") + local res, err = core.http.request_self("/apisix/nginx_status", { + keepalive = false, + }) if not res then if err then return core.log.error("failed to fetch nginx status: ", err)