-
-
Save tylers-username/8923149702d4a796c5e103412c2370c3 to your computer and use it in GitHub Desktop.
#### | |
## Blackfire config - `lando rebuild` required | |
#### | |
BLACKFIRE_CLIENT_ID=b5ee8ca3-****-****-****-5d227546a4c0 | |
BLACKFIRE_CLIENT_TOKEN=3a2b88cbfb*******************************22763 | |
BLACKFIRE_SERVER_ID=4b8ac335-****-****-****-b34439207732 | |
BLACKFIRE_SERVER_TOKEN=98f7fdf4b12b7**************************12b837cf080d |
name: my-php-project | |
services: | |
appserver: | |
type: php:7.0 | |
via: nginx:1.13 | |
ssl: true | |
webroot: pub | |
config: | |
# This provides our Blackfire environment credentials to PHP | |
conf: php.ini | |
build_as_root: | |
# Path to blackfireInit.sh | |
- ./blackfireInit.sh | |
tooling: | |
blackfire: | |
service: appserver | |
user: root | |
blackfire-agent: | |
service: appserver | |
user: root | |
blackfire-agent:service: | |
description: Start/Stop/Restart Blackfire agent service | |
cmd: | |
- /etc/init.d/blackfire-agent | |
service: appserver | |
user: root |
#!/usr/bin/env bash | |
# Configure Blackfire Repository | |
wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add - | |
echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list | |
apt-get update | |
# Install Blackfire Agent | |
apt-get install blackfire-agent -y | |
printf "%s\n" $BLACKFIRE_CLIENT_ID $BLACKFIRE_CLIENT_TOKEN | blackfire config | |
# Start blackfire on-boot | |
/etc/init.d/blackfire-agent restart | |
# Install Blackfire Probe | |
version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") | |
curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version | |
tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp | |
mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so | |
# Enable Blackfire Probe | |
docker-php-ext-enable blackfire |
# Blackfire Suggestions | |
[blackfire] | |
; Enterprise does not have the option to update Blackfire settings via .platform.app.yaml | |
; We're giving ourselves auto-update capabilities here | |
; Sets the socket where the agent is listening. | |
; Possible value can be a unix socket or a TCP address. | |
; Defaults to unix:///var/run/blackfire/agent.sock on Linux, | |
; unix:///usr/local/var/run/blackfire-agent.sock on MacOSX, | |
; and to tcp://127.0.0.1:8307 on Windows. | |
; blackfire.agent_socket = unix:///var/run/blackfire/agent.sock | |
; Log verbosity level (4: debug, 3: info, 2: warning, 1: error) | |
; blackfire.log_level = 4 | |
; Log file (STDERR by default) | |
; blackfire.log_file = "${LANDO_MOUNT}"/log/blackfire.log | |
; Sets fine-grained configuration for Probe. | |
; This should be left blank in most cases. For most installs, | |
; the server credentials should only be set in the agent. | |
blackfire.server_id="${BLACKFIRE_SERVER_ID}" | |
; Sets fine-grained configuration for Probe. | |
; This should be left blank in most cases. For most installs, | |
; the server credentials should only be set in the agent. | |
blackfire.server_token="${BLACKFIRE_SERVER_TOKEN}" |
For some reason I get an error:
/usr/bin/env: 'bash\r': No such file or directory
ERROR ==> /usr/bin/env: 'bash\r': No such file or directory
I have made sure I have no windows newline characters in the file, so I suppose this is a Lando thing?
For now I logged in via: lando ssh --service appserver --user root
, then lando restart
and then lando blackfire-agent:service start
and Blackfire profiling is working!
Hm, that looks like it may be related to Window's new line carriage return (/r
).
I'm glad you got it working!
Hey there!
You might be interested in the new Blackfire plugin for Lando: https://blackfire.io/docs/integrations/paas/lando
It is officially supported and comes with the latest probe and agent.
@lolautruche this is great news, thanks!
Hey there!
You might be interested in the new Blackfire plugin for Lando: https://blackfire.io/docs/integrations/paas/landoIt is officially supported and comes with the latest probe and agent.
Wow, perfect timing, just started searching and found this, thank you.
My pleasure 😉.
Feel free to report any issue in the Github repo. Feedback appreciated 😊
Update (Apr 22, 2020): Made compatible with Lando v3.0.0-rcc3
Notes
.env
(or whichever env file your Lando uses) will not be merged into the Lando environment variables untillando rebuild
is executedlando blackfire-agent:service start
after the initial rebuild