Using Blackfire Player with Docker
You may now use Blackfire Player with Docker.
Blackfire Player is a powerful HTTP client one may use for crawling, testing, and scraping web pages. It provides a DSL with which one can define scenarios, run assertions, and extract data. And yes, it is open-source!
Using its thorough DSL, Blackfire Player also integrates with Blackfire Profiler so that running scenarios can create builds where each step is getting profiled. Combined with tests and metrics one can define in their
.blackfire.yaml, it provides a powerful way to run performance tests.
In fact, Blackfire Player is even used to run your periodic builds!
Blackfire Player is written in PHP. Therefore, if one wants to run scenarios with it must have PHP installed. While this is usually not a problem when developing a PHP application, it may be an annoying dependency in some cases:
- Working on a Python application
- Running scenarios from a “runner” machine in a CI pipeline, where PHP might not be available
In such situations, using Docker is usually a good solution. This is why we now provide a dockerized version of Blackfire Player!
To use it, one first needs to properly expose
BLACKFIRE_CLIENT_TOKEN environment variables using their client credentials.
The command is the following:
docker run --rm -it -e BLACKFIRE_CLIENT_ID -e BLACKFIRE_CLIENT_TOKEN -v "`pwd`:/app" blackfire/player run my-scenario.bkf
To make it easier to use, one may create a shell alias (in
alias blackfire-player="docker run --rm -it -e BLACKFIRE_CLIENT_ID -e BLACKFIRE_CLIENT_TOKEN -v \"`pwd`:/app\" blackfire/player"
This way, it is possible to run the
blackfire-player command as if it was the binary itself:
blackfire-player --version blackfire-player list blackfire-player run my-scenario.bkf
Give Blackfire a try
Blackfire Profiler integration with Blackfire Player is available for Premium and Enterprise plans.
Play with the demo or subscribe now!
Happy Performance Optimization!