-
-
Save aa6my/93c799d5cf7fcdc995840cf5ace822ae to your computer and use it in GitHub Desktop.
New Relic PHP agent (v9.21) on AWS Elastic Beanstalk AMI Linux 2 (arm based cpu)
This file contains hidden or 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
files: | |
"/etc/httpd/conf.modules.d/11-mpm.conf": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
LoadModule mpm_event_module modules/mod_mpm_event.so | |
"/etc/php.d/20-newrelic.ini": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
extension = "newrelic.so" | |
[newrelic] | |
newrelic.license = "YOUR_NEW_RELIC_LICENSE_KEY_HERE" | |
newrelic.logfile = "/var/log/newrelic/php-agent.log" | |
newrelic.appname = "YOUR_APP_NAME" | |
newrelic.daemon.logfile = "/var/log/newrelic/newrelic-daemon.log" | |
"/home/ec2-user/newrelic-setup.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/bin/bash | |
if [[ -f "/usr/bin/newrelic-daemon" ]]; then | |
echo "Skipping NewRelic installation as binary /usr/bin/newrelic-daemon already exists." | |
exit 0; | |
fi | |
yum install -y make glibc-devel gcc gcc-c++ patch golang php-devel bzip2 libcurl \ | |
libedit libjpeg libmcrypt libpng readline-devel libtidy libtool libxml2 libxslt \ | |
openssl pcre zlib pcre-devel | |
# download and unpack new relic | |
curl https://github.com/newrelic/newrelic-php-agent/archive/refs/tags/v9.21.tar.gz --output /tmp/newrelic.tar.gz -L | |
cd /tmp | |
tar -xvf newrelic.tar.gz | |
# compile new relic | |
cd newrelic-php-agent-9.21 | |
make | |
cp bin/daemon /usr/bin/newrelic-daemon | |
# make log folder for new relic | |
mkdir /var/log/newrelic/ | |
# install new relic agent in php | |
make agent-install | |
# restart services | |
/usr/bin/systemctl restart httpd.service | |
/usr/bin/systemctl restart php-fpm.service | |
# cleanup | |
rm -rf /tmp/newrelic-php-agent-9.21 | |
rm -rf /tmp/newrelic.tar.gz | |
container_commands: | |
install_newrelic: | |
command: /home/ec2-user/newrelic-setup.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment