forked from Teevity/ice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·82 lines (65 loc) · 2.54 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
74
75
76
77
78
79
80
81
82
#!/bin/bash
# Get Ice in a ready-to-run state on a fresh AWI instance.
GRAILS_VERSION=2.2.1
# Install prerequisites
if [ -f /etc/redhat-release ]; then
echo "Installing redhat packages"
sudo yum -y install git java-1.6.0-openjdk-devel.x86_64 wget unzip
else
[ -f /etc/debian-release ];
echo "Installing debian packages"
sudo apt-get -y install git openjdk-6-jdk wget unzip
fi
INSTALL_DIR=$(pwd)
cd
HOME_DIR=$(pwd)
# Prep grails in such a way that we only download it once
if [ ! -x ".grails/wrapper/${GRAILS_VERSION}/grails-${GRAILS_VERSION}" ]; then
mkdir -p .grails/wrapper/
cd .grails/wrapper/
# (Fetch)
wget http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-${GRAILS_VERSION}.zip -O grails-${GRAILS_VERSION}-download.zip
mkdir ${GRAILS_VERSION}
cd ${GRAILS_VERSION}
# ("Install")
unzip ../grails-${GRAILS_VERSION}-download.zip
fi
GRAILS_HOME=${HOME_DIR}/.grails/wrapper/${GRAILS_VERSION}/grails-${GRAILS_VERSION}/
PATH=$PATH:${HOME_DIR}/.grails/wrapper/${GRAILS_VERSION}/grails-${GRAILS_VERSION}/bin/
# Get ice
cd ${INSTALL_DIR}
if [ -x '.git' ]; then
# We already have it; update to latest git
git pull
else
# We don't have it at all yet; clone the repo
git clone https://github.com/Netflix/ice.git
cd ice
INSTALL_DIR=$(pwd)
fi
# Initialize Ice with Grails
grails ${JAVA_OPTS} wrapper
# (Bug: Ice can't deal with this file existing and being empty.)
rm grails-app/i18n/messages.properties
# Create our local work directories (both for processing and reading)
mkdir ${HOME_DIR}/ice_processor
mkdir ${HOME_DIR}/ice_reader
# Set up the config file
cp src/java/sample.properties src/java/ice.properties
echo Please enter the name of the bucket Ice will read Amazon billing information from:
while [ "$BILLBUCKET" == "" ]
do
echo -n "-> "
read -r BILLBUCKET
done
echo Please enter the name of the bucket Ice will write processed billing information to:
while [ "$PROCBUCKET" == "" ]
do
echo -n "-> "
read -r PROCBUCKET
done
sed -rie 's/=billing_s3bucketprefix\//=/; s|\/mnt\/|'"${HOME_DIR}"'\/|; s/=work_s3bucketprefix\//=/; s/^ice.account.*//; s/=billing_s3bucketname1/='${BILLBUCKET}'/; s/=work_s3bucketname/='${PROCBUCKET}'/' src/java/ice.properties
echo Ice is now ready to run as a processor. If you want to run the reader, edit:
echo ~/ice/src/java/ice.properties
echo and alter the appropriate flags. You can now start Ice by running the following from the Ice root directory:
echo ./grailsw -Djava.net.preferIPv4Stack=true -Dice.s3AccessKeyId=\<access key ID\> -Dice.s3SecretKey=\<access key\> run-app