Blackfire provides an official buildpack for Heroku. This buildpack lets you configure and use the Blackfire Agent and the Blackfire CLI Tool. It is complementary to other builpacks, such as official language support buildpacks provided by Heroku.
Configure the Blackfire credentials from your project root directory:
To auto-fill server credentials in the command below, or Sign Up first
heroku config:set BLACKFIRE_SERVER_ID=<SERVER-ID> heroku config:set BLACKFIRE_SERVER_TOKEN=<SERVER-TOKEN> heroku config:set BLACKFIRE_CLIENT_ID=<CLIENT-ID> heroku config:set BLACKFIRE_CLIENT_TOKEN=<CLIENT-TOKEN>
You may use your Blackfire personal server credentials or environment server credentials.
Add the Blackfire buildpack to your project:
heroku buildpacks:add --index=1 https://github.com/blackfireio/integration-heroku
Blackfire being part of the default PHP buildpack, if you are using PHP you don’t need to add the Blackfire buildpack. Read more details below.
As documented in Heroku devcenter, when using multiple buildpacks, the buildpack for the primary language of your app should be the last one added.
Blackfire is part of the default Heroku PHP buildpack.
To enable Blackfire when using the PHP official Heroku buildpack, add it as a
requirement in the project’s
composer require ext-blackfire
Install the Blackfire Probe by referring
blackfire as dependency in your
requirements.txt file, e.g.:
1 2 3 4
blackfire django jinja2 gunicorn
Your code needs to import and use the Go Blackfire SDK.
To set your config vars, you may use
heroku config:set command.
You may also define them in your app dashboard, in the Settings tab.
Each time you set or update a config var, you must
redeploy your app on Heroku, using a
git push heroku master.
The following configuration vars must be set:
Log files are located in your app at
If your app spans across several dynos, you might have to turn on Session Affinity
heroku features:enable http-session-affinity command so that only one
dyno is profiled when aggregation is enabled (the default).