Skip to content

Commit

Permalink
disable newrelic earlier during builds to prevent pushes from hanging…
Browse files Browse the repository at this point in the history
… in certain rare cases
  • Loading branch information
dzuelke committed Aug 7, 2014
1 parent fcf1297 commit e947639
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ cp $BP_DIR/conf/nginx/nginx.conf.default $BUILD_DIR/.heroku/php/etc/nginx/nginx.
# remember the version for future upgrade handling
echo $NGINX_VERSION > $CACHE_DIR/nginx_version

# the newrelic extension logs to stderr which pollutes our build output on each invocation of PHP, and the daemon it launches will prevent the build from finishing, so we disable it for the duration of this build (write to zzz-ext-newrelic.ini so the file is loaded last and overwrites the regular config). we can do this unconditionally here, no harm done if extension or add-on aren't enabled
echo "newrelic.enabled = 0
newrelic.loglevel = error
newrelic.daemon.dont_launch = 3
newrelic.daemon.loglevel = error" > "${BUILD_DIR}/.heroku/php/etc/php/conf.d/zzz-ext-newrelic.ini"

# handle extensions for PHP
if [[ "${PHP_VERSION}" ]]; then
status "Installing PHP extensions..."
Expand All @@ -190,6 +196,7 @@ if [[ "${PHP_VERSION}" ]]; then
for ext in "${!exts[@]}"; do # loop over keys in case the array is empty or else it'll error out
install_ext "${exts[$ext]}" "composer.json"
done

# special treatment for New Relic; we enable it if we detect a license key for it
# otherwise users would have to have it in their require section, which is annoying in development environments
NEW_RELIC_LICENSE_KEY=${NEW_RELIC_LICENSE_KEY:-}
Expand All @@ -198,14 +205,6 @@ if [[ "${PHP_VERSION}" ]]; then
exts+=("newrelic")
fi

if [[ ${#exts[@]} -gt 0 && ${exts[*]} =~ "newrelic" ]]; then
# newrelic logs to stderr, and that mangles our build output and seems to cause calls to Composer to potentially hang, so we disable it for the duration of this build (write to zzz-ext-newrelic.ini so the file is loaded last and overwrites the regular config)
echo "newrelic.enabled = 0
newrelic.loglevel = error
newrelic.daemon.dont_launch = 3
newrelic.daemon.loglevel = error" > "${BUILD_DIR}/.heroku/php/etc/php/conf.d/zzz-ext-newrelic.ini"
fi

if [[ ${#exts[@]} -eq 0 || ! ${exts[*]} =~ "zend-opcache" ]]; then
install_ext "zend-opcache" "automatic"
exts+=("zend-opcache")
Expand Down

0 comments on commit e947639

Please sign in to comment.