Skip to content

Commit 5aab3ad

Browse files
committed
Added blackfire.io
1 parent a7624a7 commit 5aab3ad

9 files changed

Lines changed: 120 additions & 1 deletion

File tree

DOCUMENTATION/content/introduction/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ PHP FPM - HHVM
9393
- **Message Queuing:**
9494
Beanstalkd - Beanstalkd Console - RabbitMQ - RabbitMQ Console - PHP Worker
9595
- **Tools:**
96-
HAProxy - Jenkins - ElasticSearch - Selenium - Certbot - Mailhog - Minio - Varnish - PhpMyAdmin - Adminer - PgAdmin - MailHog...
96+
HAProxy - Jenkins - ElasticSearch - Selenium - Certbot - Mailhog - Minio - Varnish - PhpMyAdmin - Adminer - PgAdmin - MailHog - [Blackfire](https://blackfire.io)...
9797

9898
Laradock introduces the **Workspace** Image, as a development environment.
9999
It contains a rich set of helpful tools, all pre-configured to work and integrate with almost any combination of Containers and tools you may choose.

docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ services:
1616
context: ./workspace
1717
args:
1818
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
19+
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
1920
- INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP}
2021
- INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO}
2122
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
@@ -34,6 +35,8 @@ services:
3435
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
3536
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
3637
- TZ=${WORKSPACE_TIMEZONE}
38+
- BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID}
39+
- BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN}
3740
dockerfile: "Dockerfile-${PHP_VERSION}"
3841
volumes_from:
3942
- applications
@@ -53,6 +56,7 @@ services:
5356
context: ./php-fpm
5457
args:
5558
- INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
59+
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
5660
- INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP}
5761
- INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO}
5862
- INSTALL_ZIP_ARCHIVE=${PHP_FPM_INSTALL_ZIP_ARCHIVE}
@@ -115,6 +119,18 @@ services:
115119
- frontend
116120
- backend
117121

122+
### Blackfire Container #################################
123+
124+
blackfire:
125+
image: blackfire/blackfire
126+
environment:
127+
- BLACKFIRE_SERVER_ID=${BLACKFIRE_SERVER_ID}
128+
- BLACKFIRE_SERVER_TOKEN=${BLACKFIRE_SERVER_TOKEN}
129+
depends_on:
130+
- php-fpm
131+
networks:
132+
- backend
133+
118134
### Apache Server Container #################################
119135

120136
apache2:

env-example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ NGINX_HOST_HTTPS_PORT=443
5858
NGINX_HOST_LOG_PATH=./logs/nginx/
5959
NGINX_SITES_PATH=./nginx/sites/
6060

61+
### Blackfire Container
62+
# Create an account on blackfire.io
63+
# Don't enable blackfire and xDebug at the same time
64+
# see https://blackfire.io/docs/24-days/06-installation#install-probe-debian
65+
INSTALL_BLACKFIRE=false
66+
BLACKFIRE_CLIENT_ID=<client_id>
67+
BLACKFIRE_CLIENT_TOKEN=<client_token>
68+
BLACKFIRE_SERVER_ID=<server_id>
69+
BLACKFIRE_SERVER_TOKEN=<server_token>
70+
6171
### APACHE Container
6272
APACHE_HOST_HTTP_PORT=80
6373
APACHE_HOST_HTTPS_PORT=443

php-fpm/Dockerfile-56

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
6565
# Copy xdebug configration for remote debugging
6666
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
6767

68+
#####################################
69+
# Blackfire:
70+
#####################################
71+
72+
ARG INSTALL_BLACKFIRE=false
73+
RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
74+
version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
75+
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
76+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
77+
&& mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
78+
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
79+
;fi
80+
6881
#####################################
6982
# PHP REDIS EXTENSION FOR PHP 5
7083
#####################################

php-fpm/Dockerfile-70

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
6262
# Copy xdebug configration for remote debugging
6363
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
6464

65+
#####################################
66+
# Blackfire:
67+
#####################################
68+
69+
ARG INSTALL_BLACKFIRE=false
70+
RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
71+
version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
72+
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
73+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
74+
&& mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
75+
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
76+
;fi
77+
6578
#####################################
6679
# PHP REDIS EXTENSION FOR PHP 7
6780
#####################################

php-fpm/Dockerfile-71

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
6262
# Copy xdebug configration for remote debugging
6363
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
6464

65+
#####################################
66+
# Blackfire:
67+
#####################################
68+
69+
ARG INSTALL_BLACKFIRE=false
70+
RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
71+
version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
72+
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
73+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
74+
&& mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
75+
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
76+
;fi
77+
6578
#####################################
6679
# PHP REDIS EXTENSION FOR PHP 7
6780
#####################################

workspace/Dockerfile-56

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,24 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
135135
# ADD for REMOTE debugging
136136
COPY ./xdebug.ini /etc/php/5.6/cli/conf.d/xdebug.ini
137137

138+
#####################################
139+
# Blackfire:
140+
#####################################
141+
142+
ARG INSTALL_BLACKFIRE=false
143+
ARG BLACKFIRE_CLIENT_ID
144+
ARG BLACKFIRE_CLIENT_TOKEN
145+
146+
ENV BLACKFIRE_CLIENT_ID ${BLACKFIRE_CLIENT_ID}
147+
ENV BLACKFIRE_CLIENT_TOKEN ${BLACKFIRE_CLIENT_TOKEN}
148+
149+
RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
150+
curl -L https://packagecloud.io/gpg.key | apt-key add - && \
151+
echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \
152+
apt-get update && \
153+
apt-get install blackfire-agent \
154+
;fi
155+
138156
#####################################
139157
# ssh:
140158
#####################################

workspace/Dockerfile-70

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,24 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
134134
# ADD for REMOTE debugging
135135
COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini
136136

137+
#####################################
138+
# Blackfire:
139+
#####################################
140+
141+
ARG INSTALL_BLACKFIRE=false
142+
ARG BLACKFIRE_CLIENT_ID
143+
ARG BLACKFIRE_CLIENT_TOKEN
144+
145+
ENV BLACKFIRE_CLIENT_ID ${BLACKFIRE_CLIENT_ID}
146+
ENV BLACKFIRE_CLIENT_TOKEN ${BLACKFIRE_CLIENT_TOKEN}
147+
148+
RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
149+
curl -L https://packagecloud.io/gpg.key | apt-key add - && \
150+
echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \
151+
apt-get update && \
152+
apt-get install blackfire-agent \
153+
;fi
154+
137155
#####################################
138156
# ssh:
139157
#####################################

workspace/Dockerfile-71

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
9797
# ADD for REMOTE debugging
9898
COPY ./xdebug.ini /etc/php/7.1/cli/conf.d/xdebug.ini
9999

100+
#####################################
101+
# Blackfire:
102+
#####################################
103+
104+
ARG INSTALL_BLACKFIRE=false
105+
ARG BLACKFIRE_CLIENT_ID
106+
ARG BLACKFIRE_CLIENT_TOKEN
107+
108+
ENV BLACKFIRE_CLIENT_ID ${BLACKFIRE_CLIENT_ID}
109+
ENV BLACKFIRE_CLIENT_TOKEN ${BLACKFIRE_CLIENT_TOKEN}
110+
111+
RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
112+
curl -L https://packagecloud.io/gpg.key | apt-key add - && \
113+
echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \
114+
apt-get update && \
115+
apt-get install blackfire-agent \
116+
;fi
117+
100118
#####################################
101119
# ssh:
102120
#####################################

0 commit comments

Comments
 (0)