编程语言
首页 > 编程语言> > 在heroku play framework 2.2.1 java app中添加新的relic插件

在heroku play framework 2.2.1 java app中添加新的relic插件

作者:互联网

这就是我想要做的. – &GT在Heroku上部署一个Play框架(2.2.1)Java Web应用程序,并使用newrelic作为附加组件.

**问题/问题:**

这些是我到目前为止所做的步骤.

1)我能够使用addon的heroku命令添加插件“heroku addons:add newrelic:stark”我在heroku资源中看到了add.

2)添加newrelic.yml文件.添加了newrelic.yml文件作为附加并保存在play框架的conf文件夹中(是否存在application.conf文件).我收到的文件来自https://gist.github.com/anfuerer/6169040(刚更新的许可证和应用信息)

3)作为其播放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“

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)在downloads文件夹中下载新的遗留java代理.

2)解压缩到play framework app文件夹(项目文件夹)(这需要是播放框架文件夹,其中播放构建文件是??)使用

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和新的遗物添加我的应用程序,因为我已经添加了api和java代理作为第3步的添加?

任何帮助或方向赞赏.

解决方法:

问题解决了.这是步骤.

1)获取Heroku上的添加

$heroku addons:add newrelic:stark

2)转到您的应用仪表板并单击资源.然后单击新的遗物插件.这会将您带到一个页面,要求您进行设置.

3)单击设置,选择Java,单击以查看许可证编号并下载jar文件.

4)如设置页面所述,将jar文件解压缩到项目的根目录.不要运行安装程序,因为您需要在Heroku上使用新文件.

5)编辑Heroku Procfile如下:

web: target/universal/stage/bin/myapp -Dhttp.port=${PORT} ${java_opts} -DapplyEvolutions.default=true -Ddb.default.driver=com.mysql.jdbc.Driver -Ddb.default.url=${CLEARDB_DATABASE_URL} -J-javaagent:newrelic/newrelic.jar -J-Dnewrelic.config.file=newrelic/newrelic.yml 

(根据需要更改其他设置,保持新的遗物设置不变,不要忘记在“target / universal / stage / bin / myapp”中将您的应用名称替换为myapp)

6)向build.sbt或Build.scala添加依赖项

"com.newrelic.agent.java" % "newrelic-agent" % "3.7.0"

7)使用git push heroku master将应用程序部署到heroku

8)将自动检测新遗物,设置页面将显示相关指标.

如果有人遇到任何问题,请告诉我.

标签:java,heroku,playframework-2-2,newrelic,newrelic-platform
来源: https://codeday.me/bug/20190612/1226580.html