-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_test_instance.sh
executable file
·56 lines (40 loc) · 1.32 KB
/
setup_test_instance.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
#!/bin/bash
set -e
MAIN_DIR=~/searchguard-test
DOWNLOAD_CACHE="$MAIN_DIR/download-cache"
INSTALL_DIR="$MAIN_DIR/ki"
REPO_DIR=$(pwd)
VERSION=$(grep -e '\bversion\b' package.json | tr -d "[:blank:]" | sed -E 's/"version":"(.*)"(.*)/\1/')
KI_VERSION=$(echo "$VERSION" | cut -d "-" -f 1)
echo "KI version: $KI_VERSION"
if ! ./build.sh install-local; then
echo "Building Search Guard Kibana Plugin failed"
exit 1
fi
mkdir -p "$DOWNLOAD_CACHE"
if [[ "$OSTYPE" == "linux"* ]]; then
KI_ARCHIVE="kibana-$KI_VERSION-linux-x86_64.tar.gz"
elif [[ "$OSTYPE" == "darwin"* ]]; then
KI_ARCHIVE="kibana-$KI_VERSION-darwin-x86_64.tar.gz"
else
echo "OS type $OSTYPE not supported"
exit
fi
if [ ! -f "$DOWNLOAD_CACHE/$KI_ARCHIVE" ]; then
wget "https://artifacts.elastic.co/downloads/kibana/$KI_ARCHIVE" -P "$DOWNLOAD_CACHE"
fi
if [ -d "$INSTALL_DIR" ]; then
rm -r "$INSTALL_DIR"
fi
mkdir -p "$INSTALL_DIR"
echo "Extracting $KI_ARCHIVE to $INSTALL_DIR"
tar xfz "$DOWNLOAD_CACHE/$KI_ARCHIVE" -C "$INSTALL_DIR" --strip-components 1
cd "$INSTALL_DIR"
KI_SNAPSHOT=$(echo "$REPO_DIR"/target/releases/search-guard-kibana-plugin-*.zip)
bin/kibana-plugin install file:///"$KI_SNAPSHOT"
chmod u+x plugins/searchguard/install_demo_configuration.sh
cd plugins/searchguard
./install_demo_configuration.sh
cd ../../
echo "Starting Kibana"
bin/kibana