mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-02 12:07:35 +08:00
feature: added init
action in makefile to initialize the runtime (#205)
* feature: added `init` action in makefile to initialize the runtime environment. * doc: added more doc about `make` command. * CLI: find the Lua from default PATH. * bugfix: used short connection when to fetch node status.
This commit is contained in:
parent
764280f5ff
commit
565cb1653c
12
Makefile
12
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:
|
||||
|
17
README.md
17
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:
|
||||
|
17
README_CN.md
17
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
|
||||
|
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/lua
|
||||
#!/usr/bin/env lua
|
||||
|
||||
local script_path = debug.getinfo(1).source:sub(2)
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user