-
-
Save Shipu/b8f50f16ffd19e17b69174237cc7eb15 to your computer and use it in GitHub Desktop.
Docker + Alpine + Newrelic + PHP (Kubernetes / AbarCloud)
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
# Prepare required directories for Newrelic installation | |
RUN mkdir -p /var/log/newrelic /var/run/newrelic && \ | |
touch /var/log/newrelic/php_agent.log /var/log/newrelic/newrelic-daemon.log && \ | |
chmod -R g+ws /tmp /var/log/newrelic/ /var/run/newrelic/ && \ | |
chown -R 1001:0 /tmp /var/log/newrelic/ /var/run/newrelic/ && \ | |
# Download and install Newrelic binary | |
export NEWRELIC_VERSION=$(curl -sS https://download.newrelic.com/php_agent/release/ | sed -n 's/.*>\(.*linux-musl\).tar.gz<.*/\1/p') && \ | |
cd /tmp && curl -sS "https://download.newrelic.com/php_agent/release/${NEWRELIC_VERSION}.tar.gz" | gzip -dc | tar xf - && \ | |
cd "${NEWRELIC_VERSION}" && \ | |
NR_INSTALL_SILENT=true ./newrelic-install install && \ | |
rm -f /var/run/newrelic-daemon.pid && \ | |
rm -f /tmp/.newrelic.sock && \ | |
# For Newrelic's APM (Application Monitoring) license and appname are required. | |
# Enviroment variables `NEW_RELIC_LICENSE_KEY` and `NEW_RELIC_APP_NAME` are required when buidling Docker image, | |
# so you must set them in your **BuildConfig** Environments. | |
sed -i \ | |
-e "s/newrelic.license =.*/newrelic.license = ${NEW_RELIC_LICENSE_KEY}/" \ | |
-e "s/newrelic.appname =.*/newrelic.appname = ${NEW_RELIC_APP_NAME}/" \ | |
/etc/php7/conf.d/newrelic.ini |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment