forked from heroku/heroku-buildpack-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request heroku#94 from deguif/blackfire_refactor_specials_…
…exts Add blackfire install on heroku
- Loading branch information
Showing
5 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
install_blackfire_ext() { | ||
# special treatment for Blackfire; we enable it if we detect a server id and a server token for it | ||
# otherwise users would have to have it in their require section, which is annoying in development environments | ||
BLACKFIRE_SERVER_ID=${BLACKFIRE_SERVER_ID:-} | ||
BLACKFIRE_SERVER_TOKEN=${BLACKFIRE_SERVER_TOKEN:-} | ||
if [[ ( ${#exts[@]} -eq 0 || ! ${exts[*]} =~ "blackfire" ) && -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_ID" ]]; then | ||
install_ext "blackfire" "add-on detected" | ||
exts+=("blackfire") | ||
fi | ||
} | ||
|
||
install_blackfire_agent() { | ||
# blackfire defaults | ||
cat > $BUILD_DIR/.profile.d/blackfire.sh <<"EOF" | ||
if [[ -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_TOKEN" ]]; then | ||
touch /app/.heroku/php/var/blackfire/run/agent.sock | ||
/app/.heroku/php/bin/blackfire-agent -config=/app/.heroku/php/etc/blackfire/agent.ini -socket="unix:///app/.heroku/php/var/blackfire/run/agent.sock" & | ||
fi | ||
EOF | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extension = blackfire.so | ||
|
||
blackfire.server_token = ${BLACKFIRE_SERVER_TOKEN} | ||
blackfire.server_id = ${BLACKFIRE_SERVER_ID} | ||
blackfire.agent_socket = "unix:///app/.heroku/php/var/blackfire/run/agent.sock" |
37 changes: 37 additions & 0 deletions
37
support/build/extensions/no-debug-non-zts-20121212/blackfire
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
# Build Path: /app/.heroku/php | ||
|
||
OUT_PREFIX=$1 | ||
|
||
# fail hard | ||
set -o pipefail | ||
# fail harder | ||
set -eux | ||
|
||
ext_dir=${OUT_PREFIX}/lib/php/extensions/no-debug-non-zts-${ZEND_MODULE_API_VERSION:=20121212} | ||
bin_dir=${OUT_PREFIX}/bin | ||
|
||
probe_version=`curl -A "Heroku" -o probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/${PHP_MAJOR_VERSION:=5}${PHP_MINOR_VERSION:=5} | grep 'X-Blackfire-Release-Version: ' | sed "s%X-Blackfire-Release-Version: %%" | sed s%.$%%` | ||
echo "-----> Packaging ext/blackfire ${probe_version} (for Zend module API version ${ZEND_MODULE_API_VERSION})..." | ||
|
||
mkdir -p ${ext_dir} | ||
tar -zxf probe.tar.gz | ||
cp blackfire-${ZEND_MODULE_API_VERSION}.so ${ext_dir}/blackfire.so | ||
rm probe.tar.gz blackfire-${ZEND_MODULE_API_VERSION}.so blackfire-${ZEND_MODULE_API_VERSION}.sha | ||
|
||
echo "-----> Done." | ||
|
||
agent_version=`curl -A "Heroku" -o agent.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/agent/linux/amd64 | grep 'X-Blackfire-Release-Version: ' | sed "s%X-Blackfire-Release-Version: %%" | sed s%.$%%` | ||
echo "-----> Packaging bin/blackfire-agent ${agent_version}..." | ||
|
||
mkdir -p ${OUT_PREFIX}/blackfire | ||
mkdir -p ${OUT_PREFIX}/var/blackfire/run | ||
mkdir -p ${OUT_PREFIX}/etc/blackfire | ||
echo -e "[blackfire]\nserver-id=f1abf3a8-3f85-4743-99b2-97f066c099b9\nserver-token=5ecbc6486e9db6b780a0c0a9ef1e244709e632996fe9105cb9075ab2826944d5" > ${OUT_PREFIX}/etc/blackfire/agent.ini | ||
mkdir -p ${bin_dir} | ||
tar -zxf agent.tar.gz | ||
chmod +x agent | ||
cp agent ${bin_dir}/blackfire-agent | ||
rm agent.tar.gz agent agent.sha1 | ||
|
||
echo "-----> Done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
# Build Path: /app/.heroku/php/ | ||
|
||
ZEND_MODULE_API_VERSION=20131226 | ||
PHP_MINOR_VERSION=6 | ||
|
||
source $(dirname $0)/../no-debug-non-zts-20121212/$(basename $0) |