-
Notifications
You must be signed in to change notification settings - Fork 56
Building OpenResty
The instructions provided below specify the steps to build OpenResty 1.19.3.2 on Linux on IBM Z for the following distributions:
- RHEL (7.8, 7.9, 8.2, 8.3, 8.4)
- SLES (12 SP5, 15 SP2, 15 SP3)
- Ubuntu (18.04, 20.04, 21.04)
General Notes:
-
When following the steps below please use a standard permission user unless otherwise specified.
-
A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
If you want to build OpenResty using manual steps, go to Step 2.
Use the following commands to build OpenResty using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/OpenResty/1.19.3.2/build_openresty.sh
# Build OpenResty
bash build_openresty.sh [Provide -t option for executing build with tests]
If the build completes successfully, go to STEP 8. In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (7.8, 7.9, 8.2, 8.3, 8.4)
sudo yum install -y curl tar wget make gcc dos2unix cpan perl postgresql-devel patch pcre-devel openssl-devel
-
SLES (12 SP5, 15 SP2, 15 SP3)
sudo zypper install -y curl tar wget make gcc dos2unix perl postgresql10-devel patch pcre-devel openssl libopenssl-devel gzip
-
Ubuntu (18.04, 20.04, 21.04)
sudo apt-get update sudo apt-get install -y curl tar wget make gcc build-essential dos2unix patch libpcre3-dev libpq-dev openssl libssl-dev perl zlib1g-dev sudo ln -s make /usr/bin/gmake
Note: Set /sbin
to your PATH environment variable if not already set. Example: export PATH=$PATH:/sbin
cd $SOURCE_ROOT
wget https://openresty.org/download/openresty-1.19.3.2.tar.gz
tar -xvf openresty-1.19.3.2.tar.gz
Step 4: Rollback some modules to previous version due to a lua core issue
cd $SOURCE_ROOT
wget https://openresty.org/download/openresty-1.17.8.2.tar.gz
tar -xvf openresty-1.17.8.2.tar.gz
rm -rf openresty-1.19.3.2/bundle/LuaJIT-2.1-*
rm -rf openresty-1.19.3.2/bundle/lua-resty-core-*
rm -rf openresty-1.19.3.2/bundle/ngx_lua-*
rm -rf openresty-1.19.3.2/bundle/ngx_stream_lua-*
cp -r openresty-1.17.8.2/bundle/LuaJIT-2.1-* openresty-1.19.3.2/bundle/
cp -r openresty-1.17.8.2/bundle/lua-resty-core-* openresty-1.19.3.2/bundle/
cp -r openresty-1.17.8.2/bundle/ngx_lua-* openresty-1.19.3.2/bundle/
cp -r openresty-1.17.8.2/bundle/ngx_stream_lua-* openresty-1.19.3.2/bundle/
rm -rf openresty-1.17.8.2
cd $SOURCE_ROOT/openresty-1.19.3.2
PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/OpenResty/1.19.3.2/patch"
curl -o "configure.diff" $PATCH_URL/configure.diff
patch -l $SOURCE_ROOT/openresty-1.19.3.2/configure configure.diff
cd $SOURCE_ROOT/openresty-1.19.3.2
./configure --with-pcre-jit \
--with-ipv6 \
--without-http_redis2_module \
--with-http_iconv_module \
--with-http_postgres_module
make -j2
sudo make install
sudo PERL_MM_USE_DEFAULT=1 cpan Cwd IPC::Run3 Test::Base
Note: For options prompted please select the default option.
mkdir $SOURCE_ROOT/openresty-1.19.3.2/t
cd $SOURCE_ROOT/openresty-1.19.3.2/t
wget https://raw.githubusercontent.com/openresty/openresty/v1.19.3.2/t/Config.pm
wget https://raw.githubusercontent.com/openresty/openresty/v1.19.3.2/t/000-sanity.t
-
Apply patch to file
$SOURCE_ROOT/openresty-1.17.8.1/t/Config.pm
PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/OpenResty/1.19.3.2/patch" curl -o "Config.pm.diff" $PATCH_URL/Config.pm.diff patch -l $SOURCE_ROOT/openresty-1.19.3.2/t/Config.pm Config.pm.diff
-
Update the module version based on our change
sed -i 's/lua-resty-core-0.1.21/lua-resty-core-0.1.19/g' $SOURCE_ROOT/openresty-1.19.3.2/t/000-sanity.t sed -i 's/LuaJIT-2.1-20201027/LuaJIT-2.1-20200102/g' $SOURCE_ROOT/openresty-1.19.3.2/t/000-sanity.t sed -i 's/ngx_stream_lua-0.0.9/ngx_stream_lua-0.0.8/g' $SOURCE_ROOT/openresty-1.19.3.2/t/000-sanity.t sed -i 's/ngx_lua-0.10.19/ngx_lua-0.10.17/g' $SOURCE_ROOT/openresty-1.19.3.2/t/000-sanity.t
-
Revert the patch for
configure
file (RHEL 7.x and SLES 12 SP5 only)cd $SOURCE_ROOT/openresty-1.19.3.2 curl -o "configure.diff" $PATCH_URL/configure.diff patch -l -R $SOURCE_ROOT/openresty-1.19.3.2/configure configure.diff
cd $SOURCE_ROOT/openresty-1.19.3.2
prove -r t
export PATH=/usr/local/openresty/bin:$PATH
resty -V
resty -e 'print("hello, world")'
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.