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,50 @@ 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
13
+ php_series=" $( echo " $php_version " | cut -d ' .' -f1,2) "
14
+ # https://docs. blackfire.io/up-and-running/installation?action=install&mode=full&location=local&os=manual&language=php&version=latest& #install-the-php-probe
15
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
16
+ # → 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.
17
+ blackfire_probe_version=1.92.41
18
+ # https://docs. blackfire.io/up-and-running/installation?action=install&mode=full&location=local&os=manual&language=php&version=latest& #install-the-packages
19
19
#
20
20
# → Select "Linux Binary", 64 bits and you'll see the last version
21
- blackfire_agent_version=2.13.2
21
+ blackfire_agent_version=2.29.0
22
22
bin_dir=${PREFIX} /bin
23
23
24
24
# Blackfire Probe
25
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"
26
+ " https://packages.blackfire.io/binaries/blackfire-php/${blackfire_probe_version} /blackfire-php-linux_amd64-php-$( echo " $php_series " | tr -d ' .' ) .so"
27
27
28
- mkdir -p ${EXT_DIR}
29
- mv blackfire.so ${EXT_DIR} /blackfire.so
28
+ mkdir -p " ${EXT_DIR} "
29
+ mv blackfire.so " ${EXT_DIR} /blackfire.so"
30
30
31
- # AGENT
32
- curl --user-agent " Scalingo" --output agent.tar.gz \
31
+ # Blackfire Agent
32
+ curl --user-agent " Scalingo" --output blackfire- agent.tar.gz \
33
33
--dump-header - --location --silent \
34
- https://blackfire.io/api/v1/releases/agent /linux/amd64
34
+ https://blackfire.io/api/v1/releases/cli /linux/amd64
35
35
36
36
echo " -----> Packaging bin/blackfire-agent ${blackfire_agent_version} ..."
37
37
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}
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} "
42
42
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
43
+ tar -zxf blackfire- agent.tar.gz
44
+ chmod +x blackfire
45
+ cp blackfire " ${bin_dir} /blackfire-agent"
46
+ rm blackfire- agent.tar.gz blackfire blackfire .sha1
47
47
48
48
# CLI
49
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
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"
52
52
53
53
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
54
55
55
# gets sourced on container boot
56
- cat > ${PREFIX} /bin/profile.blackfire.sh << 'EOF '
56
+ cat > " ${PREFIX} /bin/profile.blackfire.sh" << 'EOF '
57
57
if [[ -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_ID" ]]; then
58
58
if [[ -f "/app/vendor/php/bin/blackfire-agent" ]]; then
59
59
touch /app/vendor/php/var/blackfire/run/agent.sock
@@ -64,8 +64,8 @@ if [[ -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_ID" ]]; then
64
64
fi
65
65
EOF
66
66
67
- mkdir -p ${PREFIX} /etc/php/conf.d
68
- cat > ${PREFIX} /etc/conf.d/blackfire.ini << 'EOF '
67
+ mkdir -p " ${PREFIX} /etc/php/conf.d"
68
+ cat > " ${PREFIX} /etc/conf.d/blackfire.ini" << 'EOF '
69
69
extension = blackfire.so
70
70
71
71
blackfire.server_token = ${BLACKFIRE_SERVER_TOKEN}
0 commit comments