-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_env.sh
executable file
·97 lines (82 loc) · 2.38 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
88
89
90
91
92
93
94
95
96
97
set -e
export OPENRESTY_INSTALL=$CACHE_DIR/openresty
export LUAROCKS_INSTALL=$CACHE_DIR/luarocks
export SERF_INSTALL=$CACHE_DIR/serf
mkdir -p $CACHE_DIR
if [ ! "$(ls -A $CACHE_DIR)" ]; then
# Not in cache
# ---------------
# Install OpenSSL
# ---------------
OPENSSL_BASE=openssl-$OPENSSL
curl -L http://www.openssl.org/source/$OPENSSL_BASE.tar.gz | tar xz
# -----------------
# Install OpenResty
# -----------------
OPENRESTY_BASE=openresty-$OPENRESTY
mkdir -p $OPENRESTY_INSTALL
curl -L https://openresty.org/download/$OPENRESTY_BASE.tar.gz | tar xz
pushd $OPENRESTY_BASE
./configure \
--prefix=$OPENRESTY_INSTALL \
--with-openssl=../$OPENSSL_BASE \
--with-ipv6 \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_stub_status_module \
--without-lua_resty_websocket \
--without-lua_resty_mysql \
--without-lua_resty_redis \
--without-http_redis_module \
--without-http_redis2_module \
--without-lua_redis_parser
make
make install
popd
rm -rf $OPENRESTY_BASE
# ----------------
# Install Luarocks
# ----------------
LUAROCKS_BASE=luarocks-$LUAROCKS
mkdir -p $LUAROCKS_INSTALL
git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE
pushd $LUAROCKS_BASE
git checkout v$LUAROCKS
./configure \
--prefix=$LUAROCKS_INSTALL \
--lua-suffix=jit \
--with-lua=$OPENRESTY_INSTALL/luajit \
--with-lua-include=$OPENRESTY_INSTALL/luajit/include/luajit-2.1
make build
make install
popd
rm -rf $LUAROCKS_BASE
# ------------
# Install Serf
# ------------
mkdir -p $SERF_INSTALL
pushd $SERF_INSTALL
wget https://releases.hashicorp.com/serf/${SERF}/serf_${SERF}_linux_amd64.zip
unzip serf_${SERF}_linux_amd64.zip
popd
fi
export PATH=$PATH:$OPENRESTY_INSTALL/nginx/sbin:$OPENRESTY_INSTALL/bin:$LUAROCKS_INSTALL/bin:$SERF_INSTALL
eval `luarocks path`
# -------------------------------------
# Install ccm & setup Cassandra cluster
# -------------------------------------
if [[ "$TEST_SUITE" != "unit" ]] && [[ "$TEST_SUITE" != "lint" ]]; then
pip install --user PyYAML six
git clone https://github.com/pcmanus/ccm.git
pushd ccm
./setup.py install --user
popd
ccm create test -v binary:$CASSANDRA -n 1 -d
ccm start -v
ccm status
fi
nginx -V
resty -V
luarocks --version
serf version