diff --git a/docker-compose.yml b/docker-compose.yml index d7da9149..f9025f28 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -260,6 +260,9 @@ services: - PUID=${PHP_FPM_PUID} - PGID=${PHP_FPM_PGID} - LOCALE=${PHP_FPM_DEFAULT_LOCALE} + - PHP_FPM_NEW_RELIC=${PHP_FPM_NEW_RELIC} + - PHP_FPM_NEW_RELIC_KEY=${PHP_FPM_NEW_RELIC_KEY} + - PHP_FPM_NEW_RELIC_APP_NAME=${PHP_FPM_NEW_RELIC_APP_NAME} - http_proxy - https_proxy - no_proxy diff --git a/env-example b/env-example index 889dc1c2..8129c4e6 100644 --- a/env-example +++ b/env-example @@ -256,6 +256,12 @@ PHP_FPM_DEFAULT_LOCALE=POSIX PHP_FPM_PUID=1000 PHP_FPM_PGID=1000 +### PHP_FPM_NEW_RELIC ##################################### + +PHP_FPM_NEW_RELIC=false +PHP_FPM_NEW_RELIC_KEY=0000 +PHP_FPM_NEW_RELIC_APP_NAME=app_name + ### PHP_WORKER ############################################ PHP_WORKER_INSTALL_BZ2=false diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 0ae6c75b..c4975d24 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -946,6 +946,26 @@ RUN if [ ${INSTALL_XMLRPC} = true ]; then \ docker-php-ext-install xmlrpc \ ;fi +########################################################################### +# New Relic for PHP: +########################################################################### +ARG NEW_RELIC=${NEW_RELIC} +ARG NEW_RELIC_KEY=${NEW_RELIC_KEY} +ARG NEW_RELIC_APP_NAME=${NEW_RELIC_APP_NAME} + +RUN if [ ${NEW_RELIC} = true ]; then \ + curl -L http://download.newrelic.com/php_agent/archive/9.9.0.260/newrelic-php5-9.9.0.260-linux.tar.gz | tar -C /tmp -zx && \ + export NR_INSTALL_USE_CP_NOT_LN=1 && \ + export NR_INSTALL_SILENT=1 && \ + /tmp/newrelic-php5-*/newrelic-install install && \ + rm -rf /tmp/newrelic-php5-* /tmp/nrinstall* && \ + sed -i \ + -e 's/"REPLACE_WITH_REAL_KEY"/"${NEW_RELIC_KEY}"/' \ + -e 's/newrelic.appname = "PHP Application"/newrelic.appname = "${NEW_RELIC_APP_NAME}"/' \ + -e 's/;newrelic.daemon.app_connect_timeout =.*/newrelic.daemon.app_connect_timeout=15s/' \ + -e 's/;newrelic.daemon.start_timeout =.*/newrelic.daemon.start_timeout=5s/' \ + /usr/local/etc/php/conf.d/newrelic.ini \ +;fi ########################################################################### # Downgrade Openssl: ###########################################################################