-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_env.sh
executable file
·87 lines (71 loc) · 2.56 KB
/
setup_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
# set -e
#---------
# Download
#---------
DEPS_HASH=$(cat .ci/setup_env.sh .travis.yml | md5sum | awk '{ print $1 }')
DOWNLOAD_ROOT=${DOWNLOAD_ROOT:=/download-root}
BUILD_TOOLS_DOWNLOAD=$DOWNLOAD_ROOT/openresty-build-tools
KONG_NGINX_MODULE_BRANCH=${KONG_NGINX_MODULE_BRANCH:=master}
OPENRESTY_PATCHES_BRANCH=${OPENRESTY_PATCHES_BRANCH:=master}
if [ ! -d $BUILD_TOOLS_DOWNLOAD ]; then
git clone -q https://github.com/Kong/openresty-build-tools.git $BUILD_TOOLS_DOWNLOAD
else
pushd $BUILD_TOOLS_DOWNLOAD
git fetch
git reset --hard origin/master
popd
fi
export PATH=$BUILD_TOOLS_DOWNLOAD:$PATH
#--------
# Install
#--------
INSTALL_CACHE=${INSTALL_CACHE:=/install-cache}
INSTALL_ROOT=$INSTALL_CACHE/$DEPS_HASH
kong-ngx-build \
--work $DOWNLOAD_ROOT \
--prefix $INSTALL_ROOT \
--openresty $OPENRESTY \
--openresty-patches $OPENRESTY_PATCHES_BRANCH \
--kong-nginx-module $KONG_NGINX_MODULE_BRANCH \
--luarocks $LUAROCKS \
--openssl $OPENSSL \
-j $JOBS
OPENSSL_INSTALL=$INSTALL_ROOT/openssl
OPENRESTY_INSTALL=$INSTALL_ROOT/openresty
LUAROCKS_INSTALL=$INSTALL_ROOT/luarocks
export OPENSSL_DIR=$OPENSSL_INSTALL # for LuaSec install
export PATH=$OPENSSL_INSTALL/bin:$OPENRESTY_INSTALL/nginx/sbin:$OPENRESTY_INSTALL/bin:$LUAROCKS_INSTALL/bin:$PATH
export LD_LIBRARY_PATH=$OPENSSL_INSTALL/lib:$LD_LIBRARY_PATH # for openssl's CLI invoked in the test suite
eval `luarocks path`
# -------------------------------------
# Install ccm & setup Cassandra cluster
# -------------------------------------
if [[ "$KONG_TEST_DATABASE" == "cassandra" ]]; then
echo "Setting up Cassandra"
docker run -d --name=cassandra --rm -p 7199:7199 -p 7000:7000 -p 9160:9160 -p 9042:9042 cassandra:$CASSANDRA
grep -q 'Created default superuser role' <(docker logs -f cassandra)
fi
# -------------------
# Install Test::Nginx
# -------------------
if [[ "$TEST_SUITE" == "pdk" ]]; then
CPAN_DOWNLOAD=$DOWNLOAD_ROOT/cpanm
mkdir -p $CPAN_DOWNLOAD
wget -O $CPAN_DOWNLOAD/cpanm https://cpanmin.us
chmod +x $CPAN_DOWNLOAD/cpanm
export PATH=$CPAN_DOWNLOAD:$PATH
echo "Installing CPAN dependencies..."
cpanm --notest Test::Nginx &> build.log || (cat build.log && exit 1)
cpanm --notest --local-lib=$TRAVIS_BUILD_DIR/perl5 local::lib && eval $(perl -I $TRAVIS_BUILD_DIR/perl5/lib/perl5/ -Mlocal::lib)
fi
# ----------------
# Run gRPC server |
# ----------------
if [[ "$TEST_SUITE" =~ integration|dbless ]]; then
docker run -d --name grpcbin -p 15002:9000 -p 15003:9001 moul/grpcbin
fi
nginx -V
resty -V
luarocks --version
openssl version