From e7837c062f123224a4587b703c6ddc2672195503 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Sun, 8 Aug 2021 18:52:40 +0200 Subject: [PATCH 1/3] add blackfire PHP probe --- data/supported-extensions | 1 + install-php-extensions | 26 ++++++++++++++++++++++++++ scripts/tests/blackfire | 13 +++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 scripts/tests/blackfire diff --git a/data/supported-extensions b/data/supported-extensions index a2ee5c4..26ff3a0 100644 --- a/data/supported-extensions +++ b/data/supported-extensions @@ -3,6 +3,7 @@ apcu 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 apcu_bc 7.0 7.1 7.2 7.3 7.4 ast 7.0 7.1 7.2 7.3 7.4 8.0 8.1 bcmath 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 +blackfire 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 bz2 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 calendar 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 cmark 7.0 7.1 7.2 7.3 7.4 diff --git a/install-php-extensions b/install-php-extensions index cdf02e6..a846c0f 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1654,6 +1654,29 @@ installRemoteModule() { fi fi ;; + blackfire) + case $(uname -m) in + i386 | i686 | x86) + architecture="i386" + ;; + x86_64 | amd64) + architecture="amd64" + ;; + aarch64 | arm64 | armv8) + architecture="arm64" + ;; + *) + architecture="amd64" + ;; + esac + version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") + curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/$architecture/$version + mkdir -p /tmp/blackfire + tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire + mv /tmp/blackfire/blackfire-*.so $(getPHPExtensionsDir)/blackfire.so + rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz + installRemoteModule_manuallyInstalled=1 + ;; cmark) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 701; then @@ -2497,6 +2520,9 @@ installRemoteModule() { # apcu_bc must be loaded after apcu docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" apc ;; + blackfire) + printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > "$PHP_INI_DIR/conf.d/docker-php-ext-$installRemoteModule_module.ini" + ;; event) # event must be loaded after sockets docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" "$installRemoteModule_module" diff --git a/scripts/tests/blackfire b/scripts/tests/blackfire new file mode 100644 index 0000000..b4d75da --- /dev/null +++ b/scripts/tests/blackfire @@ -0,0 +1,13 @@ +#!/bin/sh + +set -o errexit +set -o nounset + +if test -z "$(php --ri blackfire | grep 'Blackfire => enabled')"; then + echo 'Blackfire PHP Probe is disabled' >&2 + rc=1 +else + echo 'Blackfire PHP Probe is enabled' + rc=0 +fi +exit $rc From bfe62a538c41ae55427c2739eb7bd08cfce32401 Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Wed, 11 Aug 2021 10:56:10 +0200 Subject: [PATCH 2/3] fix shell coding style --- install-php-extensions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-php-extensions b/install-php-extensions index a846c0f..e11168f 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -2521,7 +2521,7 @@ installRemoteModule() { docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" apc ;; blackfire) - printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > "$PHP_INI_DIR/conf.d/docker-php-ext-$installRemoteModule_module.ini" + printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" >"$PHP_INI_DIR/conf.d/docker-php-ext-$installRemoteModule_module.ini" ;; event) # event must be loaded after sockets From 76551148f4f30580d5e00ff19da314f82d78345c Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Wed, 11 Aug 2021 12:20:29 +0200 Subject: [PATCH 3/3] following https://github.com/mlocati/docker-php-extension-installer/pull/415#issuecomment-896677623 --- scripts/tests/blackfire | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/tests/blackfire diff --git a/scripts/tests/blackfire b/scripts/tests/blackfire old mode 100644 new mode 100755