The release notes for 1.8.0 state that Blackfire is now already included. Unfortunately, I have no clue how Blackfire can be used. I tried using an additional docker-compose.yml, but profiling in Chrome fails.
version: '3.6'
services:
blackfire:
container_name: ddev-${DDEV_SITENAME}-blackfire
image: blackfire/blackfire
ports: ['8707']
environment:
BLACKFIRE_SERVER_ID: my-server-id
BLACKFIRE_SERVER_TOKEN: my-server-token
web:
links:
- blackfire:$DDEV_HOSTNAME
I guess what the release notes should say that the blackfire.io PHP packages were added.
The original issue where people were getting along pretty well was https://github.com/drud/ddev/issues/653 - I know of no reason that shouldn't still work, but shouldn't require a separate container any more.
Got it working by using the docker-compose file from above, plus an additional php config file:
[PHP]
blackfire.agent_socket = tcp://blackfire:8707
Documentation is still missing, please reopen this ticket!
The original info was in https://github.com/drud/ddev/issues/653, but I do think it would be great to get the blackfire setup into github.com/drud/ddev-contrib. Would you be interested in following up on #653 and putting a PR in there?
In current versions of ddev and blackfire the following is enough to get it up and running:
add docker-compose.blackfire.yaml with the blackfire image:
version: '3.6'
services:
blackfire:
container_name: ddev-${DDEV_SITENAME}-blackfire
image: blackfire/blackfire
ports: ['8707']
environment:
BLACKFIRE_SERVER_ID: YOUR_SERVER_ID
BLACKFIRE_SERVER_TOKEN: YOUR_SERVER_TOKEN
web:
links:
- blackfire:$DDEV_HOSTNAME
and add the following custom php configuration for ddev (php/php.ini for example):
blackfire.agent_socket = tcp://blackfire:8707
Companion and client then work out of the box, no further adjustments needed.
I'll see if I can do a PR for the setup instructions.
While this seems to work fine on my colleagues' Macs, I was unable to get it work on my Debian Linux machine. Was anybody able to get this to work on a Linux machine? Apparently the chrome plugin can not connect to the php process or whatever it is it is trying to do.
There's a more complete writeup in https://github.com/drud/ddev-contrib/blob/master/docker-compose-services/blackfire/README.md - Please follow up in an issue there with specifics about what specifically doesn't work. There's really no difference between linux and macOS, since everything is happening inside the containers. Happy to work with you on it here or there, but I think there would be better. Also happy to chat in Drupal slack #ddev channel. Closing this one now since it's all done in ddev-contrib.
@killes i'm running Ubuntu 18.04 with latest chrome. the companion plugin works fine and the above snippet from susi is working too for me (created a file 1:1 like in the snippet just with real credentials)
I'm still having issues getting my DDEV project working with Blackfire. I have added the docker-compose.blackfire.yaml and it gets built correctly, but when I try to profile using the Chrome extension I get the following error:
Are you authorized to profile this page? Probe not found, invalid signature (HTTP 200). Troubleshooting?
I've read over the documentation and made sure to add the server id and token to the docker-compose.blackfire.yaml file. Still no luck.
I then sshed into the blackfire container ddev ssh --service blackfire and ran a blackfire-agent -d to see configuration, and everything seems to be correct.
However in the documentation README linked in rfay's comment above, there is mention of editing php.ini and changing the blackfire.agent_socket. Which php.ini file on which container?
While sshed into the blackfire container, I tried running blackfire-agent -register, which asked me to re-enter the server id and token. When finished it said to sudo /etc/init.d/blackfire-agent restart however that file does not exist on the blackfire container, nor on the web container.
Any help would be greatly appreciated!
I just haven't had any trouble with the recipe in https://github.com/drud/ddev-contrib/tree/master/docker-compose-services/blackfire - nothing like you're having. I hope you'll do a PR or issue on ddev-contrib if you sort out what's going on.
Thanks @rfay ! @mglaman was kind enough to help me on the slack channel. The missing piece for me was creating a custom php.ini file in my .ddev/php folder and adding the override for the blackfire.agent_socket, e.g.:
[blackfire]
blackfire.agent_socket = tcp://blackfire:8707
Perhaps the blackfire documentation at https://github.com/drud/ddev-contrib/blob/master/docker-compose-services/blackfire/README.md can be updated to explain how one needs to move/copy the contents of https://github.com/drud/ddev-contrib/blob/master/docker-compose-services/blackfire/php/blackfire.ini and place into a new (or existing) custom php configuration file which is outlined at https://ddev.readthedocs.io/en/latest/users/extend/customization-extendibility/#providing-custom-php-configuration-phpini
It's not obvious, especially to a n00b like myself ;)
Most helpful comment
In current versions of ddev and blackfire the following is enough to get it up and running:
add
docker-compose.blackfire.yamlwith the blackfire image:version: '3.6' services: blackfire: container_name: ddev-${DDEV_SITENAME}-blackfire image: blackfire/blackfire ports: ['8707'] environment: BLACKFIRE_SERVER_ID: YOUR_SERVER_ID BLACKFIRE_SERVER_TOKEN: YOUR_SERVER_TOKEN web: links: - blackfire:$DDEV_HOSTNAMEand add the following custom php configuration for ddev (
php/php.inifor example):blackfire.agent_socket = tcp://blackfire:8707Companion and client then work out of the box, no further adjustments needed.
I'll see if I can do a PR for the setup instructions.