Skip to content

Commit

Permalink
chore: remove the shell script and docs for installing APISIX on MacOS (
Browse files Browse the repository at this point in the history
  • Loading branch information
Vacant2333 authored Jan 24, 2024
1 parent aa4da82 commit 847db2a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 74 deletions.
33 changes: 1 addition & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ ENV_LUAROCKS ?= luarocks
ENV_INST_PREFIX ?= /usr
ENV_INST_LUADIR ?= $(ENV_INST_PREFIX)/share/lua/5.1
ENV_INST_BINDIR ?= $(ENV_INST_PREFIX)/bin
ENV_HOMEBREW_PREFIX ?= /usr/local
ENV_RUNTIME_VER ?= $(shell $(ENV_NGINX_EXEC) -V 2>&1 | tr ' ' '\n' | grep 'APISIX_RUNTIME_VER' | cut -d '=' -f2)

-include .requirements
Expand All @@ -67,29 +66,6 @@ ifneq ($(shell test -d $(ENV_OPENSSL_PREFIX) && echo -n yes), yes)
endif
endif

# ENV patch for darwin
ifeq ($(ENV_OS_NAME), darwin)
ifeq ($(ENV_OS_ARCH), arm64)
ENV_HOMEBREW_PREFIX := /opt/homebrew
ENV_INST_BINDIR := $(ENV_INST_PREFIX)/local/bin
ENV_INST_LUADIR := $(shell which lua | xargs realpath | sed 's/bin\/lua//g')
endif

# OSX archive `._` cache file
ENV_TAR := COPYFILE_DISABLE=1 $(ENV_TAR)
ENV_LUAROCKS := $(ENV_LUAROCKS) --lua-dir=$(ENV_HOMEBREW_PREFIX)/opt/[email protected]

ifeq ($(shell test -d $(ENV_HOMEBREW_PREFIX)/opt/openresty-openssl && echo -n yes), yes)
ENV_OPENSSL_PREFIX := $(ENV_HOMEBREW_PREFIX)/opt/openresty-openssl
endif
ifeq ($(shell test -d $(ENV_HOMEBREW_PREFIX)/opt/openresty-openssl3 && echo -n yes), yes)
ENV_OPENSSL_PREFIX := $(ENV_HOMEBREW_PREFIX)/opt/openresty-openssl3
endif
ifeq ($(shell test -d $(ENV_HOMEBREW_PREFIX)/opt/pcre && echo -n yes), yes)
ENV_PCRE_PREFIX := $(ENV_HOMEBREW_PREFIX)/opt/pcre
endif
endif


# Makefile basic extension function
_color_red =\E[1;31m
Expand Down Expand Up @@ -144,13 +120,7 @@ endif
.PHONY: help
help:
@$(call func_echo_success_status, "Makefile rules:")
@echo
@if [ '$(ENV_OS_NAME)' = 'darwin' ]; then \
awk '{ if(match($$0, /^#{3}([^:]+):(.*)$$/)){ split($$0, res, ":"); gsub(/^#{3}[ ]*/, "", res[1]); _desc=$$0; gsub(/^#{3}([^:]+):[ \t]*/, "", _desc); printf(" make %-15s : %-10s\n", res[1], _desc) } }' Makefile; \
else \
awk '{ if(match($$0, /^\s*#{3}\s*([^:]+)\s*:\s*(.*)$$/, res)){ printf(" make %-15s : %-10s\n", res[1], res[2]) } }' Makefile; \
fi
@echo
@awk '{ if(match($$0, /^\s*#{3}\s*([^:]+)\s*:\s*(.*)$$/, res)){ printf(" make %-15s : %-10s\n", res[1], res[2]) } }' Makefile


### deps : Installing dependencies
Expand All @@ -161,7 +131,6 @@ deps: install-runtime
mkdir -p ~/.luarocks; \
$(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_LIBDIR $(addprefix $(ENV_OPENSSL_PREFIX), /lib); \
$(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_INCDIR $(addprefix $(ENV_OPENSSL_PREFIX), /include); \
[ '$(ENV_OS_NAME)' == 'darwin' ] && $(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.PCRE_INCDIR $(addprefix $(ENV_PCRE_PREFIX), /include); \
$(ENV_LUAROCKS) install apisix-master-0.rockspec --tree deps --only-deps $(ENV_LUAROCKS_SERVER_OPT); \
else \
$(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"); \
Expand Down
2 changes: 1 addition & 1 deletion apisix-master-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package = "apisix"
version = "master-0"
supported_platforms = {"linux", "macosx"}
supported_platforms = {"linux"}

source = {
url = "git://github.com/apache/apisix",
Expand Down
18 changes: 4 additions & 14 deletions benchmark/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,9 @@ do
fi
done

if [[ "$(uname)" == "Darwin" ]]; then
sed -i "" "s/\- proxy-mirror .*/#\- proxy-mirror/g" conf/config-default.yaml
sed -i "" "s/\- proxy-cache .*/#\- proxy-cache/g" conf/config-default.yaml
sed -i "" "s/listen .*;/$nginx_listen/g" benchmark/server/conf/nginx.conf
else
sed -i "s/\- proxy-mirror/#\- proxy-mirror/g" conf/config-default.yaml
sed -i "s/\- proxy-cache/#\- proxy-cache/g" conf/config-default.yaml
sed -i "s/listen .*;/$nginx_listen/g" benchmark/server/conf/nginx.conf
fi
sed -i "s/\- proxy-mirror/#\- proxy-mirror/g" conf/config-default.yaml
sed -i "s/\- proxy-cache/#\- proxy-cache/g" conf/config-default.yaml
sed -i "s/listen .*;/$nginx_listen/g" benchmark/server/conf/nginx.conf

echo "
nginx_config:
Expand Down Expand Up @@ -144,11 +138,7 @@ echo -e "\n\nfake empty apisix server: $worker_cnt worker"

sleep 1

if [[ "$(uname)" == "Darwin" ]]; then
sed -i "" "s/worker_processes [0-9]*/worker_processes $worker_cnt/g" benchmark/fake-apisix/conf/nginx.conf
else
sed -i "s/worker_processes [0-9]*/worker_processes $worker_cnt/g" benchmark/fake-apisix/conf/nginx.conf
fi
sed -i "s/worker_processes [0-9]*/worker_processes $worker_cnt/g" benchmark/fake-apisix/conf/nginx.conf

sudo ${fake_apisix_cmd} || exit 1

Expand Down
6 changes: 0 additions & 6 deletions docs/en/latest/building-apisix.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,6 @@ For the error `Error unknown directive "lua_package_path" in /API_ASPIX/apisix/t
export PATH=/usr/local/openresty/nginx/sbin:$PATH
```
- macOS default installation path (view homebrew):
```shell
export PATH=/usr/local/opt/openresty/nginx/sbin:$PATH
```
#### Running a specific test case
To run a specific test case, use the command below:
Expand Down
2 changes: 1 addition & 1 deletion docs/en/latest/install-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ title: Install Dependencies

Run the following command to install Apache APISIX's dependencies on a supported operating system.

Supported OS versions: CentOS7, Fedora31 & 32, Ubuntu 16.04 & 18.04, Debian 9 & 10, Arch Linux, Mac OSX
Supported OS versions: CentOS7, Fedora31 & 32, Ubuntu 16.04 & 18.04, Debian 9 & 10, Arch Linux.

Note that in the case of Arch Linux, we use `openresty` from the AUR, thus requiring a AUR helper. For now `yay` and `pacaur` are supported.

Expand Down
6 changes: 0 additions & 6 deletions docs/zh/latest/building-apisix.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,6 @@ APISIX 的一些特性需要在 OpenResty 中引入额外的 NGINX 模块。
export PATH=/usr/local/openresty/nginx/sbin:$PATH
```
- macOS 通过 `homebrew` 的默认安装路径:
```shell
export PATH=/usr/local/opt/openresty/nginx/sbin:$PATH
```
### 运行指定的测试用例
使用以下命令运行指定的测试用例:
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/latest/install-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ title: 安装依赖

在支持的操作系统上运行以下指令即可安装 Apache APISIX dependencies。

支持的操作系统版本:CentOS 7, Fedora 31 & 32, Ubuntu 16.04 & 18.04, Debian 9 & 10, Arch Linux, Mac OSX
支持的操作系统版本:CentOS 7, Fedora 31 & 32, Ubuntu 16.04 & 18.04, Debian 9 & 10, Arch Linux。

注意,对于 Arch Linux 来说,我们使用 AUR 源中的 `openresty`,所以需要 AUR Helper 才能正常安装。目前支持 `yay``pacaur`

Expand Down
19 changes: 6 additions & 13 deletions utils/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ function install_dependencies_with_apt() {
sudo apt-get install -y curl make gcc g++ cpanminus libpcre3 libpcre3-dev libldap2-dev unzip openresty-zlib-dev openresty-pcre-dev
}

# Install dependencies on mac osx
function install_dependencies_on_mac_osx() {
# install OpenResty, etcd and some compilation tools
brew install openresty/brew/openresty luarocks [email protected] wget curl git pcre openldap
}

# Identify the different distributions and call the corresponding function
function multi_distro_installation() {
if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
Expand All @@ -102,7 +96,7 @@ function multi_distro_installation() {
elif grep -Eqi "Arch" /etc/issue || grep -Eqi "EndeavourOS" /etc/issue || grep -Eq "Arch" /etc/*-release; then
install_dependencies_with_aur
else
echo "Non-supported operating system version"
echo "Non-supported distribution, APISIX is only supported on Linux-based systems"
exit 1
fi
install_apisix_runtime
Expand All @@ -120,7 +114,7 @@ function multi_distro_uninstallation() {
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
sudo apt-get autoremove -y openresty-zlib-dev openresty-pcre-dev
else
echo "Non-supported operating system version"
echo "Non-supported distribution, APISIX is only supported on Linux-based systems"
exit 1
fi
}
Expand Down Expand Up @@ -152,12 +146,11 @@ function main() {
if [[ "${OS_NAME}" == "linux" ]]; then
multi_distro_installation
install_luarocks
elif [[ "${OS_NAME}" == "darwin" ]]; then
install_dependencies_on_mac_osx
return
else
echo "Non-supported distribution"
echo "Non-supported distribution, APISIX is only supported on Linux-based systems"
exit 1
fi
return
fi

case_opt=$1
Expand All @@ -169,7 +162,7 @@ function main() {
if [[ "${OS_NAME}" == "linux" ]]; then
multi_distro_uninstallation
else
echo "Non-supported distribution"
echo "Non-supported distribution, APISIX is only supported on Linux-based systems"
fi
;;
*)
Expand Down

0 comments on commit 847db2a

Please sign in to comment.