Installing Blackfire with Chef

By Tugdual Saunier, on Feb 12, 2015

At Blackfire, we want to make profiling easier and simpler, even in production!

Blackfire’s stack is safe to be used in production, but you probably don’t want to install everything by hand on your production infrastructure, neither do we!

To help anyone setup Blackfire in a production environment, we’ve just open-sourced our internal Chef cookbook used to provision Blackfire.

As an added bonus, the cookbook automatically updates Blackfire packages to the latest versions when needed.

To use it, just install the blackfire cookbook as you do for every other cookbook usingBerkshelf or librarian-chef and include blackfire in your node’s run_list:

{
    "name":"my_node",
    "run_list": [
        "recipe[blackfire]"
    ]
}

And define your server credentials as attributes (you can retrieve them in your account page):

node['blackfire']['agent']['server_id'] = 'my_server_id'
node['blackfire']['agent']['server_token'] = 'my_server_token'

You can also only install the agent using the blackfire::agent recipe or only the probe using the blackfire::php recipe.

Note: Our cookbook (as our packages) makes no assumptions about the webserver you are using, therefore you need to write a wrapper to reload your webserver accordingly, you can read our README for more information.

You can find our cookbook on the Chef Supermarket or on Github.

We would like to thank Olivier Dolbeau for maintaining the previous version of the cookbook while we were preparing to open source our version.

Happy production profiling!

Tugdual Saunier

Tugdual is a Product Developer at Blackfire.io. He started PHP programming when he was a teenager, and hasn’t stopped since. He discovered Symfony right after his studies and soon joined SensioLabs. A couple of years ago, with Fabien Potencier, he was exploring some options to optimize Symfony and Twig. And they got so frustrated by how hard it was to evaluate performance impact of some changes in code that they decided to explore the options available to improve the situation.