Merge pull request #2755 from hsyam/new_relic

Add NewRelic support for php-FPM
This commit is contained in:
Shao Yu-Lung (Allen) 2020-12-18 13:57:59 +08:00 committed by GitHub
commit 1b102f4395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 0 deletions

View File

@ -260,6 +260,9 @@ services:
- PUID=${PHP_FPM_PUID} - PUID=${PHP_FPM_PUID}
- PGID=${PHP_FPM_PGID} - PGID=${PHP_FPM_PGID}
- LOCALE=${PHP_FPM_DEFAULT_LOCALE} - 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 - http_proxy
- https_proxy - https_proxy
- no_proxy - no_proxy

View File

@ -256,6 +256,12 @@ PHP_FPM_DEFAULT_LOCALE=POSIX
PHP_FPM_PUID=1000 PHP_FPM_PUID=1000
PHP_FPM_PGID=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 ############################################
PHP_WORKER_INSTALL_BZ2=false PHP_WORKER_INSTALL_BZ2=false

View File

@ -946,6 +946,26 @@ RUN if [ ${INSTALL_XMLRPC} = true ]; then \
docker-php-ext-install xmlrpc \ docker-php-ext-install xmlrpc \
;fi ;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: # Downgrade Openssl:
########################################################################### ###########################################################################