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
web/custom.css
.env.local

View file

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

View file

@ -60,6 +60,21 @@ RUN pecl install redis; \
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 curl -L -o /usr/local/bin/envsubst https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m`; \