From 29a8f5455462b771dfc6a0388aab77fd62d6694e Mon Sep 17 00:00:00 2001 From: Thomas Fini Hansen Date: Thu, 5 Oct 2023 15:03:59 +0200 Subject: [PATCH] Improve Blackfire setup and add documentation --- README.md | 24 +++++++++++++++++++++++- context/etc/entrypoint.d/blackfire.sh | 4 ++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 43b8a72..cce592b 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,29 @@ typing enter. ## Blackfire -@todo +In order to send profiles to Blackfire, you'll need to have a +Blackfire agent reachable by the php-fpm image and the appropriate +credentials. + +Providing an agent in docker compose is easy, as it's just starting +the orignial Blackfire image. + +``` yaml + php: + image: 'ghcr.io/reload/php-fpm:8.2' + environment: + BLACKFIRE_CLIENT_ID: + BLACKFIRE_CLIENT_TOKEN: + blackfire: + image: blackfire/blackfire + environment: + BLACKFIRE_SERVER_ID: + BLACKFIRE_SERVER_TOKEN: +``` + +The correct id's and tokens can be found by viewing the [Blackfire +setup documentation](https://blackfire.io/docs/php/configuration) when +logged in. ## Mail diff --git a/context/etc/entrypoint.d/blackfire.sh b/context/etc/entrypoint.d/blackfire.sh index f3ca648..ab5bc75 100755 --- a/context/etc/entrypoint.d/blackfire.sh +++ b/context/etc/entrypoint.d/blackfire.sh @@ -3,6 +3,6 @@ # Ensure Blackfire is only enabled if we have the necessary configuration. set -e -if [ -n "${BLACKFIRE_SOCKET}" ]; then - docker-php-ext-enable-blackfire +if [ -n "${BLACKFIRE_CLIENT_ID}" ] && [ -n "${BLACKFIRE_CLIENT_TOKEN}" ]; then + sudo docker-php-ext-enable-blackfire fi