Enable and configure Blackfire

This section will guide you through getting Blackfire integrated into the Devilbox.

Table of Contents

Overview

Available overwrites

The Devilbox ships various example configurations to overwrite the default stack. Those files are located under compose/ in the Devilbox git directory.

docker-compose.override.yml-all has all examples combined in one file for easy copy/paste. However, each example also exists in its standalone file as shown below:

host> tree -L 1 compose/
compose/
├── docker-compose.override.yml-all
├── docker-compose.override.yml-blackfire
├── docker-compose.override.yml-mailhog
├── docker-compose.override.yml-rabbitmq
├── docker-compose.override.yml-solr
└── README.md

0 directories, 6 files

Blackfire settings

In case of Blackfire, the file is compose/docker-compose.override.yml-blackfire. This file must be copied into the root of the Devilbox git directory.

What How and where
Example compose file compose/docker-compose.override.yml-all or
compose/docker-compose.override.yml-blackfire
Container IP address 172.16.238.200
Container host name blackfire
Container name blackfire
Mount points none
Exposed port none
Available at n.a.
Further configuration BLACKFIRE_SERVER_ID and BLACKFIRE_SERVER_TOKEN must be set via .env

Blackfire env variables

Additionally the following .env variables can be created for easy configuration:

Variable Default value Description
BLACKFIRE_SERVER_ID id A valid server id is required in order to use blackfire.
BLACKFIRE_SERVER_TOKEN token A valid server token is required in order to use blackfire.
BLACKFIRE_SERVER latest Controls the Blackfire version to use.

Instructions

1. Copy docker-compose.override.yml

Copy the Blackfire Docker Compose overwrite file into the root of the Devilbox git directory. (It must be at the same level as the default docker-compose.yml file).

host> cp compose/docker-compose.override.yml-blackfire docker-compose.override.yml

2. Adjust env settings (required)

By default Blackfire is using some dummy values for BLACKFIRE_SERVER_ID and BLACKFIRE_SERVER_TOKEN. You must however aquire valid values and set the in your .env file in order for Blackfire to properly start. Those values can be obtained at their official webpage.

.env
BLACKFIRE_SERVER_ID=<valid server id>
BLACKFIRE_SERVER_TOKEN=<valid server token>

#BLACKFIRE_SERVER=1.12.0
#BLACKFIRE_SERVER=1.13.0
#BLACKFIRE_SERVER=1.14.0
#BLACKFIRE_SERVER=1.14.1
#BLACKFIRE_SERVER=1.15.0
#BLACKFIRE_SERVER=1.16.0
#BLACKFIRE_SERVER=1.17.0
#BLACKFIRE_SERVER=1.17.1
#BLACKFIRE_SERVER=1.18.0
BLACKFIRE_SERVER=latest

See also

.env file

3. Start the Devilbox

The final step is to start the Devilbox with Blackfire.

Let’s assume you want to start php, httpd, bind and blackfire.

host> docker-compose up -d php httpd bind blackfire

TL;DR

For the lazy readers, here are all commands required to get you started. Simply copy and paste the following block into your terminal from the root of your Devilbox git directory:

# Copy compose-override.yml into place
cp compose/docker-compose.override.yml-blackfire docker-compose.override.yml

# Create .env variable
echo "BLACKFIRE_SERVER_ID=<valid server id>"       >> .env
echo "BLACKFIRE_SERVER_TOKEN=<valid server token>" >> .env

echo "#BLACKFIRE_SERVER=1.12.0"                    >> .env
echo "#BLACKFIRE_SERVER=1.13.0"                    >> .env
echo "#BLACKFIRE_SERVER=1.14.0"                    >> .env
echo "#BLACKFIRE_SERVER=1.14.1"                    >> .env
echo "#BLACKFIRE_SERVER=1.15.0"                    >> .env
echo "#BLACKFIRE_SERVER=1.16.0"                    >> .env
echo "#BLACKFIRE_SERVER=1.17.0"                    >> .env
echo "#BLACKFIRE_SERVER=1.17.1"                    >> .env
echo "#BLACKFIRE_SERVER=1.18.0"                    >> .env
echo "BLACKFIRE_SERVER=latest"                     >> .env

# Start container
docker-compose up -d php httpd bind blackfire