jonbrouse / docker-ice

A Dockerized version of Ice, Netflix's AWS Usage tool.
Apache License 2.0
169 stars 50 forks source link

Ice, Ice Baby

This project leverages Docker to create images that run Teevity's AWS Usage tool, Ice (formerly Netflix Ice). From Teevity's Ice repository introduction:

Ice provides a birds-eye view of our large and complex cloud landscape from a usage and cost perspective. Cloud resources are dynamically provisioned by dozens of service teams within the organization and any static snapshot of resource allocation has limited value. The ability to trend usage patterns on a global scale, yet decompose them down to a region, availability zone, or service team provides incredible flexibility. Ice allows us to quantify our AWS footprint and to make educated decisions regarding reservation purchases and reallocation of resources.

Ice is a Grails project. It consists of three parts: processor, reader and UI. Processor processes the Amazon detailed billing file into data readable by reader. Reader reads data generated by processor and renders them to UI. UI queries reader and renders interactive graphs and tables in the browser.

More information and screenshots can be found on the project's git page.

What is this repository?

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.

Getting Started

Prerequisites

Docker Setup

More information on the configurations can be found on the project's git page.

Docker Compose

Base Docker Containers

Upstart Job

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.

  1. Copy init/ice.conf to your host's /etc/init/ directory

  2. Edit the the job vi /etc/init/ice.conf and change the path to the docker-compose file

    pre-start exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml up -d
    
    post-stop exec /usr/local/bin/docker-compose -f /path/to/your/docker-compose.yml stop
  3. Reload the job controller initctl reload-configuration

Notes

Highstock.js

The version of highstock.js is locked at 4.2.1 due to a breaking change in newer versions.

OutOfMemory Exception

To adjust the memory allocation, add the following line to the docker-compose.yml file:

...
environment:
- GRAILS_OPTS=-server -Xmx4G -Xms1G -Dfile.encoding=UTF-8
...

Docker Run Command

To launch just the Ice container via the docker run command, issue the following:

docker run -v `pwd`/ice/assets/ice.properties:/opt/ice/src/java/ice.properties \
           -e GRAILS_OPTS="-server -Xms2g -Xmx2g -server" \
           jonbrouse/ice \
           -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses -Duser.timezone=America/New_York -Dice.s3AccessKeyId=XXXXXXXXXXXXX -Dice.s3SecretKey=XXXXXXXXX run-app

Kubernetes deployment on AWS

To deploy ice to a kubernetes cluster running on AWS

  1. Update configmap-ice.yaml ice.companyName=, ice.billing_s3bucketname=<your-s3-detailed-billing-bucket-here>, ice.work_s3bucketname=<your-s3-ice-work-bucket-here>

  2. Update deployment.yaml with -Duser.timezone=<Your Timezone ie America/New_York>,- -Dice.s3AccessKeyId=<s3AccessKeyId>, - -Dice.s3SecretKey=<s3SecretKeyId>

  3. Deploy kubectl apply -f ./kubernetes/deploy/

Make sure to replace the placeholders excluding the \<angle brackets>