Skip to content

Commit

Permalink
Upgrade to Blackfire agent v2 in web container (#2970)
Browse files Browse the repository at this point in the history
Co-authored-by: Randy Fay <randy@randyfay.com>
  • Loading branch information
thomasdiluccio and rfay committed May 3, 2021
1 parent 7f965ea commit 281070c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
24 changes: 13 additions & 11 deletions cmd/ddev/cmd/global_dotddev_assets/commands/web/blackfire
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ function enable {
fi
phpenmod blackfire
killall -HUP php-fpm
killall blackfire-agent 2>/dev/null
nohup blackfire-agent --log-level=4 >/tmp/blackfire_nohup.out 2>&1 &
# Can't use killall here because it kills this process!
pid=$(ps -ef | awk '$8~/^blackfire.*/ { print $2 }' 2>/dev/null)
if [ "${pid}" != "" ]; then kill $pid; fi
nohup blackfire agent:start --log-level=4 >/tmp/blackfire_nohup.out 2>&1 &
sleep 1
echo "Enabled blackfire PHP extension and started blackfire-agent"
echo "Enabled blackfire PHP extension and started blackfire agent"
exit
}
function disable {
phpdismod blackfire
killall -HUP php-fpm
killall blackfire-agent 2>/dev/null
echo "Disabled blackfire PHP extension and stopped blackfire-agent"
# Can't use killall here because it kills this process!
pid=$(ps -ef | awk '$8~/^blackfire.*/ { print $2 }' 2>/dev/null)
if [ "${pid}" != "" ]; then kill ${pid}; fi
echo "Disabled blackfire PHP extension and stopped blackfire agent"
exit
}

Expand All @@ -44,14 +48,12 @@ case $1 in
status)
php --version | grep "with blackfire" >/dev/null 2>&1
phpstatus=$?
killall -0 blackfire-agent 2>/dev/null
agentstatus=$?
# Can't use killall here because it kills this process!
agentstatus=$(ps -ef | awk '$8~/^blackfire.*/ { print $2 }' 2>/dev/null)
if [ ${phpstatus} -eq 0 ]; then echo "blackfire PHP extension enabled"; else echo "blackfire PHP extension disabled"; fi
if [ ${agentstatus} -eq 0 ]; then echo "blackfire agent running"; else echo "blackfire agent not running"; fi

if [ "${agentstatus}" != "" ]; then echo "blackfire agent running"; else echo "blackfire agent not running"; fi
if [ ${phpstatus} -eq 0 ]; then printf "probe version %s\n" "$(php -v | awk -F '[ ,\~]+' '/blackfire/{ print $4; }')"; fi
printf "agent version %s\n" "$(blackfire-agent -v | awk '{print $2;}')"
printf "cli version %s\n" "$(blackfire version | awk '{print $2;}')"
printf "blackfire version %s\n" "$(blackfire version | awk '{print $3;}')"
;;

*)
Expand Down
2 changes: 1 addition & 1 deletion containers/ddev-webserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ RUN mkdir /tmp/ddev && \
fi

RUN DEBIAN_FRONTEND=noninteractive apt-get -qq install -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests -y \
blackfire-agent \
blackfire \
blackfire-php \
fontconfig \
gettext \
Expand Down
2 changes: 1 addition & 1 deletion pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var DockerComposeFileFormatVersion = "3.6"
var WebImg = "drud/ddev-webserver"

// WebTag defines the default web image tag for drud dev
var WebTag = "v1.17.2" // Note that this can be overridden by make
var WebTag = "20210502_thomasdiluccio_blackfire" // Note that this can be overridden by make

// DBImg defines the default db image used for applications.
var DBImg = "drud/ddev-dbserver"
Expand Down

0 comments on commit 281070c

Please sign in to comment.