-
-
Notifications
You must be signed in to change notification settings - Fork 160
Add recipe for New Relic, fixes #102 #103
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# New Relic | ||
|
||
This recipe adds a New Relic daemon service and PHP agent to the `web` container. | ||
|
||
Once configured it will begin reporting data to New Relic. Your DDEV project name will be the app name reported in your New Relic APM list. | ||
|
||
## Configuration | ||
|
||
There are two configuration items in `docker-compose.newrelic.yaml`. | ||
|
||
* `NEW_RELIC_LICENSE_KEY`: You must specify your license key. | ||
* `NEW_RELIC_AGENT_VERSION`: Specify the New Relic agent version. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This kind of ends abruptly. Now what do you do when you've done these things? What do I have to set up on NewRelic? How do I know if it's working? |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,20 @@ | ||||||
--- | ||||||
# Adds New Relic support for performance profiling. | ||||||
version: '3.6' | ||||||
services: | ||||||
newrelic: | ||||||
image: newrelic/php-daemon | ||||||
container_name: ddev-${DDEV_SITENAME}-newrelic | ||||||
ports: ['31339'] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm getting to where I like |
||||||
labels: | ||||||
com.ddev.site-name: ${DDEV_SITENAME} | ||||||
com.ddev.approot: $DDEV_APPROOT | ||||||
|
||||||
web: | ||||||
build: | ||||||
args: | ||||||
NEW_RELIC_AGENT_VERSION: "9.2.0.247" | ||||||
NEW_RELIC_LICENSE_KEY: "" | ||||||
NEW_RELIC_APPNAME: ${DDEV_SITENAME} | ||||||
links: | ||||||
- newrelic | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be
Suggested change
Maybe they're the same. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
newrelic.distributed_tracing_enabled=true | ||
newrelic.daemon.address="newrelic:31339" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ARG BASE_IMAGE | ||
FROM $BASE_IMAGE | ||
|
||
# Install New Relic | ||
# @see https://docs.newrelic.com/docs/agents/php-agent/advanced-installation/docker-other-container-environments-install-php-agent | ||
ARG NEW_RELIC_AGENT_VERSION | ||
ARG NEW_RELIC_LICENSE_KEY | ||
ARG NEW_RELIC_APPNAME | ||
|
||
RUN curl -L https://download.newrelic.com/php_agent/archive/${NEW_RELIC_AGENT_VERSION}/newrelic-php5-${NEW_RELIC_AGENT_VERSION}-linux.tar.gz | tar -C /tmp -zx \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I note that this looks cleaner to do with |
||
&& export NR_INSTALL_USE_CP_NOT_LN=1 \ | ||
&& export NR_INSTALL_SILENT=1 \ | ||
&& /tmp/newrelic-php5-${NEW_RELIC_AGENT_VERSION}-linux/newrelic-install install \ | ||
&& rm -rf /tmp/newrelic-php5-* /tmp/nrinstall* | ||
|
||
RUN sed -i -e "s/REPLACE_WITH_REAL_KEY/${NEW_RELIC_LICENSE_KEY}/" \ | ||
-e "s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\"${NEW_RELIC_APPNAME}\"/" \ | ||
/etc/php/${PHP_DEFAULT_VERSION}/fpm/conf.d/newrelic.ini | ||
RUN sed -i -e "s/REPLACE_WITH_REAL_KEY/${NEW_RELIC_LICENSE_KEY}/" \ | ||
-e "s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\"${NEW_RELIC_APPNAME}\"/" \ | ||
/etc/php/${PHP_DEFAULT_VERSION}/cli/conf.d/newrelic.ini | ||
Comment on lines
+16
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just put the newrelic.ini in .ddev/php ? It's easy to capture it using your technique , use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The technique used here copies only into /etc/php/${PHP_DEFAULT_VERSION}//conf.d - which means (currently) /etc/php/7.3//conf.d. But we might want php7.4 or something else. We can't use DDEV_PHP_VERSION here because it's determined at container start time. So that makes the previous suggestion more important. If you just put it in .ddev/php, it will go in the right place. Alternately, copy into all the places (5.6/7.0/7.1/7.2/7.3/7.4/8.0) (I don't think 8.0 works yet?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that NEW_RELIC_AGENT_VERSION is specified, and not actually a configuration item? Or at least we can use it as-is for now, because it's wired in elsewhere.