这就是我想要做的。--> 在 Heroku 上部署一个 play framework (2.2.1) Java web 应用程序,并使用 newrelic 作为插件。
**问题/问题:* *
这些是我到目前为止所做的步骤。
1)我可以使用插件“heroku addons:add newrelic:stark”的heroku命令添加插件,我在heroku资源中看到了插件。
2) 添加 newrelic.yml 文件。添加 newrelic.yml 文件作为附件并保存在播放框架的 conf 文件夹中(是否存在 application.conf 文件)。我拿起的文件来自https://gist.github.com/anfuerer/6169040 (刚刚更新了许可证和应用程序信息)
3)作为它的play 2.2.1,改变了built.sbt文件添加依赖。
"com.newrelic.agent.java" % "newrelic-agent" % "3.4.0",
"com.newrelic.agent.java" % "newrelic-api" % "3.4.0"
4) heroku 所需的我的 Procfile 指定了 JAVA_OPTS 并使用命令设置 JAVA_OPTS
heroku config:set JAVA_OPTS=”-Xmx384m -Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -javaagent:target/staged/newrelic-agent-3.4.0.jar -Dnewrelic.bootstrap_classpath=true -Dnewrelic.config .file=./conf/newrelic.yml newrelic.config.log_level=finer newrelic.debug=true”</p>
5) 显然,所有更改都添加到 git 并在通过命令“git heroku push master”推送到 heroku 之前提交。
6)一些基本的健全性测试..我在heroku config命令之后看到我的配置 -
JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -javaagent:target/staged/newrelic-agent-3.4.0.jar -Dnewrelic.bootstrap_classpath=true -Dnewrelic.config.file=./conf/newrelic.yml newrelic.config.log_level=finer newrelic.debug=true
NEW_RELIC_APP_NAME: test_application
NEW_RELIC_LICENSE_KEY: 000000000000000000000000000000000 (changed offcourse)
NEW_RELIC_LOG: stdout
PATH: .jdk/bin:.sbt_home/bin:/usr/local/bin:/usr/bin:/bin
REPO: /app/.sbt_home/.ivy2/cache
SBT_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops
还尝试通过“heroku run env | grep NEW_RELIC”进行检查,这给了我输出 -
NEW_RELIC_LOG=stdout
NEW_RELIC_LICENSE_KEY=00000000000000000000000000000
NEW_RELIC_APP_NAME=test_application
现在我转到我的 Heroku 应用程序仪表板,单击我的应用程序以查看附加组件,然后单击新的遗物,然后我来到一个屏幕,要求我设置我的应用程序-
我单击设置,但它需要我下载 Java 代理,并且它要我将 Java 代理安装到网络服务器上。
#################编辑尝试根据@Jeanie 的评论在 Play 应用程序框架上安装 java newrelic
1) 在下载文件夹中下载新的 relic java 代理。
2)解压缩到播放框架应用程序文件夹(项目文件夹)(这需要是播放构建文件所在的播放框架文件夹吗??)使用
unzip newrelic_agent3.4.0.zip -d /path/to/appserver/
3) 将目录更改为 /appfolder/newrelic/
4)使用安装罐子
java -jar newrelic.jar install
5)这是我收到的信息。
Jan 20, 2014 12:48:39 -0700 [6935 1] com.newrelic INFO: Agent is using Logback
***** ( ( o)) New Relic Java Agent Installer
***** Installing version 3.4.0 ...
Could not edit start script because:
.:. Could not locate a Tomcat, Jetty, JBoss, JBoss7 or Glassfish instance in /home/amit/Applications/play-2.2.1/appfolder/
Try re-running the install command with the -s <AppServerRootDirectory> option or from <AppServerRootDirectory>/newrelic.
If that doesn't work, locate and edit the start script manually.
No need to create New Relic configuration file because:
.:. A config file already exists: /home/amit/Applications/play-2.2.1/appfolder/newrelic/newrelic.yml
***** Install incomplete
***** Next steps:
For help completing the install, see https://newrelic.com/docs/java/new-relic-for-java
我在这里错过了什么吗?请注意,这是一个 Play 框架应用程序,我希望 newrelic 插件在 heroku 上工作,而不是在我的机器上本地工作。
#问题:
1)如何在heroku上安装java代理?我需要首先吗?
2) Heroku 和 new relic 不应该添加我的应用程序,因为我已经在步骤 3 中添加了 api 和 java 代理作为插件吗?
任何帮助或方向表示赞赏。