Add Blackfire.io to Docker
You can add Blackfire.io to your Magento Cloud Docker environment to fully automate performance testing.
Blackfire.io for Magento Cloud is a PHP profiler and automated performance testing tool for use in development, integration, staging, and production environments. It enables you to locate and investigate performance issues in your environment at the code level and creates a performance profile by tracking every PHP call, method, and SQL query performed by your code.
You must have a Blackfire license and account to use Blackfire.io with Magento Commerce Cloud projects. See Blackfire.io for Magento Cloud.
To add Blackfire.io to your project configuration:
-
Add the following Blackfire.io configuration to the
runtime:extensions
section of the.magento.app.yaml
file.1 2 3 4 5 6 7 8 9 10
runtime: extensions: - random-extension-here - name: blackfire configuration: server_id: SERVER_ID server_token: SERVER_TOKEN client_id: CLIENT_ID client_token: CLIENT_TOKEN
-
Generate the
docker-compose.yml
file for developer mode, adding any required build or service configuration options and file synchronization options if needed.1
./vendor/bin/ece-docker build:compose --mode="developer"
-
Start the Magento Cloud Docker environment.
1
./bin/magento-docker up
1
./bin/magento-docker ece-redeploy
If you are using file synchronization, synchronize files as needed. See Launch Docker in developer mode
-
Add context to use locally customized PHP images as described in Extend the Docker configuration.
-
Install Magento in your Docker environment.
-
Deploy Magento in the Docker container.
1
docker-compose run --rm deploy cloud-deploy
1
docker-compose run --rm deploy magento-command deploy:mode:set developer
-
Run post-deploy hooks.
1
docker-compose run --rm deploy cloud-post-deploy
Review messages and notifications during the deployment process and address any errors or notifications as needed.
-
-
Enable the Varnish cache for the Magento application.
1
docker-compose run --rm deploy magento-command config:set system/full_page_cache/caching_application 2 --lock-env
1
docker-compose run --rm deploy magento-command setup:config:set --http-cache-hosts=varnish
-
Clear the cache.
1
docker-compose run --rm deploy magento-command cache:clean
-
Make sure necessary containers are up and running.
1
docker-compose ps
To use Blackfire.io for Magento performance testing in Cloud Docker:
-
Install a profiling client as described in the Blackfire documentation.
-
Profile the Magento website. See the [Blackfire.io documentation].