-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.sh
executable file
·73 lines (53 loc) · 1.81 KB
/
install.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
#!/bin/bash
source `dirname $0`/utils/common.sh
function install_python_deps(){
python --version
pip --version && pip install requests --user || echo "can't install requests. No pip?"
}
CF_USER=${1:-$CF_USER}
CF_PASSWORD=${2:-$CF_PASSWORD}
CF_ORG=${3:-$CF_ORG}
CF_SPACE=${4:-$CF_SPACE}
DOCKER_AWS=$5
function install_cf(){
mkdir -p $HOME/bin
curl -v -L -o cf.tgz 'https://cli.run.pivotal.io/stable?release=linux64-binary&version=6.23.1&source=github-rel'
# curl -v -L -o cf.tgz 'https://cli.run.pivotal.io/stable?release=linux64-binary&version=6.21.1&source=github-rel'
tar zxpf cf.tgz
mkdir -p $HOME/bin && mv cf $HOME/bin
}
function validate_cf(){
cf -v || install_cf
export PATH=$PATH:$HOME/bin
cf api https://api.run.pivotal.io
cf auth $CF_USER "$CF_PASSWORD" && \
cf target -o $CF_ORG -s $CF_SPACE && \
cf apps
}
function destroy_docker_aws(){
case $DOCKER_AWS in
--docker-aws )
echo "Destroying instance $INSTANCE_ID..."
sh $BUILD_DIRECTORY/docker-aws.sh delete;;
esac
}
case $DOCKER_AWS in
--docker-aws )
export BUILD_DIRECTORY=$( cd `dirname $0` && pwd )
sh $BUILD_DIRECTORY/docker-aws.sh create
source $BUILD_DIRECTORY/docker-aws.sh source
# Add Neo4j
sh $BUILD_DIRECTORY/docker-aws.sh docker "run -d -p 7474:7474 -e NEO4J_AUTH=none --name neo4j neo4j:latest"
# Add MongoDB
sh $BUILD_DIRECTORY/docker-aws.sh docker "run -d -p 27017:27017 --name mongo mongo:latest"
# Add Redis
sh $BUILD_DIRECTORY/docker-aws.sh docker "run -d -p 6379:6379 --name redis redis:latest"
;;
esac
install_python_deps
mvn clean install || destroy_docker_aws || die "'mvn clean install' failed" 1
case $DOCKER_AWS in
--docker-aws )
destroy_docker_aws;;
esac
validate_cf