Skip to content

Commit d6c4407

Browse files
membphismoonming
authored andcommitted
doc: make installation steps clear and remove useless dependency installations (#729)
1 parent 7d4a193 commit d6c4407

File tree

6 files changed

+70
-41
lines changed

6 files changed

+70
-41
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dev:
2828
ifeq ($(UNAME),Darwin)
2929
luarocks install --lua-dir=$(LUA_JIT_DIR) rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
3030
else ifneq ($(LUAROCKS_VER),'luarocks 3.')
31-
WITHOUT_DASHBOARD=1 luarocks install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
31+
luarocks install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
3232
else
3333
luarocks install --lua-dir=/usr/local/openresty/luajit rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
3434
endif

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ We recommend that you use [luarocks](https://luarocks.org/) to install APISIX, a
113113

114114
APISIX is installed by running the following commands in your terminal.
115115

116-
> via curl
116+
> Gets the master branch via curl
117117
118118
```shell
119119
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/iresty/apisix/master/utils/install-apisix.sh)"
120120
```
121121

122-
> Manual inspection
122+
> Gets the master branch with manual inspection
123123
124124
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:
125125

@@ -128,7 +128,17 @@ curl -Lo install.sh https://raw.githubusercontent.com/iresty/apisix/master/utils
128128
sudo sh install.sh
129129
```
130130

131-
> installation complete
131+
> Gets the specified version via Luarock:
132+
133+
```shell
134+
# install apisix with version v0.8
135+
sudo luarocks install --lua-dir=/path/openresty/luajit apisix 0.8
136+
137+
# old luarocks may not support `lua-dir`, we can remove option `lua-dir`
138+
sudo luarocks install apisix 0.8
139+
```
140+
141+
> Installation complete
132142
133143
If all goes well, you will see the message like this:
134144

README_CN.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ APISIX 是基于 [openresty](http://openresty.org/) 之上构建的, 配置数
112112

113113
在终端中执行下面命令完成 APISIX 的安装:
114114

115-
> 通过 curl
115+
> 通过 curl 安装 master 分支
116116
117117
```shell
118118
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/iresty/apisix/master/utils/install-apisix.sh)"
119119
```
120120

121-
> 人工检查
121+
> 人工检查安装 master 分支
122122
123123
对你不熟悉项目的安装脚本做检查,是个非常好的习惯。可以先下载这个脚本,确保他都是正常脚本,然后运行:
124124

@@ -127,6 +127,16 @@ curl -Lo install.sh https://raw.githubusercontent.com/iresty/apisix/master/utils
127127
sudo sh install.sh
128128
```
129129

130+
> 通过 Luarocks 安装指定的版本:
131+
132+
```shell
133+
# 安装 apisix 的 0.8 版本
134+
sudo luarocks install --lua-dir=/path/openresty/luajit apisix 0.8
135+
136+
# 老版本 luarocks 可能不支持 `lua-dir` 参数,可以删除该选项
137+
sudo luarocks install apisix 0.8
138+
```
139+
130140
> 安装完成
131141
132142
```

doc/install-dependencies.md

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
# Install Dependencies
22

3+
* [CentOS 6](#centos-6)
34
* [CentOS 7](#centos-7)
45
* [Ubuntu 16.04 & 18.04](#ubuntu-1604--1804)
56
* [Debian 9 & 10](#debian-9--10)
6-
* [CentOS 6](#centos-6)
77
* [Mac OSX](#mac-osx)
88

9+
CentOS 6
10+
========
11+
12+
```shell
13+
# add openresty source
14+
sudo yum install yum-utils
15+
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
16+
17+
# install openresty, etcd and some compilation tools
18+
sudo yum install -y openresty curl git gcc luarocks lua-devel make
19+
20+
wget https://github.com/etcd-io/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz
21+
tar -xvf etcd-v3.3.13-linux-amd64.tar.gz && \
22+
cd etcd-v3.3.13-linux-amd64 && \
23+
sudo cp -a etcd etcdctl /usr/bin/
24+
25+
# start etcd server
26+
nohup etcd &
27+
```
28+
929
CentOS 7
1030
========
1131

@@ -19,8 +39,7 @@ sudo yum install yum-utils
1939
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
2040

2141
# install openresty, etcd and some compilation tools
22-
sudo yum install -y etcd openresty curl git automake autoconf \
23-
gcc pcre-devel libtool gcc-c++ luarocks lua-devel
42+
sudo yum install -y etcd openresty curl git gcc luarocks lua-devel
2443

2544
# start etcd server
2645
sudo service etcd start
@@ -37,9 +56,7 @@ sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_releas
3756
sudo apt-get update
3857

3958
# install openresty, etcd and some compilation tools
40-
sudo apt-get install -y git etcd openresty curl luarocks\
41-
check libpcre3 libpcre3-dev libjemalloc-dev \
42-
libjemalloc1 build-essential libtool automake autoconf pkg-config
59+
sudo apt-get install -y git etcd openresty curl luarocks
4360

4461
# start etcd server
4562
sudo service etcd start
@@ -54,6 +71,7 @@ sed -i 's|^deb http://deb.debian.org/debian|deb http://mirrors.huaweicloud.com/d
5471
sed -i 's|^deb http://security.debian.org/debian-security|deb http://mirrors.huaweicloud.com/debian-security|g' /etc/apt/sources.list
5572
apt update
5673
apt install wget gnupg -y
74+
5775
# add openresty source
5876
wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
5977
sudo apt-get -y install software-properties-common
@@ -67,41 +85,18 @@ tar -xvf etcd-v3.3.13-linux-amd64.tar.gz && \
6785
sudo cp -a etcd etcdctl /usr/bin/
6886

6987
# install openresty and some compilation tools
70-
71-
sudo apt-get install -y git openresty curl \
72-
check libpcre3 libpcre3-dev libjemalloc-dev \
73-
build-essential libtool automake autoconf pkg-config
74-
75-
# install luarocks
76-
# (the version must > 3.0, --lua-dir was first introduced in the luarocks 3.0 release)
77-
78-
wget https://luarocks.org/releases/luarocks-3.1.3.tar.gz
79-
tar zxpf luarocks-3.1.3.tar.gz
80-
cd luarocks-3.1.3
81-
82-
* 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.)
83-
* Run `make build`.
84-
* As superuser, run `make install`.
85-
ln -s /usr/local/bin/luarocks /usr/bin/luarocks
86-
88+
sudo apt-get install -y git openresty curl luarocks make
8789

8890
# start etcd server
8991
nohup etcd &
9092
```
9193

92-
CentOS 6
93-
========
94-
95-
TODO
96-
97-
Failed to compile `rapidjson`, but the CentOS 6 comes with a lower version, will support CentOS 6 later.
98-
9994
Mac OSX
10095
=======
10196

10297
```shell
10398
# install openresty, etcd and some compilation tools
104-
brew install autoconf automake check pkg-config pcre libtool openresty/brew/openresty etcd luarocks
99+
brew install openresty/brew/openresty etcd luarocks curl git
105100

106101
# start etcd server with v2 protocol
107102
etcd --enable-v2=true &

t/plugin/node-status.t

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@ run_tests;
1111
__DATA__
1212
1313
=== TEST 1: sanity
14+
--- config
15+
location /t {
16+
content_by_lua_block {
17+
ngx.sleep(0.5)
18+
local t = require("lib.test_admin").test
19+
local code, body, body_org = t('/apisix/status', ngx.HTTP_GET)
20+
21+
if code >= 300 then
22+
ngx.status = code
23+
end
24+
ngx.say(body_org)
25+
}
26+
}
1427
--- request
15-
GET /apisix/status
28+
GET /t
1629
--- response_body eval
1730
qr/"accepted":/
1831
--- no_error_log

utils/install-apisix.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -ex
44

55
OR_EXEC=`which openresty 2>&1`
66
echo $OR_EXEC
7+
APISIX_VER="https://raw.githubusercontent.com/iresty/apisix/master/rockspec/apisix-master-0.rockspec"
78

89
# check the openresty exist
910
CHECK_OR_EXIST=`echo $OR_EXEC | grep ": no openresty" | wc -l`
@@ -25,13 +26,13 @@ echo $UNAME
2526

2627
do_install() {
2728
if [ "$UNAME" == "Darwin" ]; then
28-
luarocks install --lua-dir=$LUA_JIT_DIR apisix --tree=/usr/local/apisix/deps --local
29+
luarocks install --lua-dir=$LUA_JIT_DIR $APISIX_VER --tree=/usr/local/apisix/deps --local
2930

3031
elif [ "$LUAROCKS_VER" == 'luarocks 3.' ]; then
31-
luarocks install --lua-dir=$LUA_JIT_DIR apisix --tree=/usr/local/apisix/deps --local
32+
luarocks install --lua-dir=$LUA_JIT_DIR $APISIX_VER --tree=/usr/local/apisix/deps --local
3233

3334
else
34-
luarocks install apisix --tree=/usr/local/apisix/deps --local
35+
luarocks install $APISIX_VER --tree=/usr/local/apisix/deps --local
3536
fi
3637

3738
sudo rm -f /usr/local/bin/apisix

0 commit comments

Comments
 (0)