This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #102
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
20 changes: 20 additions & 0 deletions
20
docker-compose-services/newrelic/docker-compose.newrelic.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
newrelic.distributed_tracing_enabled=true | ||
newrelic.daemon.address="newrelic:31339" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 \ | ||
&& 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 |