File tree Expand file tree Collapse file tree 5 files changed +104
-0
lines changed
Expand file tree Collapse file tree 5 files changed +104
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ networks:
117117* `make front` - Builds frontend tasks.
118118* `make lint` - Runs frontend linters.
119119* `make storybook` - Runs storybook in current theme.
120+ * `make blackfire` - Adds and enables blackfire.io php extension, needs [configuration](https://blackfire.io/docs/configuration/php) in docker-composer override.yml.
121+ * `make newrelic` - Adds and enables newrelic.com php extension, needs [configuration](https://docs.newrelic.com/docs/agents/php-agent/getting-started/introduction-new-relic-php#configuration) in docker-composer.override.yml.
120122
121123# ### Additional goals
122124
Original file line number Diff line number Diff line change @@ -6,13 +6,36 @@ services:
66 php:
77 environment:
88 COMPOSER_MEMORY_LIMIT: "-1"
9+ # BLACKFIRE_CLIENT_ID: x
10+ # BLACKFIRE_CLIENT_TOKEN: x
11+ # NEW_RELIC_LICENSE_KEY: x
12+ # NEW_RELIC_APPNAME: "${COMPOSE_PROJECT_NAME}"
913 volumes:
1014 - "./90-mail.ini:/etc/php7/conf.d/90-mail.ini:z"
1115# depends_on:
1216# - mysql
1317# Uncomment next line if you need PHP XDebug.
1418# command: php-fpm7 -F -d zend_extension=xdebug.so
1519
20+ # Get access keys from https://blackfire.io/my/profiles
21+ # Then download extension using "make blackfire"
22+
23+ # blackfire:
24+ # image: blackfire/blackfire
25+ # container_name: "${COMPOSE_PROJECT_NAME}_blackfire"
26+ # environment:
27+ # BLACKFIRE_SERVER_ID: x
28+ # BLACKFIRE_SERVER_TOKEN: x
29+ # BLACKFIRE_LOG_LEVEL: 1
30+ # networks:
31+ # - front
32+
33+ # newrelic:
34+ # image: newrelic/php-daemon
35+ # container_name: "${COMPOSE_PROJECT_NAME}_newrelic"
36+ # networks:
37+ # - front
38+
1639# adminer:
1740# image: dockette/adminer:mysql-php7
1841# container_name: "${COMPOSE_PROJECT_NAME}_adminer"
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+
3+ # installs backfire/io probe extension
4+
5+ # use `php -i | grep "additional .ini"` to get it
6+ PHP_INI_DIR=/etc/php7/conf.d
7+
8+ set -e
9+
10+ env_vars=' BLACKFIRE_CLIENT_ID BLACKFIRE_CLIENT_TOKEN'
11+
12+ for var in $env_vars ; do
13+ eval " val=\$ {$var }"
14+ if [ -z " ${val} " -o " ${val} " = ' x' ]; then
15+ echo " Configure ${var} in docker-compose.override.yml"
16+ echo " Visit https://blackfire.io/my/settings/credentials to get credentials" ; exit 1
17+ fi
18+ done
19+
20+ version=$( php -r " echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;" ) \
21+ && curl -A " Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/amd64/$version \
22+ && mkdir -p /tmp/blackfire \
23+ && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
24+ && mv /tmp/blackfire/blackfire-* .so $( php -r " echo ini_get ('extension_dir');" ) /blackfire.so \
25+ && printf " extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR /blackfire.ini \
26+ && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+
3+ # installs newrelic.com agent extension
4+
5+ # use `php -i | grep "additional .ini"` to get it
6+ PHP_INI_DIR=/etc/php7/conf.d
7+
8+ # get the latest version from https://download.newrelic.com/php_agent/archive/
9+ NEW_RELIC_AGENT_VERSION=" ${NEW_RELIC_AGENT_VERSION:- 9.12.0.268} "
10+ # change it to 'linux' if docker image is not based on Alpinelinux
11+ NEW_RELIC_LINUX=${NEW_RELIC_LINUX:- linux-musl}
12+
13+ set -e
14+
15+ env_vars=' NEW_RELIC_APPNAME NEW_RELIC_LICENSE_KEY'
16+
17+ for var in $env_vars ; do
18+ eval " val=\$ {$var }"
19+ if [ -z " ${val} " -o " ${val} " = ' x' ]; then
20+ echo " Configure ${var} in docker-compose.override.yml"
21+ echo " Visit https://newrelic.com 'Account settings' to get the key" ; exit 1;
22+ fi
23+ done
24+
25+ curl -L https://download.newrelic.com/php_agent/archive/${NEW_RELIC_AGENT_VERSION} /newrelic-php5-${NEW_RELIC_AGENT_VERSION} -${NEW_RELIC_LINUX} .tar.gz | tar -C /tmp -zx \
26+ && export NR_INSTALL_USE_CP_NOT_LN=1 \
27+ && export NR_INSTALL_SILENT=1 \
28+ && /tmp/newrelic-php5-${NEW_RELIC_AGENT_VERSION} -${NEW_RELIC_LINUX} /newrelic-install install \
29+ && rm -rf /tmp/newrelic-php5-* /tmp/nrinstall*
30+
31+ sed -i -e s/\" REPLACE_WITH_REAL_KEY\" /${NEW_RELIC_LICENSE_KEY} / \
32+ -e s/newrelic.appname[[:space:]]=[[:space:]].\* /newrelic.appname=" ${NEW_RELIC_APPNAME} " / \
33+ $PHP_INI_DIR /newrelic.ini
34+ # -e s/\;newrelic.daemon.address[[:space:]]=[[:space:]].\*/newrelic.daemon.address="${NEW_RELIC_DAEMON_ADDRESS}"/ \
Original file line number Diff line number Diff line change @@ -187,3 +187,22 @@ sniffers: | clang compval phpcs newlineeof
187187# # Run all tests & validations (including sniffers)
188188tests : | sniffers cinsp drupalrectorval upgradestatusval behat watchdogval statusreportval
189189
190+ blackfire :
191+ ifneq ("$(wildcard scripts/makefile/blackfire.sh) ","")
192+ $(call php-0, /bin/sh ./scripts/makefile/blackfire.sh)
193+ $(call php-0, kill -USR2 1)
194+ @echo "Blackfire extension enabled"
195+ else
196+ @echo "scripts/makefile/blackfire.sh file does not exist"
197+ @exit 1
198+ endif
199+
200+ newrelic :
201+ ifneq ("$(wildcard scripts/makefile/newrelic.sh) ","")
202+ $(call php-0, /bin/sh ./scripts/makefile/newrelic.sh)
203+ $(call php-0, kill -USR2 1)
204+ @echo "NewRelic extension enabled"
205+ else
206+ @echo "scripts/makefile/newrelic.sh file does not exist"
207+ @exit 1
208+ endif
You can’t perform that action at this time.
0 commit comments