Skip to content

Commit

Permalink
feat: upgrade luarocks to 3.8.0 which converts git:// to https:// (#5825
Browse files Browse the repository at this point in the history
)

The Luarocks 2.x is already broken.
  • Loading branch information
spacewander committed Dec 18, 2021
1 parent 37d469e commit 5cde5ae
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 21 deletions.
1 change: 0 additions & 1 deletion .github/workflows/fuzzing-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
sudo apt-get install -y git openresty curl openresty-openssl111-dev unzip make gcc libldap2-dev
./utils/linux-install-luarocks.sh
git config --global url.https://github.com/.insteadOf git://github.com/
make deps
make init
make run
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,8 @@ deps: runtime
$(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_INCDIR $(addprefix $(ENV_OPENSSL_PREFIX), /include); \
$(ENV_LUAROCKS) install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local $(ENV_LUAROCKS_SERVER_OPT); \
else \
$(call func_echo_warn_status, "WARNING: You're not using LuaRocks 3.x; please add the following items to your LuaRocks config file:"); \
echo "variables = {"; \
echo " OPENSSL_LIBDIR=$(addprefix $(ENV_OPENSSL_PREFIX), /lib)"; \
echo " OPENSSL_INCDIR=$(addprefix $(ENV_OPENSSL_PREFIX), /include)"; \
echo "}"; \
$(ENV_LUAROCKS) install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local $(ENV_LUAROCKS_SERVER_OPT); \
$(call func_echo_warn_status, "WARNING: You're not using LuaRocks 3.x; please remove the luarocks and reinstall it via https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh"); \
exit 1; \
fi


Expand Down
1 change: 0 additions & 1 deletion ci/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export_or_prefix() {
create_lua_deps() {
echo "Create lua deps"

git config --global url.https://github.com/.insteadOf git://github.com/
make deps
# maybe reopen this feature later
# luarocks install luacov-coveralls --tree=deps --local > build.log 2>&1 || (cat build.log && exit 1)
Expand Down
2 changes: 0 additions & 2 deletions ci/linux_apisix_current_luarocks_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ script() {

sudo rm -rf /usr/local/apisix

git config --global url.https://github.com/.insteadOf git://github.com/

# install APISIX with local version
sudo luarocks install rockspec/apisix-master-0.rockspec --only-deps > build.log 2>&1 || (cat build.log && exit 1)
sudo luarocks make rockspec/apisix-master-0.rockspec > build.log 2>&1 || (cat build.log && exit 1)
Expand Down
2 changes: 0 additions & 2 deletions ci/linux_apisix_master_luarocks_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ script() {
mkdir tmp && cd tmp
cp -r ../utils ./

git config --global url.https://github.com/.insteadOf git://github.com/

# install APISIX by luarocks
sudo luarocks install $APISIX_MAIN > build.log 2>&1 || (cat build.log && exit 1)
cp ../bin/apisix /usr/local/bin/apisix
Expand Down
3 changes: 1 addition & 2 deletions docs/en/latest/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ See more [etcd why](https://etcd.io/docs/latest/learning/why/#comparison-chart).
There are two possibilities when encountering slow luarocks:

1. Server used for luarocks installation is blocked
2. There is a place between your network and github server to block the 'git' protocol

For the first problem, you can use https_proxy or use the `--server` option to specify a luarocks server that you can access or access faster.
Run the `luarocks config rocks_servers` command(this command is supported after luarocks 3.0) to see which server are available.
Expand All @@ -78,7 +77,7 @@ We already provide a wrapper in the Makefile to simplify your job:
make deps ENV_LUAROCKS_SERVER=https://luarocks.cn
```

If using a proxy doesn't solve this problem, you can add `--verbose` option during installation to see exactly how slow it is. Excluding the first case, only the second that the `git` protocol is blocked. Then we can run `git config --global url."https://".insteadOf git://` to using the 'HTTPS' protocol instead of `git`.
If using a proxy doesn't solve this problem, you can add `--verbose` option during installation to see exactly how slow it is.

## How to support gray release via Apache APISIX?

Expand Down
4 changes: 1 addition & 3 deletions docs/zh/latest/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ APISIX 需要一个配置中心,上面提到的很多功能是传统关系型
遇到 luarocks 慢的问题,有以下两种可能:

1. luarocks 安装所使用的服务器不能访问
2. 你所在的网络到 github 服务器之间有地方对 `git` 协议进行封锁

针对第一个问题,你可以使用 https_proxy 或者使用 `--server` 选项来指定一个你可以访问或者访问更快的
luarocks 服务。 运行 `luarocks config rocks_servers` 命令(这个命令在 luarocks 3.0 版本后开始支持)
Expand All @@ -77,8 +76,7 @@ luarocks 服务。 运行 `luarocks config rocks_servers` 命令(这个命令
make deps ENV_LUAROCKS_SERVER=https://luarocks.cn
```

如果使用代理仍然解决不了这个问题,那可以在安装的过程中添加 `--verbose` 选项来查看具体是慢在什么地方。排除前面的
第一种情况,只可能是第二种,`git` 协议被封。这个时候可以执行 `git config --global url."https://".insteadOf git://` 命令使用 `https` 协议替代。
如果使用代理仍然解决不了这个问题,那可以在安装的过程中添加 `--verbose` 选项来查看具体是慢在什么地方。

## 如何通过 APISIX 支持灰度发布?

Expand Down
9 changes: 5 additions & 4 deletions utils/linux-install-luarocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ if [ -z ${OPENRESTY_PREFIX} ]; then
OPENRESTY_PREFIX="/usr/local/openresty"
fi

wget https://github.com/luarocks/luarocks/archive/v3.4.0.tar.gz
tar -xf v3.4.0.tar.gz
cd luarocks-3.4.0 || exit
LUAROCKS_VER=3.8.0
wget https://github.com/luarocks/luarocks/archive/v"$LUAROCKS_VER".tar.gz
tar -xf v"$LUAROCKS_VER".tar.gz
cd luarocks-"$LUAROCKS_VER" || exit

OR_BIN="$OPENRESTY_PREFIX/bin/openresty"
OR_VER=$($OR_BIN -v 2>&1 | awk -F '/' '{print $2}' | awk -F '.' '{print $1"."$2}')
Expand All @@ -41,7 +42,7 @@ fi
make build > build.log 2>&1 || (cat build.log && exit 1)
sudo make install > build.log 2>&1 || (cat build.log && exit 1)
cd .. || exit
rm -rf luarocks-3.4.0
rm -rf luarocks-"$LUAROCKS_VER"

mkdir ~/.luarocks || true

Expand Down

0 comments on commit 5cde5ae

Please sign in to comment.