在部署时从 ELB 环境变量设置 Newrelic APP 名称
Set Newrelic APP name from ELB env variable on deploy
我需要将相同的 PHP 代码部署到 AWS Elastic beanstalk 上的 3 个环境。这些环境将在 New relic 上报告给不同的应用程序名称。
无法将 newrelic 许可证密钥部署到存储库。
请提出实现这一目标的策略。
对于 PHP 在 AWS Elastic Beanstalk 中,您的步骤是:
In the .ebextensions folder inside your Elastic BeanStalk application,
create a new file named newrelic.config. Add the following content to
the file:
packages:
yum:
newrelic-php5: []
rpm:
newrelic: INSERT_LINK_TO_AGENT
commands:
configure_new_relic:
command: newrelic-install install
env:
NR_INSTALL_SILENT: true
NR_INSTALL_KEY: INSERT_LICENSE_KEY
如果您使用的是密码保险库,那么您将遵循他们的最佳做法。如果不是,那么您可能必须创建一个 shell 脚本来替换安全 S3 存储桶中的许可证密钥。
将您的许可证密钥放入安全的 S3 存储桶中。然后使用类似于 Bash 的脚本:
#!/bin/bash
password=$(aws ssm get-parameters --region us-east-1 --names MySecureLicenseKey --with-decryption --query Parameters[0].Value)
# code to replace INSERT_LICENSE_KEY - need to update the path to where you have it land
sed 's/INSERT_LICENSE_KEY/$password/g' /etc/newrelic/newrelic.config
我需要将相同的 PHP 代码部署到 AWS Elastic beanstalk 上的 3 个环境。这些环境将在 New relic 上报告给不同的应用程序名称。
无法将 newrelic 许可证密钥部署到存储库。
请提出实现这一目标的策略。
对于 PHP 在 AWS Elastic Beanstalk 中,您的步骤是:
In the .ebextensions folder inside your Elastic BeanStalk application, create a new file named newrelic.config. Add the following content to the file:
packages:
yum:
newrelic-php5: []
rpm:
newrelic: INSERT_LINK_TO_AGENT
commands:
configure_new_relic:
command: newrelic-install install
env:
NR_INSTALL_SILENT: true
NR_INSTALL_KEY: INSERT_LICENSE_KEY
如果您使用的是密码保险库,那么您将遵循他们的最佳做法。如果不是,那么您可能必须创建一个 shell 脚本来替换安全 S3 存储桶中的许可证密钥。
将您的许可证密钥放入安全的 S3 存储桶中。然后使用类似于 Bash 的脚本:
#!/bin/bash
password=$(aws ssm get-parameters --region us-east-1 --names MySecureLicenseKey --with-decryption --query Parameters[0].Value)
# code to replace INSERT_LICENSE_KEY - need to update the path to where you have it land
sed 's/INSERT_LICENSE_KEY/$password/g' /etc/newrelic/newrelic.config