Skip to content

Commit

Permalink
fix: remove openldap dependencies from apisix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhenye-Na committed Sep 14, 2023
1 parent 4f9301c commit 5cf1be3
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/fuzzing-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install -y git openresty curl openresty-openssl111-dev unzip make gcc libldap2-dev
sudo apt-get install -y git openresty curl openresty-openssl111-dev unzip make gcc
./utils/linux-install-luarocks.sh
make deps
Expand Down
2 changes: 1 addition & 1 deletion ci/centos7-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install_dependencies() {

# install build & runtime deps
yum install -y wget tar gcc automake autoconf libtool make unzip \
git sudo openldap-devel which ca-certificates openssl-devel \
git sudo which ca-certificates openssl-devel \
epel-release

# install newer curl
Expand Down
2 changes: 1 addition & 1 deletion ci/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,5 @@ GRPC_SERVER_EXAMPLE_VER=20210819

linux_get_dependencies () {
apt update
apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl libpcre3 libpcre3-dev libldap2-dev
apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl libpcre3 libpcre3-dev
}
4 changes: 2 additions & 2 deletions ci/linux-install-openresty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if [ "$OPENRESTY_VERSION" == "source" ]; then
chmod +x build-apisix-base.sh
./build-apisix-base.sh latest

sudo apt-get install -y openresty-openssl111 openresty-openssl111-debug-dev libldap2-dev openresty-pcre openresty-zlib
sudo apt-get install -y openresty-openssl111 openresty-openssl111-debug-dev openresty-pcre openresty-zlib

exit 0
fi
Expand All @@ -90,4 +90,4 @@ else
openresty="openresty-debug=$OPENRESTY_VERSION*"
fi

sudo apt-get install "$openresty" openresty-openssl111-debug-dev libldap2-dev
sudo apt-get install "$openresty" openresty-openssl111-debug-dev
2 changes: 1 addition & 1 deletion ci/performance_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set -ex

install_dependencies() {
apt-get -y update --fix-missing
apt-get -y install lua5.1 liblua5.1-0-dev libldap2-dev
apt-get -y install lua5.1 liblua5.1-0-dev
export_or_prefix
export OPENRESTY_VERSION=source
./ci/linux-install-openresty.sh
Expand Down
20 changes: 0 additions & 20 deletions ci/pod/docker-compose.plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,6 @@ services:
networks:
skywalk_net:


## OpenLDAP
openldap:
image: bitnami/openldap:2.5.8
environment:
- LDAP_ADMIN_USERNAME=amdin
- LDAP_ADMIN_PASSWORD=adminpassword
- LDAP_USERS=user01,user02
- LDAP_PASSWORDS=password1,password2
- LDAP_ENABLE_TLS=yes
- LDAP_TLS_CERT_FILE=/certs/localhost_slapd_cert.pem
- LDAP_TLS_KEY_FILE=/certs/localhost_slapd_key.pem
- LDAP_TLS_CA_FILE=/certs/apisix.crt
ports:
- "1389:1389"
- "1636:1636"
volumes:
- ./t/certs:/certs


## Grafana Loki
loki:
image: grafana/loki:2.8.0
Expand Down
2 changes: 1 addition & 1 deletion ci/redhat-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ install_dependencies() {

# install build & runtime deps
yum install -y --disablerepo=* --enablerepo=ubi-8-appstream-rpms --enablerepo=ubi-8-baseos-rpms \
wget tar gcc automake autoconf libtool make unzip git sudo openldap-devel hostname \
wget tar gcc automake autoconf libtool make unzip git sudo hostname \
which ca-certificates openssl-devel

# install newer curl
Expand Down
37 changes: 0 additions & 37 deletions docs/en/latest/building-apisix.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,43 +73,6 @@ make install

This will install the runtime-dependent Lua libraries and the `apisix` CLI tool.

:::note

If you get an error message like `Could not find header file for LDAP/PCRE/openssl` while running `make deps`, use this solution.

`luarocks` supports custom compile-time dependencies (See: [Config file format](https://github.com/luarocks/luarocks/wiki/Config-file-format)). You can use a third-party tool to install the missing packages and add its installation directory to the `luarocks`' variables table. This method works on macOS, Ubuntu, CentOS, and other similar operating systems.

The solution below is for macOS but it works similarly for other operating systems:

1. Install `openldap` by running:

```shell
brew install openldap
```

2. Locate the installation directory by running:

```shell
brew --prefix openldap
```

3. Add this path to the project configuration file by any of the two methods shown below:
1. You can use the `luarocks config` command to set `LDAP_DIR`:

```shell
luarocks config variables.LDAP_DIR /opt/homebrew/cellar/openldap/2.6.1
```

2. You can also change the default configuration file of `luarocks`. Open the file `~/.luaorcks/config-5.1.lua` and add the following:

```shell
variables = { LDAP_DIR = "/opt/homebrew/cellar/openldap/2.6.1", LDAP_INCDIR = "/opt/homebrew/cellar/openldap/2.6.1/include", }
```
`/opt/homebrew/cellar/openldap/` is default path `openldap` is installed on Apple Silicon macOS machines. For Intel machines, the default path is `/usr/local/opt/openldap/`.
:::
To uninstall the APISIX runtime, run:

```shell
Expand Down
37 changes: 0 additions & 37 deletions docs/zh/latest/building-apisix.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,43 +77,6 @@ make install

该命令将安装 APISIX 运行时依赖的 Lua 库和 `apisix` 命令。

:::note

如果你在运行 `make deps` 时收到类似 `Could not find header file for LDAP/PCRE/openssl` 的错误消息,请使用此解决方案。

`luarocks` 支持自定义编译时依赖项(请参考:[配置文件格式](https://github.com/luarocks/luarocks/wiki/Config-file-format))。你可以使用第三方工具安装缺少的软件包并将其安装目录添加到 `luarocks` 变量表中。此方法适用于 macOS、Ubuntu、CentOS 和其他类似操作系统。

此处仅给出 macOS 的具体解决步骤,其他操作系统的解决方案类似:

1. 安装 `openldap`

```shell
brew install openldap
```

2. 使用以下命令命令找到本地安装目录:

```shell
brew --prefix openldap
```

3. 将路径添加到项目配置文件中(选择两种方法中的一种即可):
1. 你可以使用 `luarocks config` 命令设置 `LDAP_DIR`

```shell
luarocks config variables.LDAP_DIR /opt/homebrew/cellar/openldap/2.6.1
```

2. 你还可以更改 `luarocks` 的默认配置文件。打开 `~/.luaorcks/config-5.1.lua` 文件并添加以下内容:

```shell
variables = { LDAP_DIR = "/opt/homebrew/cellar/openldap/2.6.1", LDAP_INCDIR = "/opt/homebrew/cellar/openldap/2.6.1/include", }
```
`/opt/homebrew/cellar/openldap/``brew` 在 macOS(Apple Silicon) 上安装 `openldap` 的默认位置。`/usr/local/opt/openldap/` 是 brew 在 macOS(Intel) 上安装 openldap 的默认位置。
:::
如果你不再需要 APISIX,可以执行以下命令卸载:

```shell
Expand Down
1 change: 0 additions & 1 deletion t/chaos/utils/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ RUN set -x \
pkgconfig \
cmake \
git \
openldap-dev \
pcre-dev \
sudo \
&& cd apisix \
Expand Down
6 changes: 3 additions & 3 deletions utils/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function install_dependencies_with_aur() {
function install_dependencies_with_yum() {
sudo yum install -y yum-utils

local common_dep="curl wget git gcc openresty-openssl111-devel unzip pcre pcre-devel openldap-devel"
local common_dep="curl wget git gcc openresty-openssl111-devel unzip pcre pcre-devel"
if [ "${1}" == "centos" ]; then
# add APISIX source
local apisix_pkg=apache-apisix-repo-1.0-1.noarch
Expand Down Expand Up @@ -84,13 +84,13 @@ function install_dependencies_with_apt() {
sudo apt-get update

# install OpenResty and some compilation tools
sudo apt-get install -y git openresty curl openresty-openssl111-dev make gcc libpcre3 libpcre3-dev libldap2-dev unzip
sudo apt-get install -y git openresty curl openresty-openssl111-dev make gcc libpcre3 libpcre3-dev unzip
}

# 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
brew install openresty/brew/openresty luarocks [email protected] wget curl git pcre
}

# Identify the different distributions and call the corresponding function
Expand Down

0 comments on commit 5cf1be3

Please sign in to comment.