diff --git a/Makefile b/Makefile index df636a08e842..8458c71b8ff7 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ dev: ifeq ($(UNAME),Darwin) luarocks install --lua-dir=$(LUA_JIT_DIR) rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local else ifneq ($(LUAROCKS_VER),'luarocks 3.') - WITHOUT_DASHBOARD=1 luarocks install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local + luarocks install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local else luarocks install --lua-dir=/usr/local/openresty/luajit rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local endif diff --git a/README.md b/README.md index ffe8d34adc08..995d474fca18 100644 --- a/README.md +++ b/README.md @@ -114,13 +114,13 @@ We recommend that you use [luarocks](https://luarocks.org/) to install APISIX, a APISIX is installed by running the following commands in your terminal. -> via curl +> Gets the master branch via curl ```shell sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/iresty/apisix/master/utils/install-apisix.sh)" ``` -> Manual inspection +> Gets the master branch with manual inspection It's a good idea to inspect the installation script from projects you don't know yet. You can do that by downloading the installation script first, looking through it so everything looks normal, then running it: @@ -129,7 +129,17 @@ curl -Lo install.sh https://raw.githubusercontent.com/iresty/apisix/master/utils sudo sh install.sh ``` -> installation complete +> Gets the specified version via Luarock: + +```shell +# install apisix with version v0.8 +sudo luarocks install --lua-dir=/path/openresty/luajit apisix 0.8 + +# old luarocks may not support `lua-dir`, we can remove option `lua-dir` +sudo luarocks install apisix 0.8 +``` + +> Installation complete If all goes well, you will see the message like this: diff --git a/README_CN.md b/README_CN.md index 0b1a56473172..d56caafebcfe 100644 --- a/README_CN.md +++ b/README_CN.md @@ -112,13 +112,13 @@ APISIX 是基于 [openresty](http://openresty.org/) 之上构建的, 配置数 在终端中执行下面命令完成 APISIX 的安装: -> 通过 curl +> 通过 curl 安装 master 分支 ```shell sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/iresty/apisix/master/utils/install-apisix.sh)" ``` -> 人工检查 +> 人工检查安装 master 分支 对你不熟悉项目的安装脚本做检查,是个非常好的习惯。可以先下载这个脚本,确保他都是正常脚本,然后运行: @@ -127,6 +127,16 @@ curl -Lo install.sh https://raw.githubusercontent.com/iresty/apisix/master/utils sudo sh install.sh ``` +> 通过 Luarocks 安装指定的版本: + +```shell +# 安装 apisix 的 0.8 版本 +sudo luarocks install --lua-dir=/path/openresty/luajit apisix 0.8 + +# 老版本 luarocks 可能不支持 `lua-dir` 参数,可以删除该选项 +sudo luarocks install apisix 0.8 +``` + > 安装完成 ``` diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md index e9b0ecf36038..32144d13ae3c 100644 --- a/doc/install-dependencies.md +++ b/doc/install-dependencies.md @@ -1,11 +1,31 @@ # Install Dependencies +* [CentOS 6](#centos-6) * [CentOS 7](#centos-7) * [Ubuntu 16.04 & 18.04](#ubuntu-1604--1804) * [Debian 9 & 10](#debian-9--10) -* [CentOS 6](#centos-6) * [Mac OSX](#mac-osx) +CentOS 6 +======== + +```shell +# add openresty source +sudo yum install yum-utils +sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo + +# install openresty, etcd and some compilation tools +sudo yum install -y openresty curl git gcc luarocks lua-devel make + +wget https://github.com/etcd-io/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz +tar -xvf etcd-v3.3.13-linux-amd64.tar.gz && \ + cd etcd-v3.3.13-linux-amd64 && \ + sudo cp -a etcd etcdctl /usr/bin/ + +# start etcd server +nohup etcd & +``` + CentOS 7 ======== @@ -19,8 +39,7 @@ sudo yum install yum-utils sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo # install openresty, etcd and some compilation tools -sudo yum install -y etcd openresty curl git automake autoconf \ - gcc pcre-devel libtool gcc-c++ luarocks lua-devel +sudo yum install -y etcd openresty curl git gcc luarocks lua-devel # start etcd server sudo service etcd start @@ -37,9 +56,7 @@ sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_releas sudo apt-get update # install openresty, etcd and some compilation tools -sudo apt-get install -y git etcd openresty curl luarocks\ - check libpcre3 libpcre3-dev libjemalloc-dev \ - libjemalloc1 build-essential libtool automake autoconf pkg-config +sudo apt-get install -y git etcd openresty curl luarocks # start etcd server sudo service etcd start @@ -54,6 +71,7 @@ sed -i 's|^deb http://deb.debian.org/debian|deb http://mirrors.huaweicloud.com/d sed -i 's|^deb http://security.debian.org/debian-security|deb http://mirrors.huaweicloud.com/debian-security|g' /etc/apt/sources.list apt update apt install wget gnupg -y + # add openresty source wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add - sudo apt-get -y install software-properties-common @@ -67,41 +85,18 @@ tar -xvf etcd-v3.3.13-linux-amd64.tar.gz && \ sudo cp -a etcd etcdctl /usr/bin/ # install openresty and some compilation tools - -sudo apt-get install -y git openresty curl \ - check libpcre3 libpcre3-dev libjemalloc-dev \ - build-essential libtool automake autoconf pkg-config - -# install luarocks -# (the version must > 3.0, --lua-dir was first introduced in the luarocks 3.0 release) - -wget https://luarocks.org/releases/luarocks-3.1.3.tar.gz -tar zxpf luarocks-3.1.3.tar.gz -cd luarocks-3.1.3 - -* Run `./configure --with-lua=/usr/local/openresty/luajit/`. (This will attempt to detect your installation of Lua. If you get any error messages, see the section "Customizing your settings", below.) -* Run `make build`. -* As superuser, run `make install`. -ln -s /usr/local/bin/luarocks /usr/bin/luarocks - +sudo apt-get install -y git openresty curl luarocks make # start etcd server nohup etcd & ``` -CentOS 6 -======== - -TODO - -Failed to compile `rapidjson`, but the CentOS 6 comes with a lower version, will support CentOS 6 later. - Mac OSX ======= ```shell # install openresty, etcd and some compilation tools -brew install autoconf automake check pkg-config pcre libtool openresty/brew/openresty etcd luarocks +brew install openresty/brew/openresty etcd luarocks curl git # start etcd server with v2 protocol etcd --enable-v2=true & diff --git a/t/plugin/node-status.t b/t/plugin/node-status.t index 8e8869fce870..d7a602e6204b 100644 --- a/t/plugin/node-status.t +++ b/t/plugin/node-status.t @@ -11,8 +11,21 @@ run_tests; __DATA__ === TEST 1: sanity +--- config +location /t { + content_by_lua_block { + ngx.sleep(0.5) + local t = require("lib.test_admin").test + local code, body, body_org = t('/apisix/status', ngx.HTTP_GET) + + if code >= 300 then + ngx.status = code + end + ngx.say(body_org) + } +} --- request -GET /apisix/status +GET /t --- response_body eval qr/"accepted":/ --- no_error_log diff --git a/utils/install-apisix.sh b/utils/install-apisix.sh index c66e818aec90..36fbc71c9701 100755 --- a/utils/install-apisix.sh +++ b/utils/install-apisix.sh @@ -4,6 +4,7 @@ set -ex OR_EXEC=`which openresty 2>&1` echo $OR_EXEC +APISIX_VER="https://raw.githubusercontent.com/iresty/apisix/master/rockspec/apisix-master-0.rockspec" # check the openresty exist CHECK_OR_EXIST=`echo $OR_EXEC | grep ": no openresty" | wc -l` @@ -25,13 +26,13 @@ echo $UNAME do_install() { if [ "$UNAME" == "Darwin" ]; then - luarocks install --lua-dir=$LUA_JIT_DIR apisix --tree=/usr/local/apisix/deps --local + luarocks install --lua-dir=$LUA_JIT_DIR $APISIX_VER --tree=/usr/local/apisix/deps --local elif [ "$LUAROCKS_VER" == 'luarocks 3.' ]; then - luarocks install --lua-dir=$LUA_JIT_DIR apisix --tree=/usr/local/apisix/deps --local + luarocks install --lua-dir=$LUA_JIT_DIR $APISIX_VER --tree=/usr/local/apisix/deps --local else - luarocks install apisix --tree=/usr/local/apisix/deps --local + luarocks install $APISIX_VER --tree=/usr/local/apisix/deps --local fi sudo rm -f /usr/local/bin/apisix