-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup_arangodb.sh
67 lines (52 loc) · 1.5 KB
/
setup_arangodb.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
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
VERSION=3.2.1
NAME=ArangoDB-$VERSION
if [ ! -d "$DIR/$NAME" ]; then
# download ArangoDB
echo "curl -s -L https://download.arangodb.com/travisCI/$NAME.tar.gz -o $NAME.tar.gz"
curl -s -L https://download.arangodb.com/travisCI/$NAME.tar.gz -o $NAME.tar.gz
echo "tar $NAME"
tar xf $NAME.tar.gz
fi
ARCH=$(arch)
PID=$(echo $PPID)
TMP_DIR="/tmp/arangodb.$PID"
PID_FILE="/tmp/arangodb.$PID.pid"
ARANGODB_DIR="$DIR/$NAME"
ARANGOD="${ARANGODB_DIR}/bin/arangod_x86_64"
# create database directory
mkdir ${TMP_DIR}
echo "Starting ArangoDB '${ARANGOD}'"
${ARANGOD} \
--database.directory ${TMP_DIR} \
--configuration none \
--server.endpoint tcp://127.0.0.1:8529 \
--javascript.app-path ${ARANGODB_DIR}/js/apps \
--javascript.startup-directory ${ARANGODB_DIR}/js \
--database.maximal-journal-size 1048576 \
--server.authentication false &
sleep 2
echo "Check for arangod process"
process=$(ps auxww | grep "bin/arangod" | grep -v grep)
if [ "x$process" == "x" ]; then
echo "no 'arangod' process found"
echo "ARCH = $ARCH"
exit 1
fi
echo "Waiting until ArangoDB is ready on port 8529"
n=0
# timeout value for startup
timeout=60
while [[ (-z `curl -H 'Authorization: Basic cm9vdDo=' -s 'http://127.0.0.1:8529/_api/version' `) && (n -lt timeout) ]] ; do
echo -n "."
sleep 1s
n=$[$n+1]
done
if [[ n -eq timeout ]];
then
echo "Could not start ArangoDB. Timeout reached."
exit 1
fi
echo "ArangoDB is up"