├── .gitignore ├── .travis.yml ├── .travis └── publish.sh ├── LICENSE ├── README.md ├── docker-compose-template.yml ├── ice ├── Dockerfile └── assets │ └── sample.properties ├── init └── ice.conf ├── kubernetes └── deploy │ ├── configmap-ice.yaml │ ├── configmap-nginx.yaml │ ├── deployment.yaml │ └── service.yml └── nginx └── assets └── default.conf /.gitignore: -------------------------------------------------------------------------------- 1 | ice/assets/ice.properties 2 | docker-compose.yml 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | script: 2 | - .travis/publish.sh 3 | -------------------------------------------------------------------------------- /.travis/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | timestamp() { 4 | echo $(date +%b\ %d\ %T) $* 5 | } 6 | 7 | configure_git() { 8 | timestamp Setting up git config... 9 | git config --global push.default matching 10 | git config --global user.email "jbrouse19@gmail.com" 11 | git config --global user.name "Jon Brouse" 12 | git remote rm origin 13 | git remote add origin https://$GH_TOKEN@github.com/jonbrouse/docker-ice.git > /dev/null 2>&1 14 | } 15 | 16 | update_ice_version() { 17 | timestamp Updating Dockerfile and committing... 18 | sed -i "/ENV\ ICE_VERSION/c\ENV\ ICE_VERSION\ $NEW_VERSION" ice/Dockerfile 19 | git commit ice/Dockerfile -m "Updated Ice version to $NEW_VERSION" 20 | } 21 | 22 | update_master() { 23 | timestamp Committing to master... 24 | git checkout -b temp 25 | git branch -f master temp 26 | git push origin master 27 | } 28 | 29 | create_new_tag() { 30 | timestamp Creating release tag... 31 | git tag -m "New version of ICE" "$NEW_VERSION.0" 32 | git push --quiet --set-upstream origin 33 | git push --tags 34 | } 35 | 36 | configure_git 37 | update_ice_version 38 | update_master 39 | create_new_tag 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ice, Ice Baby 2 | 3 | This project leverages Docker to create images that run [Teevity's AWS Usage tool, Ice](https://github.com/Teevity/ice) (formerly Netflix Ice). From [Teevity's Ice repository](https://github.com/Teevity/ice) introduction: 4 | 5 | > Ice provides a birds-eye view of our large and complex cloud landscape 6 | > from a usage and cost perspective. Cloud resources are dynamically 7 | > provisioned by dozens of service teams within the organization and any 8 | > static snapshot of resource allocation has limited value. The ability 9 | > to trend usage patterns on a global scale, yet decompose them down to 10 | > a region, availability zone, or service team provides incredible 11 | > flexibility. Ice allows us to quantify our AWS footprint and to make 12 | > educated decisions regarding reservation purchases and reallocation of 13 | > resources. 14 | > 15 | > Ice is a Grails project. It consists of three parts: processor, reader 16 | > and UI. Processor processes the Amazon detailed billing file into data 17 | > readable by reader. Reader reads data generated by processor and 18 | > renders them to UI. UI queries reader and renders interactive graphs 19 | > and tables in the browser. 20 | 21 | More information and screenshots can be found on the [project's git page](https://github.com/Teevity/ice). 22 | 23 | ## What is this repository? 24 | 25 | This repository seeks to ease the installation and configuration of Ice. In addition to the application container, this repository configures a nginx proxy which also helps fix URI issues I had when accessing Ice directly. After following these directions you should be able to connect to your server's IP address or FQDN over port 80 and access the Ice application. Additionally, I've supplied an Upstart job script you can leverge to start your containers on boot. 26 | 27 | # Getting Started 28 | 29 | ## Prerequisites 30 | 31 | - [Docker](https://docs.docker.com/installation/) and [Docker Compose](https://docs.docker.com/compose/install/) installed. 32 | - Sign up for Amazon's programmatic billing access [here](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/detailed-billing-reports.html) to receive detailed billing(hourly) reports. Verify you receive monthly billing file in the following format: 33 | 34 | ```-aws-billing-detailed-line-items--.csv.zip``` 35 | 36 | 37 | ## Docker Setup 38 | 39 | - Create the docker-compose file: `cp docker-compose-template.yml docker-compose.yml` 40 | - Open docker-compose.yml and configure the Timezone as well as add the AWS Access Key ID and Secret Key that has access to the s3 billing bucket: `vi docker-compose.yml` 41 | 42 | ice: 43 | build: ice 44 | command: | 45 | -Djava.net.preferIPv4Stack=true 46 | -Djava.net.preferIPv4Addresses 47 | -Duser.timezone= 48 | -Dice.s3AccessKeyId= 49 | -Dice.s3SecretKey= 50 | 51 | - Create the configuration file that will be mounted to the container: `cp ice/assets/sample.properties ice/assets/ice.properties` 52 | - Open ice.properties and configure a basic setup by updating the following: `vi ice/assets/ice.properties` 53 | 54 | # s3 bucket name where the billing files are 55 | ice.billing_s3bucketname= 56 | 57 | # location for the billing bucket 58 | ice.billing_s3bucketregion= 59 | 60 | # Your company name 61 | ice.companyName= 62 | 63 | # s3 bucket name where Ice can store output files 64 | ice.work_s3bucketname= 65 | 66 | # Your AWS account number. You can also replace "production" with your own identifier 67 | ice.account.production= 68 | 69 | More information on the configurations can be found on the [project's git page](https://github.com/Teevity/ice). 70 | 71 | ## Docker Compose 72 | 73 | - When you have completed the previous steps, issue `docker-compose up` This will start the containers in the forground so you can see if there are any errors. 74 | - Once everything looks good and you can access the UI issue `docker-compose up -d` to run the containers in the background. 75 | 76 | ## Base Docker Containers 77 | 78 | - The nginx container is pulled from the [official nginx Docker Hub repository](https://registry.hub.docker.com/_/nginx/). 79 | - The Ice container's base image is the [openjdk Java 7 image](https://hub.docker.com/_/openjdk/). 80 | 81 | # Upstart Job 82 | 83 | I've included an Upstart job in the `init` directory of this repository. This will allow you to start the containers with `start ice` and stop them by running `stop ice`. This will also start your containers at boot. 84 | 85 | 1. Copy `init/ice.conf` to your host's `/etc/init/` directory 86 | 2. Edit the the job `vi /etc/init/ice.conf` and change the path to the docker-compose file 87 | 88 | pre-start exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml up -d 89 | 90 | post-stop exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml stop 91 | 92 | 4. Reload the job controller `initctl reload-configuration` 93 | 94 | # Notes 95 | 96 | ## Highstock.js 97 | 98 | The version of highstock.js is locked at 4.2.1 due to a breaking change in newer versions. 99 | 100 | ## OutOfMemory Exception 101 | 102 | To adjust the memory allocation, add the following line to the `docker-compose.yml` file: 103 | 104 | ``` 105 | ... 106 | environment: 107 | - GRAILS_OPTS=-server -Xmx4G -Xms1G -Dfile.encoding=UTF-8 108 | ... 109 | ``` 110 | 111 | ## Docker Run Command 112 | 113 | To launch just the Ice container via the `docker run` command, issue the following: 114 | 115 | ``` 116 | docker run -v `pwd`/ice/assets/ice.properties:/opt/ice/src/java/ice.properties \ 117 | -e GRAILS_OPTS="-server -Xms2g -Xmx2g -server" \ 118 | jonbrouse/ice \ 119 | -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses -Duser.timezone=America/New_York -Dice.s3AccessKeyId=XXXXXXXXXXXXX -Dice.s3SecretKey=XXXXXXXXX run-app 120 | ``` 121 | 122 | ## Kubernetes deployment on AWS 123 | 124 | To deploy ice to a kubernetes cluster running on AWS 125 | 126 | 1. Update [configmap-ice.yaml](./kubernetes/deploy/configmap-ice.yaml) `ice.companyName=`, `ice.billing_s3bucketname=`, `ice.work_s3bucketname=` 127 | 128 | 2. Update [deployment.yaml](./kubernetes/deploy/deployment.yaml) with `-Duser.timezone=`,`- -Dice.s3AccessKeyId=`, `- -Dice.s3SecretKey=` 129 | 130 | 3. Deploy `kubectl apply -f ./kubernetes/deploy/` 131 | 132 | > Make sure to replace the placeholders excluding the \ 133 | -------------------------------------------------------------------------------- /docker-compose-template.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | ice: 4 | build: ice 5 | hostname: ice 6 | image: jonbrouse/ice:latest 7 | command: | 8 | -Djava.net.preferIPv4Stack=true 9 | -Djava.net.preferIPv4Addresses 10 | -Duser.timezone= 11 | -Dice.s3AccessKeyId= 12 | -Dice.s3SecretKey= 13 | run-app 14 | volumes: 15 | - ./ice/assets/ice.properties:/opt/ice/src/java/ice.properties 16 | nginx: 17 | hostname: nginx 18 | image: nginx:1.13.3-alpine 19 | ports: 20 | - "80:80" 21 | links: 22 | - ice:ice 23 | volumes: 24 | - ./nginx/assets/default.conf:/etc/nginx/conf.d/default.conf 25 | -------------------------------------------------------------------------------- /ice/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:alpine 2 | MAINTAINER Jon Brouse @jonbrouse 3 | 4 | ENV INSTALL_DIR /opt/ice 5 | ENV HOME_DIR /root 6 | ENV GRAILS_VERSION 2.4.4 7 | ENV GRAILS_HOME ${HOME_DIR}/.grails/wrapper/${GRAILS_VERSION}/grails-${GRAILS_VERSION} 8 | ENV PATH $PATH:${HOME_DIR}/.grails/wrapper/${GRAILS_VERSION}/grails-${GRAILS_VERSION}/bin/ 9 | 10 | ARG JAVA_OPTS 11 | 12 | WORKDIR ${HOME_DIR}/.grails/wrapper/${GRAILS_VERSION} 13 | 14 | # Install required software 15 | RUN apk add --no-cache bash curl unzip && \ 16 | curl -O http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-${GRAILS_VERSION}.zip && \ 17 | unzip grails-${GRAILS_VERSION}.zip && \ 18 | rm -rf grails-${GRAILS_VERSION}.zip 19 | 20 | WORKDIR ${INSTALL_DIR} 21 | 22 | # Ice setup 23 | RUN mkdir /mnt/ice_processor /mnt/ice_reader && \ 24 | curl -fsSLO https://github.com/jimroth/ice/archive/master.zip && \ 25 | unzip master.zip && \ 26 | mv ice-master/* . && \ 27 | rm -rf master.zip ./ice-master 28 | 29 | RUN grails ${JAVA_OPTS} wrapper && \ 30 | rm grails-app/i18n/messages.properties && \ 31 | sed -i -e '1i#!/bin/bash\' grailsw 32 | 33 | EXPOSE 8080 34 | 35 | ENTRYPOINT ["/opt/ice/grailsw"] 36 | 37 | CMD [] 38 | -------------------------------------------------------------------------------- /ice/assets/sample.properties: -------------------------------------------------------------------------------- 1 | # Some configuration need some value passed into them. 2 | # Do not remove or comment out configurations that have ',' 3 | 4 | # Set to true to start processor 5 | ice.processor=true 6 | 7 | # Set to true to start reader/UI 8 | ice.reader=true 9 | 10 | # s3 bucket to store output files. AWS Credentials must have read/write access to the bucket 11 | ice.work_s3bucketname= 12 | 13 | # Region where the work bucket is located 14 | ice.work_s3bucketregion= 15 | 16 | # Prefix of Ice output files 17 | ice.work_s3bucketprefix=work/ 18 | 19 | # Number of worker threads for CUR processing and reader REST api services (default is 5) 20 | ice.numthreads=5 21 | 22 | ######################## 23 | # Reader configuration # 24 | ######################## 25 | # Set to false to run aggregation only daily, weekly, monthly. 26 | # Allows reader to run with much less memory 27 | ice.hourlyData=true 28 | 29 | # Enable tag coverage metrics: none, basic, withUserTags - uses more memory 30 | # must have at least the coverage specified generated by the processor 31 | ice.tagCoverage=none 32 | 33 | # The highstock url; host it somewhere else and change this if you need HTTPS 34 | ice.highstockUrl=https://code.highcharts.com/stock/4.2.1/highstock.js 35 | 36 | # Your company name to display in the UI 37 | ice.companyName= 38 | 39 | # Local directory for Ice reader (directory must exist) 40 | ice.reader.localDir=/mnt/ice_reader 41 | 42 | # Monthly data cache size for Ice reader 43 | ice.monthlycachesize=12 44 | 45 | # A short alert or notice to place in the header of the dashboard pages 46 | ice.notice= 47 | 48 | ########################### 49 | # Processor configuration # 50 | ########################### 51 | # If running in AWS, whether or not to only run a single processor pass 52 | # will stop instance when done processing 53 | ice.processOnce=false 54 | 55 | # Month to start processing billing files (YYYY-MM) 56 | ice.startMonth=2017-06 57 | 58 | # Local directory for Ice processor (the directory must exist.) 59 | ice.processor.localDir=/mnt/ice_processor 60 | 61 | # Set to true to start reservation capacity poller 62 | ice.reservationCapacityPoller=false 63 | 64 | # Set to true to break out family reservation usage as separate operation type 65 | ice.breakoutFamilyReservationUsage=false 66 | 67 | # Enable the creation of data files that can be imported into services (i.e. ElasticSearch) 68 | # Multiple formats can be specified separated by "," 69 | # - hourly - generate hourly newline delimited JSON records - one record per line 70 | # - hourlyRI - generate hourly newline delimited JSON records with RI rates for product/operations that offer reserved instances 71 | # - daily - generate daily newline delimited JSON records - one record per line 72 | # 73 | ice.writeJsonFiles= 74 | 75 | # Enable tag coverage metrics (uses memory) 76 | # - none 77 | # - basic 78 | # - withUserTags 79 | ice.tagCoverage=none 80 | 81 | # Default reservation period 82 | # - oneyear 83 | # - threeyear 84 | ice.reservationPeriod=oneyear 85 | 86 | # Default reservation utilization 87 | # - HEAVY 88 | # - PARTIAL 89 | ice.reservationUtilization=PARTIAL 90 | 91 | ######################### 92 | # Billing configuration # 93 | ######################### 94 | # For multiple payer accounts and/or if you need both detailed billing and cost and usage reports supported 95 | # you will need to specify multiple values for each property. Multiple are delimited by ",". 96 | 97 | # s3 bucket where the billing files are. AWS Credentials must have read/write access to the bucket 98 | ice.billing_s3bucketname= 99 | 100 | # Region where the billing s3 bucket is located (it should be specified for buckets using v4 validation) 101 | ice.billing_s3bucketregion=us-east-1 102 | 103 | # Prefix of the billing files 104 | ice.billing_s3bucketprefix=, 105 | 106 | # Your payer account id here 107 | #ice.billing_payerAccountId=123456789012,234567890123 108 | ice.billing_payerAccountId=, 109 | 110 | # The assumed role name here if you use IAM role access to read from billing s3 bucket. 111 | # - "ice.billing_accessRoleName=,ice" means assumed role access is only used for the second bucket. 112 | #ice.billing_accessRoleName=,ice 113 | 114 | # External id if you are using one if not you can leave this property unset. 115 | #ice.billing_accessExternalId= 116 | 117 | # Root name for organization used in account parents path. If not set, a root name is not given. Most useful with multiple payer accounts. 118 | #ice.rootName=Org1,Org2 119 | 120 | ####################################################### 121 | # Kubernetes reports enable breakout of costs by tag. # 122 | ####################################################### 123 | # Report config usage is the same as for billing reports above except in this case accountId is optional if cross-account access is not used 124 | #ice.kubernetes_s3bucketname=kubernetes_s3bucketname1,kubernetes_s3bucketname2 125 | #ice.kubernetes_s3bucketregion=eu-west-1,eu-central-1 126 | #ice.kubernetes_s3bucketprefix=, 127 | #ice.kubernetes_accountId=,123456789012 128 | #ice.kubernetes_accessRoleName=,ice 129 | #ice.kubernetes_accessExternalId= 130 | 131 | # Set to true to use blended rates and cost 132 | ice.use_blended= 133 | 134 | # The month in which you switched from using detailed billing reports to cost and usage reports. 135 | # - Format: YYYY-MM 136 | # - Cannot be earlier than 2017-07 137 | # - RDS instance reservation IDs aren't correct in the reports until 2017-10. 138 | ice.costAndUsageStartDate=2017-10 139 | 140 | # Controls when to switch to using NetUnblended values for rate and cost calculations. 141 | # - Cannot be earlier than 2019-01 142 | # - Setting this value will override the "use_blended" flag above 143 | ice.costAndUsageNetUnblendedStartDate=2019-01 144 | 145 | # If NetUnblended is being used, amortization of Upfront RI payments must also include the full EDP discount. Because ICE doesn't use the subscription fee lineitem 146 | # to compute the upfront payments, we must specify discount rate that must be applied to the list price. 147 | # If using CURs starting in 2019-01, the RI amortization and recurring fees are pulled from the DiscountedUsage line items. 148 | # Prior to that, the costs are computed based on the price list data and the edpDiscounts values defined here. 149 | # discount is specified by a comma separated set of start dates at percentage of the form yyyy_mm:%,yyyy_mm:% 150 | ice.edpDiscounts=2019-01:5 151 | 152 | # Specify your custom tags. Multiple tags are delimited by ",". 153 | # - Limit the number of unique value combinations from your custom tags (< 100) otherwise Ice performance will be greatly affected. 154 | # - This list should NOT include aliases that will be consolidated by the tagKey list below. 155 | # - If specified, BasicResourceService will be used to generate resource groups for you. 156 | ice.customTags=. 157 | 158 | # Tags to include for code coverage dashboard 159 | #ice.additionalTags=tag3 160 | 161 | # The following settings are specified in the in the billing data folder as ice_config.json or ice_config.yaml 162 | # - Tag name consolidation/aliasing 163 | # - Tag value consolidation/aliasing 164 | # - Kubernetes configuration 165 | # See ice_config.sample for an example 166 | # 167 | 168 | # Account settings are pulled from the AWS Organizations Service, but can be overridden here for backward compatibility. 169 | # 170 | # change the follow account settings - these are automatically pulled from the organizations API 171 | # an ICE-specific name can be applied by setting the tag "IceName" 172 | #ice.account.account1=123456789011 173 | #ice.account.account2=123456789012 174 | #ice.account.account3=123456789013 175 | 176 | # set reservation owner accounts and the products for which they have reservations 177 | # These can be pulled from the account tag "IceRiProducts". Product names are separated by '+' for tag values (e.g. "ec2+rds") 178 | # possible values are ec2, rds, redshift, es, ec 179 | #ice.owneraccount.account1=ec2,redshift,rds 180 | 181 | # if reservation capacity poller needs to use IAM role to access ec2 API, set the assumed role here for each reservation owner account 182 | # These values can be pulled from the account tag "IceRole" 183 | #ice.owneraccount.account1.role=ice 184 | #ice.owneraccount.account2.role=ice 185 | #ice.owneraccount.account5.role=ice 186 | 187 | # if reservation capacity poller needs to use IAM role to access ec2 API and external id is used, set the external id here for each reservation owner account. otherwise you can leave it unset. 188 | # These values can be pulled from the account tag "IceExternalId" 189 | #ice.owneraccount.account1.externalId= 190 | #ice.owneraccount.account2.externalId= 191 | #ice.owneraccount.account5.externalId= 192 | -------------------------------------------------------------------------------- /init/ice.conf: -------------------------------------------------------------------------------- 1 | description "Ice and Nginx containers" 2 | author "Jon Brouse @jonbrouse github/jonbrouse" 3 | 4 | start on (filesystem and started docker) 5 | stop on runlevel [!2345] 6 | 7 | pre-start exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml up -d 8 | 9 | post-stop exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml stop 10 | -------------------------------------------------------------------------------- /kubernetes/deploy/configmap-ice.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: ice 6 | data: 7 | ice.properties: | 8 | ice.processor=true 9 | ice.reader=true 10 | ice.reservationCapacityPoller=false 11 | ice.reservationPeriod=oneyear 12 | ice.reservationUtilization=HEAVY 13 | ice.highstockUrl=https://code.highcharts.com/stock/4.2.1/highstock.js 14 | ice.urlPrefix= 15 | ice.fromEmail= 16 | ice.ondemandCostAlertThreshold=250 17 | ice.ondemandCostAlertEmails= 18 | ice.billing_s3bucketname= 19 | ice.billing_s3bucketregion= 20 | ice.billing_s3bucketprefix=, 21 | ice.startmillis=1364774400000 22 | ice.companyName= 23 | ice.work_s3bucketname= 24 | ice.work_s3bucketprefix=ice/ 25 | ice.processor.localDir=/mnt/ice_processor 26 | ice.reader.localDir=/mnt/ice_reader 27 | ice.monthlycachesize=12 28 | ice.owneraccount.account1.role=ice 29 | ice.owneraccount.account1.externalId= -------------------------------------------------------------------------------- /kubernetes/deploy/configmap-nginx.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: ice-nginx 6 | data: 7 | default.conf: | 8 | server { 9 | listen 80; 10 | 11 | location = / { 12 | rewrite ^ /ice/dashboard/summary permanent; 13 | } 14 | 15 | location = /ice/ { 16 | rewrite ^ /ice/dashboard/summary permanent; 17 | } 18 | 19 | location = /ice/dashboard/ { 20 | rewrite ^ /ice/dashboard/summary permanent; 21 | } 22 | 23 | location / { 24 | proxy_set_header X-Forwarded-Host $host; 25 | proxy_set_header X-Forwarded-Server $host; 26 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 27 | proxy_pass http://localhost:8080/; 28 | } 29 | 30 | location /ice/dashboard/summary { 31 | proxy_set_header X-Forwarded-Host $host; 32 | proxy_set_header X-Forwarded-Server $host; 33 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 34 | proxy_pass http://localhost:8080/ice/dashboard/summary; 35 | } 36 | 37 | error_page 500 502 503 504 /50x.html; 38 | location = /50x.html { 39 | root /usr/share/nginx/html; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /kubernetes/deploy/deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: ice 6 | spec: 7 | selector: 8 | matchLabels: 9 | app: ice 10 | replicas: 1 11 | strategy: 12 | type: Recreate 13 | template: 14 | metadata: 15 | labels: 16 | app: ice 17 | spec: 18 | volumes: 19 | - name: nginx-vol 20 | configMap: 21 | name: ice-nginx 22 | - name: ice-vol 23 | configMap: 24 | name: ice 25 | terminationGracePeriodSeconds: 10 26 | containers: 27 | - name: nginx 28 | image: nginx:1.13.3-alpine 29 | ports: 30 | - containerPort: 80 31 | imagePullPolicy: IfNotPresent 32 | resources: 33 | limits: 34 | memory: "256Mi" 35 | cpu: "150m" 36 | volumeMounts: 37 | - mountPath: /etc/nginx/conf.d/ 38 | name: nginx-vol 39 | 40 | - name: ice 41 | image: jonbrouse/ice:latest 42 | ports: 43 | - containerPort: 8080 44 | imagePullPolicy: IfNotPresent 45 | env: 46 | - GRAILS_OPTS=-server -Xmx2G -Xms1G -Dfile.encoding=UTF-8 47 | command: 48 | - /opt/ice/grailsw 49 | - -Djava.net.preferIPv4Stack=true 50 | - -Djava.net.preferIPv4Addresses 51 | - -Duser.timezone= 52 | - -Dice.s3AccessKeyId= 53 | - -Dice.s3SecretKey= 54 | - run-app 55 | resources: 56 | limits: 57 | memory: "2048Mi" 58 | cpu: "500m" 59 | volumeMounts: 60 | - mountPath: /opt/ice/src/java/ice.properties 61 | subPath: ice.properties 62 | name: ice-vol 63 | restartPolicy: Always 64 | -------------------------------------------------------------------------------- /kubernetes/deploy/service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: ice 6 | annotations: 7 | service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http 8 | service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0 9 | kubernetes.io/service-name: internal 10 | spec: 11 | type: LoadBalancer 12 | ports: 13 | - name: http 14 | port: 80 15 | protocol: TCP 16 | targetPort: 80 17 | selector: 18 | app: ice -------------------------------------------------------------------------------- /nginx/assets/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | location = / { 5 | rewrite ^ /ice/dashboard/summary permanent; 6 | } 7 | 8 | location = /ice/ { 9 | rewrite ^ /ice/dashboard/summary permanent; 10 | } 11 | 12 | location = /ice/dashboard/ { 13 | rewrite ^ /ice/dashboard/summary permanent; 14 | } 15 | 16 | location / { 17 | proxy_set_header X-Forwarded-Host $host; 18 | proxy_set_header X-Forwarded-Server $host; 19 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 20 | proxy_pass http://ice:8080/; 21 | } 22 | 23 | location /ice/dashboard/summary { 24 | proxy_set_header X-Forwarded-Host $host; 25 | proxy_set_header X-Forwarded-Server $host; 26 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 27 | proxy_pass http://ice:8080/ice/dashboard/summary; 28 | } 29 | 30 | error_page 500 502 503 504 /50x.html; 31 | location = /50x.html { 32 | root /usr/share/nginx/html; 33 | } 34 | } 35 | --------------------------------------------------------------------------------