1
1
#! /usr/bin/env bash
2
2
3
3
if [ -n " $DEBUG " ]; then
4
- set -x
4
+ set -x
5
5
fi
6
6
7
7
# fail hard
@@ -10,50 +10,46 @@ set -o pipefail
10
10
set -eu
11
11
12
12
php_version=${1:= 8.2}
13
- php_series=" $( echo $php_version | cut -d ' .' -f1,2) "
14
- # https://blackfire.io/docs/up-and-running/installation?action=install&mode=full&location=local&os=manual&language=php#install-the-php-probe
15
- #
16
- # → Select "Linux Binary", 64 bits, the right PHP version and you'll see the last version of the probe
17
- blackfire_probe_version=1.86.3
18
- # https://blackfire.io/docs/up-and-running/installation?action=install&mode=full&location=local&os=manual&language=php#install-the-packages
19
- #
20
- # → Select "Linux Binary", 64 bits and you'll see the last version
21
- blackfire_agent_version=2.13.2
22
- bin_dir=${PREFIX} /bin
23
-
24
- # Blackfire Probe
25
- curl --location --output blackfire.so \
26
- " https://packages.blackfire.io/binaries/blackfire-php/${blackfire_probe_version} /blackfire-php-linux_amd64-php-$( echo $php_series | tr -d ' .' ) .so"
13
+ php_series=" $( echo " $php_version " | cut -d ' .' -f1,2) "
27
14
28
- mkdir -p ${EXT_DIR}
29
- mv blackfire.so ${EXT_DIR} /blackfire.so
15
+ # https://docs.blackfire.io/up-and-running/installation?action=install&mode=full&location=local&os=manual&language=php&version=latest&#install-the-php-probe
16
+ #
17
+ # → Under "Install the PHP Probe", select "Linux Binary", 64 bits and your PHP version. Open the network inspector to identify the request triggered when you click on "Download". It contains the last version.
18
+ blackfire_probe_version=1.92.41
30
19
31
- # AGENT
32
- curl --user-agent " Scalingo " --output agent.tar.gz \
33
- --dump-header - --location --silent \
34
- https://blackfire.io/api/v1/releases/agent/linux/amd64
20
+ # https://docs.blackfire.io/up-and-running/installation?action=install&mode=full&location=local&os=manual&language=php&version=latest&#install-the-packages
21
+ #
22
+ # → Under "Install the Packages", select "Linux Binary" and 64 bits. Open the network inspector to identify the request triggered when you click on "Download". It contains the last version.
23
+ blackfire_agent_version=2.29.0
35
24
36
- echo " -----> Packaging bin/blackfire-agent ${blackfire_agent_version} ..."
25
+ mkdir --parents " ${EXT_DIR} "
26
+ bin_dir=${PREFIX} /bin
27
+ mkdir --parents " ${bin_dir} "
28
+ mkdir --parents " ${PREFIX} /var/blackfire/run"
29
+ mkdir --parents " ${PREFIX} /etc/blackfire"
37
30
38
- mkdir -p ${PREFIX} /var/blackfire/run
39
- mkdir -p ${PREFIX} /etc/ blackfire
40
- echo -e " [ blackfire]\nserver-id=f1abf3a8-3f85-4743-99b2-97f066c099b9\nserver-token=5ecbc6486e9db6b780a0c0a9ef1e244709e632996fe9105cb9075ab2826944d5 " > ${PREFIX} /etc/blackfire/agent.ini
41
- mkdir -p ${bin_dir}
31
+ echo " -----> Packaging Blackfire Probe ${blackfire_probe_version} ... "
32
+ curl --location --silent --output blackfire.so \
33
+ " https://packages. blackfire.io/binaries/blackfire-php/ ${blackfire_probe_version} /blackfire-php-linux_amd64-php- $( echo " $php_series " | tr -d ' . ' ) .so "
34
+ mv blackfire.so " ${EXT_DIR} /blackfire.so "
42
35
43
- tar -zxf agent.tar.gz
44
- chmod +x agent
45
- cp agent ${bin_dir} /blackfire-agent
46
- rm agent.tar.gz agent agent.sha1
36
+ echo " -----> Packaging Blackfire Agent ${blackfire_agent_version} ..."
37
+ curl --location --silent --output blackfire-agent.tar.gz \
38
+ " https://packages.blackfire.io/binaries/blackfire/${blackfire_agent_version} /blackfire-linux_amd64.tar.gz"
39
+ tar -zxf blackfire-agent.tar.gz
40
+ chmod +x blackfire
41
+ # Both the agent and the CLI are actually the same binary. For legacy purpose it is expected that the CLI is named `blackfire` and the agent is named `blackfire-agent`.
42
+ cp blackfire " ${bin_dir} /blackfire-agent"
43
+ cp blackfire " ${bin_dir} /blackfire"
44
+ chmod +x " ${bin_dir} /blackfire-agent" " ${bin_dir} /blackfire"
45
+ rm blackfire-agent.tar.gz blackfire blackfire.sha1
47
46
48
- # CLI
49
- echo " -----> Packaging bin/blackfire ${blackfire_agent_version} ..."
50
- curl https://packages.blackfire.io/binaries/blackfire-agent/${blackfire_agent_version} /blackfire-cli-linux_amd64 > ${bin_dir} /blackfire
51
- chmod +x ${bin_dir} /blackfire
47
+ echo -e " [blackfire]\nserver-id=f1abf3a8-3f85-4743-99b2-97f066c099b9\nserver-token=5ecbc6486e9db6b780a0c0a9ef1e244709e632996fe9105cb9075ab2826944d5" > " ${PREFIX} /etc/blackfire/agent.ini"
52
48
53
49
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
54
50
55
51
# gets sourced on container boot
56
- cat > ${PREFIX} /bin/profile.blackfire.sh << 'EOF '
52
+ cat > " ${PREFIX} /bin/profile.blackfire.sh" << 'EOF '
57
53
if [[ -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_ID" ]]; then
58
54
if [[ -f "/app/vendor/php/bin/blackfire-agent" ]]; then
59
55
touch /app/vendor/php/var/blackfire/run/agent.sock
@@ -64,8 +60,8 @@ if [[ -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_ID" ]]; then
64
60
fi
65
61
EOF
66
62
67
- mkdir -p ${PREFIX} /etc/php/conf.d
68
- cat > ${PREFIX} /etc/conf.d/blackfire.ini << 'EOF '
63
+ mkdir -p " ${PREFIX} /etc/php/conf.d"
64
+ cat > " ${PREFIX} /etc/conf.d/blackfire.ini" << 'EOF '
69
65
extension = blackfire.so
70
66
71
67
blackfire.server_token = ${BLACKFIRE_SERVER_TOKEN}
0 commit comments