Skip to content

Use this repository to get New Relic Java Agent integrated with a JIB distroless Container

License

Notifications You must be signed in to change notification settings

Nalha/Docker-tomcat-NewRelic-Java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

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>

About

Use this repository to get New Relic Java Agent integrated with a JIB distroless Container

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Dockerfile 100.0%