djoos-cookbooks / newrelic

Development repository for the newrelic cookbook
https://supermarket.chef.io/cookbooks/newrelic
MIT License
143 stars 247 forks source link

newrelic.jar install hard codes NR_JAR location to app location/newrelic/newrelic.jar #305

Open et304383 opened 6 years ago

et304383 commented 6 years ago

Using the newrelic_agent_java resource

This:

java -jar newrelic.jar -s <app location> install

doesn't care what the specified install dir for Newrelic is. It hard codes the NR_JAR option in catalina.sh to the

<app location>/newrelic/newrelic.jar

I tried specifying a different install_dir to the newrelic_agent_java resource and while this cookbook installs the jar to the specified location, the install command assumes installed to newrelic/newrelic.jar

Edit: in other words, unless I specify the install_dir to <app location>/newrelic running install doesn't work.

et304383 commented 6 years ago

Side note: the resource isn't idempotent and keeps adding this to bin/catalina.sh on ever Chef run (probably an issue with the install command):

NR_JAR=/opt/atlassian/jira/newrelic/newrelic.jar; export NR_JAR
CATALINA_OPTS="$CATALINA_OPTS -javaagent:$NR_JAR"; export CATALINA_OPTS

In my opinion I'd stop using the installer in this as it seems busted. We have plenty of ways to add the java opts ourselves depending on what cookbook we're using to manage our Java application install.