-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_env_neo4j.bash
executable file
·43 lines (39 loc) · 1.52 KB
/
setup_env_neo4j.bash
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
#!/bin/bash
export DJANGO_SETTINGS_MODULE="mysite.settings"
export NEO4J_PORT=7474
DEFAULT_VERSION="1.8.2"
export NEO4J_VERSION=$DEFAULT_VERSION
neo4j stop || true
VERSION=${1-$DEFAULT_VERSION}
DIR="neo4j-community-$VERSION"
FILE="$DIR-unix.tar.gz"
SERVER_PROPERTIES_FILE="lib/neo4j/conf/neo4j-server.properties"
#set a default neo4j port if none has been set
if [[ ! -d lib/$DIR ]]; then
wget http://dist.neo4j.org/$FILE
tar xvfz $FILE &> /dev/null
rm $FILE
[[ ! -d lib ]] && mkdir lib
mv $DIR lib/
[[ -h lib/neo4j ]] && unlink lib/neo4j
ln -fs $DIR lib/neo4j
mkdir lib/neo4j/testing/
PLUGIN_VERSION="1.6"
if [[ $NEO4J_VERSION == 1.5* ]]; then
PLUGIN_VERSION="1.5"
fi
DELETE_DB_PLUGIN_JAR="test-delete-db-extension-$PLUGIN_VERSION.jar"
wget --no-check-certificate -O lib/neo4j/testing/$DELETE_DB_PLUGIN_JAR https://github.com/downloads/jexp/neo4j-clean-remote-db-addon/$DELETE_DB_PLUGIN_JAR
ln -s ../testing/$DELETE_DB_PLUGIN_JAR lib/neo4j/plugins/$DELETE_DB_PLUGIN_JAR
cat >> $SERVER_PROPERTIES_FILE <<EOF
org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.server.extension.test.delete=/cleandb
org.neo4j.server.thirdparty.delete.key=supersecretdebugkey!
EOF
fi
#if grep 7474 $SERVER_PROPERTIES_FILE > /dev/null;
#then
# sed -i 's/7474/$NEO4J_PORT/g' "$SERVER_PROPERTIES_FILE #change port
#fi
./lib/neo4j/bin/neo4j start || ( cat ./lib/neo4j/data/log/*.log && exit 1 )
#curl http://localhost:$NEO4J_PORT/db/data/
#curl -X DELETE 'http://localhost:7474/cleandb/supersecretdebugkey!'