From 5aab3add4450149e54364768c525c054322721ad Mon Sep 17 00:00:00 2001 From: Diego Antunes Date: Fri, 21 Apr 2017 10:02:54 +1200 Subject: [PATCH] Added blackfire.io --- DOCUMENTATION/content/introduction/index.md | 2 +- docker-compose.yml | 16 ++++++++++++++++ env-example | 10 ++++++++++ php-fpm/Dockerfile-56 | 13 +++++++++++++ php-fpm/Dockerfile-70 | 13 +++++++++++++ php-fpm/Dockerfile-71 | 13 +++++++++++++ workspace/Dockerfile-56 | 18 ++++++++++++++++++ workspace/Dockerfile-70 | 18 ++++++++++++++++++ workspace/Dockerfile-71 | 18 ++++++++++++++++++ 9 files changed, 120 insertions(+), 1 deletion(-) diff --git a/DOCUMENTATION/content/introduction/index.md b/DOCUMENTATION/content/introduction/index.md index 2b8460e..22b3401 100644 --- a/DOCUMENTATION/content/introduction/index.md +++ b/DOCUMENTATION/content/introduction/index.md @@ -93,7 +93,7 @@ PHP FPM - HHVM - **Message Queuing:** Beanstalkd - Beanstalkd Console - RabbitMQ - RabbitMQ Console - PHP Worker - **Tools:** -HAProxy - Jenkins - ElasticSearch - Selenium - Certbot - Mailhog - Minio - Varnish - PhpMyAdmin - Adminer - PgAdmin - MailHog... +HAProxy - Jenkins - ElasticSearch - Selenium - Certbot - Mailhog - Minio - Varnish - PhpMyAdmin - Adminer - PgAdmin - MailHog - [Blackfire](https://blackfire.io)... Laradock introduces the **Workspace** Image, as a development environment. 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. diff --git a/docker-compose.yml b/docker-compose.yml index 7e2c4ca..7123bdd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: context: ./workspace args: - INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG} + - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP} - INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO} - INSTALL_NODE=${WORKSPACE_INSTALL_NODE} @@ -34,6 +35,8 @@ services: - NODE_VERSION=${WORKSPACE_NODE_VERSION} - YARN_VERSION=${WORKSPACE_YARN_VERSION} - TZ=${WORKSPACE_TIMEZONE} + - BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID} + - BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN} dockerfile: "Dockerfile-${PHP_VERSION}" volumes_from: - applications @@ -53,6 +56,7 @@ services: context: ./php-fpm args: - INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG} + - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE} - INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP} - INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO} - INSTALL_ZIP_ARCHIVE=${PHP_FPM_INSTALL_ZIP_ARCHIVE} @@ -115,6 +119,18 @@ services: - frontend - backend +### Blackfire Container ################################# + + blackfire: + image: blackfire/blackfire + environment: + - BLACKFIRE_SERVER_ID=${BLACKFIRE_SERVER_ID} + - BLACKFIRE_SERVER_TOKEN=${BLACKFIRE_SERVER_TOKEN} + depends_on: + - php-fpm + networks: + - backend + ### Apache Server Container ################################# apache2: diff --git a/env-example b/env-example index c61719b..a78a6f1 100644 --- a/env-example +++ b/env-example @@ -58,6 +58,16 @@ NGINX_HOST_HTTPS_PORT=443 NGINX_HOST_LOG_PATH=./logs/nginx/ NGINX_SITES_PATH=./nginx/sites/ +### Blackfire Container +# Create an account on blackfire.io +# Don't enable blackfire and xDebug at the same time +# see https://blackfire.io/docs/24-days/06-installation#install-probe-debian +INSTALL_BLACKFIRE=false +BLACKFIRE_CLIENT_ID= +BLACKFIRE_CLIENT_TOKEN= +BLACKFIRE_SERVER_ID= +BLACKFIRE_SERVER_TOKEN= + ### APACHE Container APACHE_HOST_HTTP_PORT=80 APACHE_HOST_HTTPS_PORT=443 diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index 386eff6..72ba9ee 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -65,6 +65,19 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # Copy xdebug configration for remote debugging COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini +##################################### +# Blackfire: +##################################### + +ARG INSTALL_BLACKFIRE=false +RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \ + version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \ + && mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \ +;fi + ##################################### # PHP REDIS EXTENSION FOR PHP 5 ##################################### diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 1c07a17..bb696b6 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -62,6 +62,19 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # Copy xdebug configration for remote debugging COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini +##################################### +# Blackfire: +##################################### + +ARG INSTALL_BLACKFIRE=false +RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \ + version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \ + && mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \ +;fi + ##################################### # PHP REDIS EXTENSION FOR PHP 7 ##################################### diff --git a/php-fpm/Dockerfile-71 b/php-fpm/Dockerfile-71 index 87f6ff4..29dcd57 100644 --- a/php-fpm/Dockerfile-71 +++ b/php-fpm/Dockerfile-71 @@ -62,6 +62,19 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # Copy xdebug configration for remote debugging COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini +##################################### +# Blackfire: +##################################### + +ARG INSTALL_BLACKFIRE=false +RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \ + version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ + && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \ + && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \ + && mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \ + && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \ +;fi + ##################################### # PHP REDIS EXTENSION FOR PHP 7 ##################################### diff --git a/workspace/Dockerfile-56 b/workspace/Dockerfile-56 index 6227cd9..6f06c07 100644 --- a/workspace/Dockerfile-56 +++ b/workspace/Dockerfile-56 @@ -135,6 +135,24 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # ADD for REMOTE debugging COPY ./xdebug.ini /etc/php/5.6/cli/conf.d/xdebug.ini +##################################### +# Blackfire: +##################################### + +ARG INSTALL_BLACKFIRE=false +ARG BLACKFIRE_CLIENT_ID +ARG BLACKFIRE_CLIENT_TOKEN + +ENV BLACKFIRE_CLIENT_ID ${BLACKFIRE_CLIENT_ID} +ENV BLACKFIRE_CLIENT_TOKEN ${BLACKFIRE_CLIENT_TOKEN} + +RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \ + curl -L https://packagecloud.io/gpg.key | apt-key add - && \ + echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \ + apt-get update && \ + apt-get install blackfire-agent \ +;fi + ##################################### # ssh: ##################################### diff --git a/workspace/Dockerfile-70 b/workspace/Dockerfile-70 index 323c502..0bbf92e 100644 --- a/workspace/Dockerfile-70 +++ b/workspace/Dockerfile-70 @@ -134,6 +134,24 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # ADD for REMOTE debugging COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini +##################################### +# Blackfire: +##################################### + +ARG INSTALL_BLACKFIRE=false +ARG BLACKFIRE_CLIENT_ID +ARG BLACKFIRE_CLIENT_TOKEN + +ENV BLACKFIRE_CLIENT_ID ${BLACKFIRE_CLIENT_ID} +ENV BLACKFIRE_CLIENT_TOKEN ${BLACKFIRE_CLIENT_TOKEN} + +RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \ + curl -L https://packagecloud.io/gpg.key | apt-key add - && \ + echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \ + apt-get update && \ + apt-get install blackfire-agent \ +;fi + ##################################### # ssh: ##################################### diff --git a/workspace/Dockerfile-71 b/workspace/Dockerfile-71 index 9d5b1db..24d3a30 100644 --- a/workspace/Dockerfile-71 +++ b/workspace/Dockerfile-71 @@ -97,6 +97,24 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # ADD for REMOTE debugging COPY ./xdebug.ini /etc/php/7.1/cli/conf.d/xdebug.ini +##################################### +# Blackfire: +##################################### + +ARG INSTALL_BLACKFIRE=false +ARG BLACKFIRE_CLIENT_ID +ARG BLACKFIRE_CLIENT_TOKEN + +ENV BLACKFIRE_CLIENT_ID ${BLACKFIRE_CLIENT_ID} +ENV BLACKFIRE_CLIENT_TOKEN ${BLACKFIRE_CLIENT_TOKEN} + +RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \ + curl -L https://packagecloud.io/gpg.key | apt-key add - && \ + echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \ + apt-get update && \ + apt-get install blackfire-agent \ +;fi + ##################################### # ssh: #####################################