Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions support/ext/blackfire
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ echo -e "[blackfire]\nserver-id=f1abf3a8-3f85-4743-99b2-97f066c099b9\nserver-tok
find ${PREFIX} -type f \( -executable -o -name '*.a' \) -exec sh -c "file -i '{}' | grep -Eq 'application/x-(archive|executable|sharedlib); charset=binary'" \; -print | xargs strip --strip-unneeded

# gets sourced on container boot
blackfire_bin="/app/vendor/php/bin/blackfire"
blackfire_socket="/app/vendor/php/var/blackfire/run/agent.sock"
cat > "${PREFIX}/bin/profile.blackfire.sh" <<'EOF'
if [[ -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_ID" ]]; then
if [[ -f "/app/vendor/php/bin/blackfire-agent" ]]; then
touch /app/vendor/php/var/blackfire/run/agent.sock
/app/vendor/php/bin/blackfire-agent -config=/app/vendor/php/etc/blackfire/agent.ini -socket="unix:///app/vendor/php/var/blackfire/run/agent.sock" &
if [[ -f "${blackfire_bin}" ]]; then
touch "${blackfire_socket}"
export BLACKFIRE_CONFIG="/dev/null"
export BLACKFIRE_SOCKET="unix://${blackfire_socket}"

"${blackfire_bin}" agent:start &
else
echo >&2 "WARNING: Add-on 'blackfire' detected, but PHP extension not yet installed. Push an update to the application to finish installation of the add-on; an empty change ('git commit --allow-empty') is sufficient."
fi
Expand All @@ -63,8 +68,4 @@ EOF
mkdir --parents "${PREFIX}/etc/php/conf.d"
cat > "${PREFIX}/etc/conf.d/blackfire.ini" <<'EOF'
extension = blackfire.so

blackfire.server_token = ${BLACKFIRE_SERVER_TOKEN}
blackfire.server_id = ${BLACKFIRE_SERVER_ID}
blackfire.agent_socket = "unix:///app/vendor/php/var/blackfire/run/agent.sock"
EOF
EOF