Skip to content

Commit

Permalink
add blackfire for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-rolland committed Jul 15, 2024
1 parent fd52627 commit 555f0ea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .docker/docker_run_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ if [ $PS_DEMO_MODE -ne 0 ]; then
sed -ie "s/define('_PS_MODE_DEMO_', false);/define('_PS_MODE_DEMO_',\ true);/g" /var/www/html/config/defines.inc.php
fi

if [ $BLACKFIRE_ENABLE -eq 1 ]; then
if [ "$BLACKFIRE_SERVER_ID" = "0" ] || [ "$BLACKFIRE_SERVER_TOKEN" = "0" ]; then
echo "\n* BLACKFIRE_SERVER_ID and BLACKFIRE_SERVER_TOKEN environment variables missing."
echo "\n* Skipping blackfire install..."
else
echo "\n* Installing Blackfire..."
wget -q -O - https://packages.blackfire.io/gpg.key | dd of=/usr/share/keyrings/blackfire-archive-keyring.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/blackfire-archive-keyring.asc] http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list
apt update
apt install -y blackfire
blackfire agent:config --server-id=$BLACKFIRE_SERVER_ID --server-token=$BLACKFIRE_SERVER_TOKEN
service blackfire-agent restart
apt install -y blackfire-php
fi
fi

echo "\n* Almost ! Starting web server now\n";

exec apache2-foreground
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ services:
PS_ERASE_DB: ${PS_ERASE_DB:-0}
ADMIN_MAIL: ${ADMIN_MAIL:[email protected]}
ADMIN_PASSWD: ${ADMIN_PASSWD:-Correct Horse Battery Staple}
BLACKFIRE_ENABLE: ${BLACKFIRE_ENABLE:-0}
BLACKFIRE_SERVER_ID: ${BLACKFIRE_SERVER_ID:-0}
BLACKFIRE_SERVER_TOKEN: ${BLACKFIRE_SERVER_TOKEN:-0}
command: ["/tmp/wait-for-it.sh", "--timeout=60", "--strict", "mysql:3306", "--", "/tmp/docker_run_git.sh"]
ports:
- "8001:80"
Expand Down

0 comments on commit 555f0ea

Please sign in to comment.