Merge pull request #7288 from yguedidi/setup-blackfire

Setup Blackfire
This commit is contained in:
Yassine Guedidi 2024-02-26 14:05:30 +01:00 committed by GitHub
commit 742742f67d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 0 deletions

4
.env Normal file
View file

@ -0,0 +1,4 @@
BLACKFIRE_SERVER_ID=CHANGE_ME
BLACKFIRE_SERVER_TOKEN=CHANGE_ME
BLACKFIRE_CLIENT_ID=CHANGE_ME
BLACKFIRE_CLIENT_TOKEN=CHANGE_ME

2
.gitignore vendored
View file

@ -57,3 +57,5 @@ specialexport.json
# Custom CSS file # Custom CSS file
web/custom.css web/custom.css
.env.local

View file

@ -32,6 +32,8 @@ services:
# - ./docker/postgres/env # - ./docker/postgres/env
# Uncomment to enable Xdebug # Uncomment to enable Xdebug
# - ./docker/php/xdebug # - ./docker/php/xdebug
- .env
- .env.local
ports: ports:
- 8000:8000 - 8000:8000
# Uncomment to permit Xdebug remote session # Uncomment to permit Xdebug remote session
@ -75,6 +77,13 @@ services:
timeout: 3s timeout: 3s
retries: 3 retries: 3
blackfire:
image: blackfire/blackfire:2
ports: [ "8307" ]
env_file:
- .env
- .env.local
volumes: volumes:
db-data: db-data:
driver: local driver: local

View file

@ -60,6 +60,21 @@ RUN pecl install redis; \
xdebug \ xdebug \
; ;
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& architecture=$(uname -m) \
&& 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 $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
RUN mkdir -p /tmp/blackfire \
&& architecture=$(uname -m) \
&& curl -A "Docker" -L https://blackfire.io/api/v1/releases/cli/linux/$architecture | tar zxp -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire /usr/bin/blackfire \
&& rm -Rf /tmp/blackfire
RUN npm install -g yarn RUN npm install -g yarn
RUN curl -L -o /usr/local/bin/envsubst https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m`; \ RUN curl -L -o /usr/local/bin/envsubst https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m`; \