Netflix RSS Demo Application

Introduction

  • The software is subdivided into three different server units:
    • Middletier: organizes the rss - data
    • Edge: Frontend, hosts the website
    • Eureka: a REST service, developed by Netflix
  • The RSSFeedReader is used to demonstrate the inspectIT Tool analysing distributed systems
  • In order to have a compact environment, the software has to be ported to Docker
  • Each unit runs in a separate Docker -container

  • The connection between the different components is managed by Docker Link:
    • The containers Edge and Middletier are linked with the Tomcat - Eureka Server
    • The container Edge is linked with Container Middletier
    • Each container image can be builded by an individual Dockerfile.
    • In the meantime the containers can be started by the following commands:
      • docker run -p 8080:8080 --name tomcat --privileged=true tomcat
      • docker run -P -p 9191:9191 --link tomcat:tomcat --name middletier  --hostname middletier  middletier

      • docker run -P -p 9090:9090 --link tomcat:tomcat --link middletier:middletier edge

Architecture (with Agents):

 

The containers are connection via docker -link. Edge and Middletier include a Java Agent, which sends the relevant data to the CMR server. The CMR server aggregates the data and provides the data for the Rich Client.

In the docker-compose script, the host directory including the inspectit-agent.cfg and the other config files is mounted on the container. You do not have to rebuild the project, once you have changed the agent's configuration.

In the the header of the config file, the CMR host must be set as "cmr".

Latest Dockerfiles (with agents):

 

 Docker RSS Edge

FROM java:7
MAINTAINER info.inspectit@novatec-gmbh.de

#declare variable for inspectIT
ENV INSPECTIT_CONFIG_HOME /agent-config

RUN apt-get update && apt-get install -y git wget libgradle-core-java
# forked repository
RUN git clone https://github.com/hora-prediction/recipes-rss

#build the netflix rss reader

WORKDIR /recipes-rss
ENV APP_ENV=dev
RUN ./gradlew clean build

#download the agent
WORKDIR /
RUN wget https://github.com/inspectIT/inspectIT/releases/download/1.6.6.76/inspectit-agent-sun1.5.zip
RUN unzip inspectit-agent-sun*.zip

EXPOSE 9090 9092

#start agent and jar
WORKDIR /recipes-rss

COPY run.sh /run.sh

CMD sh /run.sh




 Docker RSS Middletier
FROM java:7
MAINTAINER info.inspectit@novatec-gmbh.de

#declare variable for inspectIT
ENV INSPECTIT_CONFIG_HOME /agent-config

RUN apt-get update && apt-get install -y git wget libgradle-core-java
# forked repository
RUN git clone https://github.com/hora-prediction/recipes-rss

#build the netflix rss reader

WORKDIR /recipes-rss
ENV APP_ENV=dev
RUN ./gradlew clean build

#download the agent
WORKDIR /
RUN wget https://github.com/inspectIT/inspectIT/releases/download/1.6.6.76/inspectit-agent-sun1.5.zip
RUN unzip inspectit-agent-sun*.zip

EXPOSE 9191 9192

#start agent and jar
WORKDIR /recipes-rss

COPY run.sh /run.sh

CMD sh /run.sh

 Docker RSS Tomcat (Eureka)

FROM inspectit/tomcat:1.6.6.76
MAINTAINER info.inspectit@novatec-gmbh.de

ENV EUREKA_VERSION 1.1.158

RUN apt-get update && apt-get install -y wget openjdk-7-jdk git
WORKDIR /
RUN wget http://repo1.maven.org/maven2/com/netflix/eureka/eureka-server/${EUREKA_VERSION}/eureka-server-${EUREKA_VERSION}.war
RUN cp /eureka-server-${EUREKA_VERSION}.war /usr/local/tomcat/webapps/eureka.war
EXPOSE 8080






 

Docker Compose:

The application can be started by a docker- compose script. (Installation Guide for docker compose)

 

After the installation of docker compose, the connection between containers and the internet failed.

Restarting the docker daemon helped to solve the problem

 

 

 

 

Application with Java Agents

Application without Java Agents

Installation Guide:

  1. Unzip the archive
  2. change into the folder netflixRSSReader*Agents/
  3. To build all files run the command:

    sudo docker-compose build
    Building the eureka service may take a while

     

  4. Under netflixRSSReader*Agents/netflixRSS-edge/config-agent/ and under netflixRSSReader*Agents/netflixRSS-middletier/config-agent/ the config files can be edited.

  5. After configuring the agents, run the following command:

    sudo docker-compose up

    Now the application starts and the different containers connect themselves.

  6.  After a while the RSSReader can be used

    URL for access: http://your-ip:9090/jsp/rss.jsp

    URL for eureka:http://your-ip:8080/eureka

  7. For monitoring the software, please use this clients: LinuxClient / Windows

  8. Open the rich-client, choose the button "new repository" and enter your IP and port
    (For detailed inspectIT documentation, visit the InspectIT homepage)




  9. Afterwards you can choose the desired agent




    and analyse your measurement:

 

  • It is recommended to use min. 4 GB RAM, the consumption of resources is very high
  • Please use the latest version of docker-compose. Otherwise it could be, that the keyword "container_name" in the docker-compose file is unknown

 

Docker Swarm:

The application also works with Docker Swarm:

With docker-machine, you can create several swarm-nodes and a swarm-master managing each node:

Each node is a own virtualbox machine instance.

 

For communication between the different nodes, it is necessary to generate a unique token:

docker run --rm swarm create

 

A node can be created by following command:

docker-machine create -d virtualbox --swarm --swarm-discovery token://YOUR_TOKEN SWARM_NODE_NAME

 

For further documentation please visit:

https://docs.docker.com/swarm/install-w-machine/

 

Now, you can easily start you docker-compose script and swarm. Swarm will choose the optimal node for the containers.

 

 

 

TODO:

  • Application runs in three different containers  DONE
  •  Application can be started by Docker Compose DONE
  • Each container can be monitored by InspectIT DONE