Setup Blackfire

This commit is contained in:
Yassine Guedidi 2024-02-24 01:18:08 +01:00
parent cd6f7b5e92
commit e7a348cd0f
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

@ -58,3 +58,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`; \