To set up Blackfire on CircleCI, your need to define some environment variables in the build settings of your project.
Define environment variables for your Client credentials:
Define environment variables for the Server credentials. Choose the credentials you want to use:
In order to ease the integration with your CircleCI workflows, Blackfire provides several orbs in the CircleCI Orb Registry:
To use the Blackfire orbs, you need to allow the use 3rd party orbs; this must
be done on the
Settings > Security page for your organization.
This operation needs to be done by an administrator of your CircleCI organization.
Here is a configuration snippet using the Blackfire orb for PHP:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
version: 2.1 orbs: blackfire: email@example.com jobs: build: docker: # You may use another Docker image. - image: circleci/php:7.4-fpm-node steps: - checkout - blackfire/setup - run: name: Tests environment: APP_DEBUG: 0 command: php bin/phpunit
Running Blackfire from CircleCI builds requires to import the
blackfireio/php orb and to run the
setup command, right after the code
checkout. The command will install the probe, the agent, and the player.
Using orbs requires to use version
2.1 of the CircleCI DSL. If your
project was added to CircleCI prior to
2.1, you must enable “pipelines”
Your Project > Settings > Advanced Settings.
The snippet above works with any Docker image provided by CircleCI as they are based on official PHP Debian images.
It also works when using the “machine” executor.
A command is available in the Agent orb for triggering a Blackfire build:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
version: 2.1 orbs: blackfire: firstname.lastname@example.org blackfire-agent: email@example.com jobs: blackfire-build-example: docker: - image: circleci/php:7.4-fpm-node steps: - checkout - blackfire-agent/build-trigger: endpoint: "https://staging.my-webapp.tld/" # Blackfire Environment name or UUID # Can be only a part of the environment name, as long as it is not ambiguous. environment: My Blackfire Environment Name