[
  {
    "path": ".gitignore",
    "content": "ice/assets/ice.properties\ndocker-compose.yml\n"
  },
  {
    "path": ".travis/publish.sh",
    "content": "#!/bin/bash\n\ntimestamp() {\n  echo $(date +%b\\ %d\\ %T) $*\n}\n\nconfigure_git() {\n  timestamp Setting up git config...\n  git config --global push.default matching\n  git config --global user.email \"jbrouse19@gmail.com\"\n  git config --global user.name \"Jon Brouse\"\n  git remote rm origin\n  git remote add origin https://$GH_TOKEN@github.com/jonbrouse/docker-ice.git > /dev/null 2>&1\n}\n\nupdate_ice_version() {\n  timestamp Updating Dockerfile and committing...\n  sed -i \"/ENV\\ ICE_VERSION/c\\ENV\\ ICE_VERSION\\ $NEW_VERSION\" ice/Dockerfile\n  git commit ice/Dockerfile -m \"Updated Ice version to $NEW_VERSION\"\n}\n\nupdate_master() {\n  timestamp Committing to master...\n  git checkout -b temp\n  git branch -f master temp\n  git push origin master\n}\n\ncreate_new_tag() {\n  timestamp Creating release tag...\n  git tag -m \"New version of ICE\" \"$NEW_VERSION.0\"\n  git push --quiet --set-upstream origin\n  git push --tags\n}\n\nconfigure_git\nupdate_ice_version\nupdate_master\ncreate_new_tag\n"
  },
  {
    "path": ".travis.yml",
    "content": "script:\n  - .travis/publish.sh\n"
  },
  {
    "path": "LICENSE",
    "content": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n"
  },
  {
    "path": "README.md",
    "content": "# Ice, Ice Baby \n\nThis 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:\n\n> Ice provides a birds-eye view of our large and complex cloud landscape\n> from a usage and cost perspective. Cloud resources are dynamically\n> provisioned by dozens of service teams within the organization and any\n> static snapshot of resource allocation has limited value. The ability\n> to trend usage patterns on a global scale, yet decompose them down to\n> a region, availability zone, or service team provides incredible\n> flexibility. Ice allows us to quantify our AWS footprint and to make\n> educated decisions regarding reservation purchases and reallocation of\n> resources.\n> \n> Ice is a Grails project. It consists of three parts: processor, reader\n> and UI. Processor processes the Amazon detailed billing file into data\n> readable by reader. Reader reads data generated by processor and\n> renders them to UI. UI queries reader and renders interactive graphs\n> and tables in the browser.\n\nMore information and screenshots can be found on the [project's git page](https://github.com/Teevity/ice). \n\n## What is this repository?\n\nThis 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.\n\n# Getting Started\n\n## Prerequisites \n\n - [Docker](https://docs.docker.com/installation/) and [Docker Compose](https://docs.docker.com/compose/install/) installed.\n - 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: \n \n ```<accountid>-aws-billing-detailed-line-items-<year>-<month>.csv.zip```\n\n\n## Docker Setup\n\n - Create the docker-compose file: `cp docker-compose-template.yml docker-compose.yml` \n - 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`\n\n\t    ice:\n\t      build: ice\n\t      command: |\n\t        -Djava.net.preferIPv4Stack=true\n\t        -Djava.net.preferIPv4Addresses\n\t        -Duser.timezone=<Your Timezone ie America/New_York>\n\t        -Dice.s3AccessKeyId=<s3AccessKeyId>\n\t        -Dice.s3SecretKey=<s3SecretKeyId>\n       \n - Create the configuration file that will be mounted to the container: `cp ice/assets/sample.properties ice/assets/ice.properties`\n - Open ice.properties and configure a basic setup by updating the following: `vi ice/assets/ice.properties` \n    \n\t    # s3 bucket name where the billing files are\n\t    ice.billing_s3bucketname=\n\n\t    # location for the billing bucket\n\t    ice.billing_s3bucketregion=\n\t    \n\t    # Your company name\n\t    ice.companyName=\n\t    \n\t    # s3 bucket name where Ice can store output files\n\t    ice.work_s3bucketname=\n\t    \n\t    # Your AWS account number. You can also replace \"production\" with your own identifier \n\t    ice.account.production=\n\nMore information on the configurations can be found on the [project's git page](https://github.com/Teevity/ice). \n\n## Docker Compose\n\n - 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.\n - Once everything looks good and you can access the UI issue `docker-compose up -d` to run the containers in the background.\n\n## Base Docker Containers\n\n- The nginx container is pulled from the [official nginx Docker Hub repository](https://registry.hub.docker.com/_/nginx/).\n- The Ice container's base image is the [openjdk Java 7 image](https://hub.docker.com/_/openjdk/).\n\n# Upstart Job\n\nI'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.\n\n1. Copy `init/ice.conf` to your host's `/etc/init/` directory\n2. Edit the the job `vi /etc/init/ice.conf` and change the path to the docker-compose file\n\t\n\t    pre-start exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml up -d\n\n\t\tpost-stop exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml stop\n\n4. Reload the job controller `initctl reload-configuration`\n\n# Notes\n\n## Highstock.js\n\nThe version of highstock.js is locked at 4.2.1 due to a breaking change in newer versions.\n\n## OutOfMemory Exception\n\nTo adjust the memory allocation, add the following line to the `docker-compose.yml` file:\n\n```\n...\nenvironment:\n- GRAILS_OPTS=-server -Xmx4G -Xms1G -Dfile.encoding=UTF-8\n...\n```\n\n## Docker Run Command\n\nTo launch just the Ice container via the `docker run` command, issue the following:\n\n```\ndocker run -v `pwd`/ice/assets/ice.properties:/opt/ice/src/java/ice.properties \\\n           -e GRAILS_OPTS=\"-server -Xms2g -Xmx2g -server\" \\\n           jonbrouse/ice \\\n           -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses -Duser.timezone=America/New_York -Dice.s3AccessKeyId=XXXXXXXXXXXXX -Dice.s3SecretKey=XXXXXXXXX run-app\n```\n\n## Kubernetes deployment on AWS\n\nTo deploy ice to a kubernetes cluster running on AWS\n\n1. Update [configmap-ice.yaml](./kubernetes/deploy/configmap-ice.yaml) `ice.companyName=`, `ice.billing_s3bucketname=<your-s3-detailed-billing-bucket-here>`, `ice.work_s3bucketname=<your-s3-ice-work-bucket-here>`\n\n2. Update [deployment.yaml](./kubernetes/deploy/deployment.yaml) with `-Duser.timezone=<Your Timezone ie America/New_York>`,`- -Dice.s3AccessKeyId=<s3AccessKeyId>`, `- -Dice.s3SecretKey=<s3SecretKeyId>`\n\n3. Deploy `kubectl apply -f ./kubernetes/deploy/`\n\n> Make sure to replace the placeholders excluding the \\<angle brackets\\>\n"
  },
  {
    "path": "docker-compose-template.yml",
    "content": "version: '3'\nservices:\n  ice:\n    build: ice\n    hostname: ice\n    image: jonbrouse/ice:latest\n    command: |\n      -Djava.net.preferIPv4Stack=true\n      -Djava.net.preferIPv4Addresses\n      -Duser.timezone=<Your Timezone ie America/New_York>\n      -Dice.s3AccessKeyId=<s3AccessKeyId>\n      -Dice.s3SecretKey=<s3SecretKeyId>\n      run-app\n    volumes:\n      - ./ice/assets/ice.properties:/opt/ice/src/java/ice.properties\n  nginx:\n    hostname: nginx\n    image: nginx:1.13.3-alpine\n    ports:\n      - \"80:80\"\n    links:\n      - ice:ice\n    volumes:\n      - ./nginx/assets/default.conf:/etc/nginx/conf.d/default.conf\n"
  },
  {
    "path": "ice/Dockerfile",
    "content": "FROM openjdk:alpine\nMAINTAINER Jon Brouse @jonbrouse\n\nENV INSTALL_DIR /opt/ice\nENV HOME_DIR /root\nENV GRAILS_VERSION 2.4.4\nENV GRAILS_HOME ${HOME_DIR}/.grails/wrapper/${GRAILS_VERSION}/grails-${GRAILS_VERSION}\nENV PATH $PATH:${HOME_DIR}/.grails/wrapper/${GRAILS_VERSION}/grails-${GRAILS_VERSION}/bin/\n\nARG JAVA_OPTS\n\nWORKDIR ${HOME_DIR}/.grails/wrapper/${GRAILS_VERSION}\n\n# Install required software\nRUN apk add --no-cache bash curl unzip && \\\n    curl -O http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-${GRAILS_VERSION}.zip && \\\n    unzip grails-${GRAILS_VERSION}.zip && \\\n    rm -rf grails-${GRAILS_VERSION}.zip\n\nWORKDIR ${INSTALL_DIR} \n\n# Ice setup\nRUN mkdir /mnt/ice_processor /mnt/ice_reader && \\\n    curl -fsSLO https://github.com/jimroth/ice/archive/master.zip && \\\n    unzip master.zip && \\\n    mv ice-master/* . && \\\n    rm -rf master.zip ./ice-master\n\nRUN grails ${JAVA_OPTS} wrapper && \\\n    rm grails-app/i18n/messages.properties && \\\n    sed -i -e '1i#!/bin/bash\\' grailsw\n\nEXPOSE 8080\n\nENTRYPOINT [\"/opt/ice/grailsw\"]\n\nCMD []\n"
  },
  {
    "path": "ice/assets/sample.properties",
    "content": "# Some configuration need some value passed into them.\n# Do not remove or comment out configurations that have ',' \n\n# Set to true to start processor\nice.processor=true\n\n# Set to true to start reader/UI\nice.reader=true\n\n# s3 bucket to store output files. AWS Credentials must have read/write access to the bucket\nice.work_s3bucketname=<work-s3-bucket-name>\n\n# Region where the work bucket is located\nice.work_s3bucketregion=<work-s3-bucket-region>\n\n# Prefix of Ice output files\nice.work_s3bucketprefix=work/\n\n# Number of worker threads for CUR processing and reader REST api services (default is 5)\nice.numthreads=5\n\n########################\n# Reader configuration #\n########################\n# Set to false to run aggregation only daily, weekly, monthly.\n# Allows reader to run with much less memory\nice.hourlyData=true\n\n# Enable tag coverage metrics: none, basic, withUserTags - uses more memory\n# must have at least the coverage specified generated by the processor\nice.tagCoverage=none\n\n# The highstock url; host it somewhere else and change this if you need HTTPS\nice.highstockUrl=https://code.highcharts.com/stock/4.2.1/highstock.js\n\n# Your company name to display in the UI\nice.companyName=<your company name>\n\n# Local directory for Ice reader (directory must exist)\nice.reader.localDir=/mnt/ice_reader\n\n# Monthly data cache size for Ice reader\nice.monthlycachesize=12\n\n# A short alert or notice to place in the header of the dashboard pages\nice.notice=\n\n###########################\n# Processor configuration #\n###########################\n# If running in AWS, whether or not to only run a single processor pass\n# will stop instance when done processing\nice.processOnce=false\n\n# Month to start processing billing files (YYYY-MM)\nice.startMonth=2017-06\n\n# Local directory for Ice processor (the directory must exist.)\nice.processor.localDir=/mnt/ice_processor\n\n# Set to true to start reservation capacity poller\nice.reservationCapacityPoller=false\n\n# Set to true to break out family reservation usage as separate operation type\nice.breakoutFamilyReservationUsage=false\n\n# Enable the creation of data files that can be imported into services (i.e. ElasticSearch)\n# Multiple formats can be specified separated by \",\"\n#  - hourly - generate hourly newline delimited JSON records - one record per line\n#  - hourlyRI - generate hourly newline delimited JSON records with RI rates for product/operations that offer reserved instances\n#  - daily - generate daily newline delimited JSON records - one record per line\n# \nice.writeJsonFiles=\n\n# Enable tag coverage metrics (uses memory)\n#  - none\n#  - basic\n#  - withUserTags\nice.tagCoverage=none\n\n# Default reservation period\n# - oneyear\n# - threeyear\nice.reservationPeriod=oneyear\n\n# Default reservation utilization\n# - HEAVY\n# - PARTIAL\nice.reservationUtilization=PARTIAL\n\n#########################\n# Billing configuration #\n#########################\n# For multiple payer accounts and/or if you need both detailed billing and cost and usage reports supported\n# you will need to specify multiple values for each property. Multiple are delimited by \",\".\n\n# s3 bucket where the billing files are. AWS Credentials must have read/write access to the bucket\nice.billing_s3bucketname=<billing-s3-bucket-name>\n\n# Region where the billing s3 bucket is located (it should be specified for buckets using v4 validation)\nice.billing_s3bucketregion=us-east-1\n\n# Prefix of the billing files\nice.billing_s3bucketprefix=,\n\n# Your payer account id here\n#ice.billing_payerAccountId=123456789012,234567890123\nice.billing_payerAccountId=,\n\n# The assumed role name here if you use IAM role access to read from billing s3 bucket.\n# - \"ice.billing_accessRoleName=,ice\" means assumed role access is only used for the second bucket.\n#ice.billing_accessRoleName=,ice\n\n# External id if you are using one if not you can leave this property unset.\n#ice.billing_accessExternalId=\n\n# Root name for organization used in account parents path. If not set, a root name is not given. Most useful with multiple payer accounts.\n#ice.rootName=Org1,Org2\n\n#######################################################\n# Kubernetes reports enable breakout of costs by tag. #\n#######################################################\n# 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\n#ice.kubernetes_s3bucketname=kubernetes_s3bucketname1,kubernetes_s3bucketname2\n#ice.kubernetes_s3bucketregion=eu-west-1,eu-central-1\n#ice.kubernetes_s3bucketprefix=,\n#ice.kubernetes_accountId=,123456789012\n#ice.kubernetes_accessRoleName=,ice\n#ice.kubernetes_accessExternalId=\n\n# Set to true to use blended rates and cost\nice.use_blended=\n\n# The month in which you switched from using detailed billing reports to cost and usage reports.\n# - Format: YYYY-MM\n# - Cannot be earlier than 2017-07\n# - RDS instance reservation IDs aren't correct in the reports until 2017-10.\nice.costAndUsageStartDate=2017-10\n\n# Controls when to switch to using NetUnblended values for rate and cost calculations.\n# - Cannot be earlier than 2019-01\n# - Setting this value will override the \"use_blended\" flag above\nice.costAndUsageNetUnblendedStartDate=2019-01\n\n# 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\n# to compute the upfront payments, we must specify discount rate that must be applied to the list price.\n# If using CURs starting in 2019-01, the RI amortization and recurring fees are pulled from the DiscountedUsage line items.\n# Prior to that, the costs are computed based on the price list data and the edpDiscounts values defined here.\n# discount is specified by a comma separated set of start dates at percentage of the form yyyy_mm:%,yyyy_mm:%\nice.edpDiscounts=2019-01:5\n\n# Specify your custom tags. Multiple tags are delimited by \",\". \n# - Limit the number of unique value combinations from your custom tags (< 100) otherwise Ice performance will be greatly affected.\n# - This list should NOT include aliases that will be consolidated by the tagKey list below.\n# - If specified, BasicResourceService will be used to generate resource groups for you.\nice.customTags=<custom-tag-1>.<custom-tag-2>\n\n# Tags to include for code coverage dashboard\n#ice.additionalTags=tag3\n\n# The following settings are specified in the in the billing data folder as ice_config.json or ice_config.yaml\n#  - Tag name consolidation/aliasing\n#  - Tag value consolidation/aliasing\n#  - Kubernetes configuration\n# See ice_config.sample for an example\n#\n\n# Account settings are pulled from the AWS Organizations Service, but can be overridden here for backward compatibility.\n#\n# change the follow account settings - these are automatically pulled from the organizations API\n#   an ICE-specific name can be applied by setting the tag \"IceName\"\n#ice.account.account1=123456789011\n#ice.account.account2=123456789012\n#ice.account.account3=123456789013\n\n# set reservation owner accounts and the products for which they have reservations\n#   These can be pulled from the account tag \"IceRiProducts\". Product names are separated by '+' for tag values (e.g. \"ec2+rds\")\n# possible values are ec2, rds, redshift, es, ec\n#ice.owneraccount.account1=ec2,redshift,rds\n\n# if reservation capacity poller needs to use IAM role to access ec2 API, set the assumed role here for each reservation owner account\n# These values can be pulled from the account tag \"IceRole\"\n#ice.owneraccount.account1.role=ice\n#ice.owneraccount.account2.role=ice\n#ice.owneraccount.account5.role=ice\n\n# 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.\n# These values can be pulled from the account tag \"IceExternalId\"\n#ice.owneraccount.account1.externalId=\n#ice.owneraccount.account2.externalId=\n#ice.owneraccount.account5.externalId=\n"
  },
  {
    "path": "init/ice.conf",
    "content": "description \"Ice and Nginx containers\"\nauthor \"Jon Brouse @jonbrouse github/jonbrouse\"\n\nstart on (filesystem and started docker)\nstop on runlevel [!2345]\n\npre-start exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml up -d\n\npost-stop exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml stop\n"
  },
  {
    "path": "kubernetes/deploy/configmap-ice.yaml",
    "content": "---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: ice\ndata:\n  ice.properties: |\n    ice.processor=true\n    ice.reader=true\n    ice.reservationCapacityPoller=false\n    ice.reservationPeriod=oneyear\n    ice.reservationUtilization=HEAVY\n    ice.highstockUrl=https://code.highcharts.com/stock/4.2.1/highstock.js\n    ice.urlPrefix=\n    ice.fromEmail=\n    ice.ondemandCostAlertThreshold=250\n    ice.ondemandCostAlertEmails=\n    ice.billing_s3bucketname=<your-s3-detailed-billing-bucket-here>\n    ice.billing_s3bucketregion=\n    ice.billing_s3bucketprefix=,\n    ice.startmillis=1364774400000\n    ice.companyName=\n    ice.work_s3bucketname=<your-s3-ice-work-bucket-here>\n    ice.work_s3bucketprefix=ice/\n    ice.processor.localDir=/mnt/ice_processor\n    ice.reader.localDir=/mnt/ice_reader\n    ice.monthlycachesize=12\n    ice.owneraccount.account1.role=ice\n    ice.owneraccount.account1.externalId="
  },
  {
    "path": "kubernetes/deploy/configmap-nginx.yaml",
    "content": "---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: ice-nginx\ndata:\n  default.conf: |\n    server {\n      listen       80;\n\n      location = / {\n        rewrite ^ /ice/dashboard/summary permanent;\n      }\n\n      location = /ice/ {\n        rewrite ^ /ice/dashboard/summary permanent;\n      }\n\n      location = /ice/dashboard/ {\n        rewrite ^ /ice/dashboard/summary permanent;\n      }\n\n    location / {\n        proxy_set_header X-Forwarded-Host $host;\n        proxy_set_header X-Forwarded-Server $host;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_pass http://localhost:8080/;\n      }\n\n      location /ice/dashboard/summary {\n        proxy_set_header X-Forwarded-Host $host;\n        proxy_set_header X-Forwarded-Server $host;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_pass http://localhost:8080/ice/dashboard/summary;\n      }\n\n      error_page   500 502 503 504  /50x.html;\n      location = /50x.html {\n        root   /usr/share/nginx/html;\n      }\n    }\n"
  },
  {
    "path": "kubernetes/deploy/deployment.yaml",
    "content": "---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: ice\nspec:\n  selector:\n    matchLabels:\n      app: ice\n  replicas: 1\n  strategy:\n    type: Recreate\n  template:\n    metadata:\n      labels:\n        app: ice\n    spec:        \n      volumes:\n        - name: nginx-vol\n          configMap:\n            name: ice-nginx\n        - name: ice-vol\n          configMap:\n            name: ice\n      terminationGracePeriodSeconds: 10\n      containers:\n        - name: nginx\n          image: nginx:1.13.3-alpine\n          ports:\n            - containerPort: 80\n          imagePullPolicy: IfNotPresent  \n          resources:\n            limits:\n              memory: \"256Mi\"\n              cpu: \"150m\"\n          volumeMounts:\n            - mountPath: /etc/nginx/conf.d/\n              name: nginx-vol\n        \n        - name: ice\n          image: jonbrouse/ice:latest\n          ports:\n            - containerPort: 8080\n          imagePullPolicy: IfNotPresent\n          env:\n            - GRAILS_OPTS=-server -Xmx2G -Xms1G -Dfile.encoding=UTF-8\n          command:\n            - /opt/ice/grailsw\n            - -Djava.net.preferIPv4Stack=true\n            - -Djava.net.preferIPv4Addresses\n            - -Duser.timezone=<Your Timezone ie America/New_York>\n            - -Dice.s3AccessKeyId=<s3AccessKeyId>\n            - -Dice.s3SecretKey=<s3SecretKeyId>\n            - run-app\n          resources:\n            limits:\n              memory: \"2048Mi\"\n              cpu: \"500m\"\n          volumeMounts:\n            - mountPath: /opt/ice/src/java/ice.properties\n              subPath: ice.properties\n              name: ice-vol\n      restartPolicy: Always\n"
  },
  {
    "path": "kubernetes/deploy/service.yml",
    "content": "---\napiVersion: v1\nkind: Service\nmetadata:\n  name: ice\n  annotations:\n    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http\n    service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0\n    kubernetes.io/service-name: internal\nspec:\n  type: LoadBalancer\n  ports:\n    - name: http\n      port: 80\n      protocol: TCP\n      targetPort: 80\n  selector:\n    app: ice"
  },
  {
    "path": "nginx/assets/default.conf",
    "content": "server {\n    listen       80;\n\n    location = / {\n\trewrite ^ /ice/dashboard/summary permanent;\n    }\n\n    location = /ice/ {\n\trewrite ^ /ice/dashboard/summary permanent;\n    }\n\n    location = /ice/dashboard/ {\n\trewrite ^ /ice/dashboard/summary permanent;\n    }\n\n   location / {\n        proxy_set_header X-Forwarded-Host $host;\n        proxy_set_header X-Forwarded-Server $host;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_pass http://ice:8080/;\n    }\n\n    location /ice/dashboard/summary {\n        proxy_set_header X-Forwarded-Host $host;\n        proxy_set_header X-Forwarded-Server $host;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_pass http://ice:8080/ice/dashboard/summary;\n    }\n\n    error_page   500 502 503 504  /50x.html;\n    location = /50x.html {\n        root   /usr/share/nginx/html;\n    }\n}\n"
  }
]