Skip to content

Commit eb33426

Browse files
committed
Merge branch 'integration'
* integration: Fixed the path of the generated ice.properties file in the instructions shown at the end of the install.sh script Do not fail in install.sh if the "message.properties" file has already been deleted Do not fail in install.sh if the local work directories already exists Force the install.sh script to exit if an error occur Add a syntax validation on install.sh in the Travis CI testing process Fixed OS detection in install.sh Add support for localized billing accounts Fix Grails version in URL Update README with reference to ice.config.location Allow extra configuration file Add us-east-1f support minor fixes Highstock CDN supports HTTPS now, let's use it by default Continue grouping resources even if ResourceId is missing Parse services with '/'. Fixes #100 Upgrade to Grails 2.4.4
2 parents e8afb5b + d075c99 commit eb33426

File tree

16 files changed

+68
-32
lines changed

16 files changed

+68
-32
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ install:
1111
- yes | ./grailsw refresh-dependencies
1212

1313
script:
14+
- bash -n install.sh
1415
- ./grailsw compile

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Using basic setup, you don't need any extra code change and you will use the pro
126126
# Specify your currency conversion rate here. The default value is 1. If 1 pound = 1.5 dollar, then the rate is 0.6666667.
127127
ice.currencyRate=0.6666667
128128

129-
2.8 By default, Ice pulls in [Highstock](http://www.highcharts.com/) from its CDN. This CDN, unfortunately, does not (at present) support HTTPS. If you're serving Ice over HTTPS, your browser shouldn't or won't download Highstock from there. To fix this, you can serve Highstock somewhere else, and set this property:
129+
2.8 By default, Ice pulls in [Highstock](https://www.highcharts.com/) from its CDN.
130130

131131
ice.highstockUrl=https://example.com/js/highstock.js
132132

@@ -263,6 +263,12 @@ Options with * require writing your own code.
263263

264264
ice.use_blended=true
265265

266+
10. Extra Grails configuration file
267+
268+
If you need to setup custom Grails settings, you can specify an additional configuration file to be loaded by Grails by setting the ``ice.config.location`` system property to the location of that file.
269+
270+
See http://docs.grails.org/2.4.4/guide/single.html#configExternalized for more information.
271+
266272
## Example IAM Permissions
267273

268274
Grant the following permissions to either an instance role, or the user running the reports:

grails-app/conf/Config.groovy

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
// locations to search for config files that get merged into the main config
1818
// config files can either be Java properties files or ConfigSlurper scripts
1919

20-
grails.config.locations = [
20+
grails.config.locations = []
2121

22-
]
23-
24-
// if(System.properties["${appName}.config.location"]) {
25-
// grails.config.locations << "file:" + System.properties["${appName}.config.location"]
26-
// }
22+
if(System.properties["${appName}.config.location"]) {
23+
grails.config.locations << "file:" + System.properties["${appName}.config.location"]
24+
}
2725

2826
grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination
2927
grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format

install.sh

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
#!/bin/bash
22

3+
# Exit the script if an error occur
4+
set -e
5+
36
# Get Ice in a ready-to-run state on a fresh AWI instance.
47

5-
GRAILS_VERSION=2.2.1
8+
GRAILS_VERSION=2.4.4
69

710
# Install prerequisites
8-
911
if [ -f /etc/redhat-release ]; then
1012
echo "Installing redhat packages"
11-
sudo yum -y install git java-1.6.0-openjdk-devel.x86_64 wget unzip
12-
else
13-
[ -f /etc/debian-release ];
13+
sudo yum -y install git java-1.7.0-openjdk-devel.x86_64 wget unzip
14+
15+
elif [[ -f /etc/debian-release || -f /etc/debian_version ]];then
1416
echo "Installing debian packages"
15-
sudo apt-get -y install git openjdk-6-jdk wget unzip
17+
sudo apt-get -y install git openjdk-7-jdk wget unzip
18+
19+
elif [[ -f /etc/issue && $(grep "Amazon Linux AMI" /etc/issue) ]]; then
20+
echo "Assuming AWS AMI, installing packages"
21+
sudo yum -y install git java-1.7.0-openjdk-devel.x86_64 wget unzip
22+
23+
else
24+
echo "Unknown operating system. You may have to install Java 7 manually."
1625
fi
1726

1827
INSTALL_DIR=$(pwd)
@@ -53,11 +62,11 @@ fi
5362
grails ${JAVA_OPTS} wrapper
5463

5564
# (Bug: Ice can't deal with this file existing and being empty.)
56-
rm grails-app/i18n/messages.properties
65+
rm -f grails-app/i18n/messages.properties
5766

5867
# Create our local work directories (both for processing and reading)
59-
mkdir ${HOME_DIR}/ice_processor
60-
mkdir ${HOME_DIR}/ice_reader
68+
mkdir -p ${HOME_DIR}/ice_processor
69+
mkdir -p ${HOME_DIR}/ice_reader
6170

6271
# Set up the config file
6372
cp src/java/sample.properties src/java/ice.properties
@@ -74,9 +83,9 @@ do
7483
echo -n "-> "
7584
read -r PROCBUCKET
7685
done
77-
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
86+
sed -ri '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
7887

7988
echo Ice is now ready to run as a processor. If you want to run the reader, edit:
80-
echo ~/ice/src/java/ice.properties
89+
echo "${INSTALL_DIR}/src/java/ice.properties"
8190
echo and alter the appropriate flags. You can now start Ice by running the following from the Ice root directory:
8291
echo ./grailsw -Djava.net.preferIPv4Stack=true -Dice.s3AccessKeyId=\<access key ID\> -Dice.s3SecretKey=\<access key\> run-app

src/java/com/netflix/ice/basic/BasicDataManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public ReadOnlyData load(DateTime monthDate) throws Exception {
6565
public BasicDataManager(Product product, ConsolidateType consolidateType, boolean isCost) {
6666
this.product = product;
6767
this.consolidateType = consolidateType;
68-
this.dbName = (isCost ? "cost_" : "usage_") + consolidateType + "_" + (product == null ? "all" : product.name);
68+
this.dbName = (isCost ? "cost_" : "usage_") + consolidateType + "_" + (product == null ? "all" : product.s3Name);
6969

7070
start(300);
7171
}

src/java/com/netflix/ice/basic/BasicLineItemProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ else if (result == Result.monthly) {
204204
}
205205

206206
double resourceCostValue = costValue;
207-
if (items.length > resourceIndex && !StringUtils.isEmpty(items[resourceIndex]) && config.resourceService != null) {
207+
if (items.length > resourceIndex && config.resourceService != null) {
208208

209209
if (config.useCostForResourceGroup.equals("modeled") && product == Product.ec2_instance)
210210
operation = Operation.getReservedInstances(config.reservationService.getDefaultReservationUtilization(0L));

src/java/com/netflix/ice/basic/BasicManagers.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.netflix.ice.processor.TagGroupWriter;
2626
import com.netflix.ice.reader.*;
2727
import com.netflix.ice.tag.Product;
28+
import com.netflix.ice.tag.Tag;
2829

2930
import java.util.Collection;
3031
import java.util.Map;
@@ -99,6 +100,7 @@ private void doWork() {
99100
}
100101
else {
101102
String name = key.substring((config.workS3BucketPrefix + TagGroupWriter.DB_PREFIX).length());
103+
name = Tag.fromS3(name);
102104
product = config.productService.getProductByName(name);
103105
}
104106
if (!products.contains(product)) {

src/java/com/netflix/ice/basic/BasicTagGroupManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class BasicTagGroupManager extends Poller implements TagGroupManager {
4848
private Interval totalInterval;
4949

5050
BasicTagGroupManager(Product product) {
51-
this.dbName = TagGroupWriter.DB_PREFIX + (product == null ? "all" : product.name);
51+
this.dbName = TagGroupWriter.DB_PREFIX + (product == null ? "all" : product.s3Name);
5252
file = new File(config.localDir, dbName);
5353
try {
5454
poll();

src/java/com/netflix/ice/common/AwsUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
*/
5050
public class AwsUtils {
5151
private final static Logger logger = LoggerFactory.getLogger(AwsUtils.class);
52-
private static Pattern billingFileWithTagsPattern = Pattern.compile(".+-aws-billing-detailed-line-items-with-resources-and-tags-(\\d\\d\\d\\d-\\d\\d).csv.zip");
53-
private static Pattern billingFileWithMonitoringPattern = Pattern.compile(".+-aws-billing-detailed-line-items-with-monitoring-(\\d\\d\\d\\d-\\d\\d).csv");
54-
private static Pattern billingFilePattern = Pattern.compile(".+-aws-billing-detailed-line-items-(\\d\\d\\d\\d-\\d\\d).csv.zip");
52+
private static Pattern billingFileWithTagsPattern = Pattern.compile(".+-aws-billing-detailed-line-items-with-resources-and-tags-(?:[A-Z]+-)?(\\d\\d\\d\\d-\\d\\d).csv.zip");
53+
private static Pattern billingFileWithMonitoringPattern = Pattern.compile(".+-aws-billing-detailed-line-items-with-monitoring-(?:[A-Z]+-)?(\\d\\d\\d\\d-\\d\\d).csv");
54+
private static Pattern billingFilePattern = Pattern.compile(".+-aws-billing-detailed-line-items-(?:[A-Z]+-)?(\\d\\d\\d\\d-\\d\\d).csv.zip");
5555
public static final DateTimeFormatter monthDateFormat = DateTimeFormat.forPattern("yyyy-MM").withZone(DateTimeZone.UTC);
5656
public static final DateTimeFormatter dayDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd").withZone(DateTimeZone.UTC);
5757
public static final DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HHa").withZone(DateTimeZone.UTC);

src/java/com/netflix/ice/common/IceOptions.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public class IceOptions {
4040
public static final String CURRENCY_RATE = "ice.currencyRate";
4141

4242
/**
43-
* The URL of highstock.js. The default value is the Highcharts CDN; change this if you need to
44-
* serve it from somewhere else (for example, if you need HTTPS).
43+
* The URL of highstock.js. The default value is the Highcharts CDN (HTTPS)
4544
*/
4645
public static final String HIGHSTOCK_URL = "ice.highstockUrl";
4746

0 commit comments

Comments
 (0)