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 c4e34f7..8020d2d 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 a5df6bd..a5db168 100644 --- a/env-example +++ b/env-example @@ -74,6 +74,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 diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index 532abd3..5d5091e 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 fe53d95..d823221 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 03d7993..d088ccf 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 f026759..eda75fe 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 3f8aac5..1b480e1 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 78d78c5..650870d 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: #####################################