2020-08-01 19:03:24 +07:00
|
|
|
add_blackfire_linux() {
|
|
|
|
sudo mkdir -p /var/run/blackfire
|
2020-11-11 03:53:45 +07:00
|
|
|
get -s -n "" https://packages.blackfire.io/gpg.key | sudo apt-key add -
|
2020-08-01 19:03:24 +07:00
|
|
|
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list
|
|
|
|
sudo "${debconf_fix:?}" apt-get update
|
2021-04-20 18:48:15 +07:00
|
|
|
${apt_install:?} blackfire
|
|
|
|
sudo chmod -R 777 /var/run/blackfire /etc/blackfire/agent
|
2020-08-01 19:03:24 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
add_blackfire_darwin() {
|
|
|
|
sudo mkdir -p /usr/local/var/run
|
2021-04-20 18:48:15 +07:00
|
|
|
add_brew_tap blackfireio/homebrew-blackfire
|
|
|
|
brew install blackfire
|
2020-08-01 19:03:24 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
blackfire_config() {
|
|
|
|
if [[ -n $BLACKFIRE_SERVER_ID ]] && [[ -n $BLACKFIRE_SERVER_TOKEN ]]; then
|
2021-04-20 18:48:15 +07:00
|
|
|
blackfire agent:config --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN"
|
2021-08-10 15:33:14 +07:00
|
|
|
[ "$os" = "Linux" ] && sudo systemctl start blackfire-agent
|
2021-04-20 18:48:15 +07:00
|
|
|
[ "$os" = "Darwin" ] && brew services start blackfire
|
2020-08-01 19:03:24 +07:00
|
|
|
fi
|
|
|
|
if [[ -n $BLACKFIRE_CLIENT_ID ]] && [[ -n $BLACKFIRE_CLIENT_TOKEN ]]; then
|
2021-04-20 18:48:15 +07:00
|
|
|
blackfire client:config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN"
|
2020-08-01 19:03:24 +07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-04-20 18:48:15 +07:00
|
|
|
# Function to add blackfire cli.
|
2020-08-01 19:03:24 +07:00
|
|
|
add_blackfire() {
|
|
|
|
os="$(uname -s)"
|
|
|
|
[ "$os" = "Linux" ] && add_blackfire_linux >/dev/null 2>&1
|
|
|
|
[ "$os" = "Darwin" ] && add_blackfire_darwin >/dev/null 2>&1
|
|
|
|
blackfire_config >/dev/null 2>&1
|
2020-09-28 12:28:02 +07:00
|
|
|
tool_version=$(get_tool_version "blackfire" "version")
|
|
|
|
add_log "${tick:?}" "blackfire" "Added blackfire $tool_version"
|
2020-08-01 19:03:24 +07:00
|
|
|
}
|