Giter VIP home page Giter VIP logo

docker-tomcat-newrelic-java's Introduction

Docker-tomcat-NewRelic-Java

New Relic & Docker

Use this repository to get New Relic Java Agent integrated with a container built with google jib.

NOTE: This is a simple tutorial that entails a Dockerfile and a docker run command to bake New Relic Java Agent into the google jib plugin.

You will require the following two things to get started:

  1. You will need an official license from New Relic SaaS UI: rpm.newrelic.com/accounts/xxxxxx (If you don't have a New Relic Account, sign up for a trial on New Relic Sign Up Page!
  2. Use the official google jib plugin - jib-maven-plugin.

Once you have the above two sorted, you can proceed with the following:

STEP 1. Install Docker on your host - I used the free SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux for testing purposes

STEP 2. Once Docker is up and running, use the Dockerfile attached in this Github Repo to create a local tomcat image that entails New Relic Java Agent. You may build the container with this command - docker build -t distroless-newrelic

STEP 3. Once the container image is ready, you can add it to your maven build process with the jib plugin:

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>0.10.0</version><!-- Don't forget to check for newer version -->
    <configuration>
        <to>
            <image>${project.artifactId}</image>
        </to>
        <from>
            <image>distroless-newrelic</image>
        </from>
        <container>
            <jvmFlags>
                <jvmFlag>-Dnewrelic.config.license_key=<!--unique_newrelic_license_key--></jvmFlag>
                <jvmFlag>-Dnewrelic.config.distributed_tracing.enabled=<!--true/false--></jvmFlag>
                <jvmFlag>-Dnewrelic.config.file=/newrelic/newrelic.yml</jvmFlag>
                <jvmFlag>-Dnewrelic.config.app_name=${project.artifactId}</jvmFlag>
                <jvmFlag>-javaagent:/newrelic/newrelic.jar</jvmFlag>
            </jvmFlags>
            <useCurrentTimestamp>true</useCurrentTimestamp>
        </container>
    </configuration>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
</plugin>

docker-tomcat-newrelic-java's People

Contributors

njain1985 avatar

Watchers

James Cloos avatar Nalha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.