ddev-contrib icon indicating copy to clipboard operation
ddev-contrib copied to clipboard

Add recipe for New Relic, fixes #102

Open mglaman opened this issue 4 years ago • 12 comments

Fixes #102

mglaman avatar Dec 02 '20 03:12 mglaman

I unfortunately tried this on a Drupal 9 project, so when I switched to PHP7.3 it failed. But then I tried on a D8 project, finally found some data that I didn't know how to use on Dashboards->Browser

rfay avatar Dec 29 '20 22:12 rfay

Thanks for the review @rfay, I've got this on my list to update

mglaman avatar Jan 04 '21 16:01 mglaman

Looking forward to seeing this get in @mglaman - thanks for the contribution!

rfay avatar Jan 24 '21 17:01 rfay

I'm sure this will be useful to people, so hope you can return to it.

rfay avatar Apr 20 '21 13:04 rfay

@mglaman you have lots to do, but please push this up to the top of your priority list and get it finished, thanks!

rfay avatar Jun 04 '21 21:06 rfay

It's been more than a year @mglaman - maybe you can fit this in with your 20% if you get it!

rfay avatar Jan 15 '22 21:01 rfay

@mglaman I would love to see this finished!

jeremysimmons avatar Feb 11 '22 22:02 jeremysimmons

Het @mglaman, I know it's been a long time, maybe you can help us on how to configure this service, thank you very much in advance

Gonzalo2683 avatar Jun 23 '23 20:06 Gonzalo2683

Hello everyone, I have an example that is working decently, I'm not sure if it's the recommended way to do it. I have tried to follow the comments left by @rfay . I'm not an expert in Docker, so if you see any improvements, feel free to add them, and perhaps this recipe can become available.

docker-compose.newrelic.yaml

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:
    environment:
      IMAGE_NAME: newrelic/php-daemon
      NEW_RELIC_AGENT_VERSION: "9.2.0.247"
      NEW_RELIC_LICENSE_KEY: "YOUR_API_KEY_HERE"
      NEW_RELIC_APPNAME: ${DDEV_SITENAME}
      NEW_RELIC_DAEMON_ADDRESS: "newrelic:31339"
    links:
      - newrelic:$DDEV_HOSTNAME

.ddev/php/newrelic.ini

[newrelic]
newrelic.license = "YOUR_API_KEY_HERE"
newrelic.appname = "THE_SAME_NAME_OF_NEW_RELIC_APPNAME_VAR"
newrelic.distributed_tracing_enabled = true
newrelic.transaction_tracer.enabled = true

newrelic.application_logging.enabled = true
newrelic.application_logging.metrics.enabled = true
newrelic.application_logging.forwarding.enabled = true

.ddev/web-build/Dockerfile.newrelic

FROM $BASE_IMAGE

ARG NEW_RELIC_AGENT_VERSION
ARG NEW_RELIC_LICENSE_KEY
ARG NEW_RELIC_APPNAME

RUN wget -O - https://download.newrelic.com/548C16BF.gpg | apt-key add - && \
    sh -c 'echo "deb http://apt.newrelic.com/debian/ newrelic non-free" > /etc/apt/sources.list.d/newrelic.list' && \
    apt-get update

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -y install newrelic-php5

Run ddev restart, browse your ddev site to generate some data. Go to newrelic page, find APM & Services.

Example ddev_newrelic

Gonzalo2683 avatar Jun 24 '23 15:06 Gonzalo2683

@Gonzalo2683 you're doing great! Could you please create an add-on that implements this? It's super easy, and that's the maintainable way to handle these recipes.

  • https://ddev.readthedocs.io/en/latest/users/extend/additional-services/#creating-an-additional-service-for-ddev-get
  • https://github.com/ddev/ddev-addon-template

I'm sure that after you do that (use a good README) then @tyler36 and I will be happy to try it out and offer suggestions/issues/PRs to your repo.

rfay avatar Jun 24 '23 19:06 rfay

Is there a way to run this on Apple M2 ARM64? Any installation guide or commands would helpful, thanks.

lexsoft00 avatar Jan 12 '24 14:01 lexsoft00

It looks like newrelic does not provide an arm64 image, https://hub.docker.com/r/newrelic/php-daemon/tags, even 3+ years after arm64 has arrived.

rfay avatar Jan 13 '24 13:01 rfay