Scala Play框架Web应用程序托管流程 [英] Scala Play framework web application hosting Process
问题描述
我正在使用scala和play框架从事Web项目.我担心应用程序部署部分.我需要将应用程序托管在Glass fish服务器中.那么有人在这方面有经验吗?我在托管javaEE应用程序方面有经验,将.war文件上传到服务器.但是我该如何托管Play应用程序呢? 我已经参考以下文章并建立dist. 生产区
I'm working in a web project using scala and play framework. I`m worried about application deployment part. I need to host my application in a Glass fish server. So anyone has experience in that? I have experience in hosting javaEE apps upload the .war file to the server. but how can I host play application like that? i have refer following article and build the dist. Production Dist
如果有人可以逐步给我说明,那么对我来说很容易理解.谢谢
If anybody can give me the instructions step by step it easy to understand it to me. Thanks
推荐答案
运行Play的推荐方法!生产环境中的应用程序应以独立模式运行,而不是在应用程序服务器环境中运行.有一些插件可以为您构建* .war文件,但是如果您愿意这样做的话.特别是,请看一看: https://github.com/play2war/play2-war-插件
The recommended way to run Play! app in production is to run it in a standalone mode, not in a application server environment. There are plugins that can build the *.war file for you, however, if that's the way you prefer to go forward. Particularly, take a look at this one: https://github.com/play2war/play2-war-plugin
我仍然建议您进行建议的独立部署.我们对 sbt-native-packager SBT插件.它可以构建deb
和rpm
文件,并支持System V或Upstart启动脚本.有关播放!生产页面.
I would still suggest that you do the recommended, standalone deployment. We have a good experience with sbt-native-packager SBT plugin. It can build deb
and rpm
files, with support of System V or Upstart startup scripts. There is more information on the Play! Production page.
要使用sbt-native-packager
,您需要先将其添加到project/plugins.sbt
文件中.就像这样:addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.0-RC2")
.
To use the sbt-native-packager
, you'll need to add it to your project/plugins.sbt
file first. Just like this: addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.0-RC2")
.
然后,在build.sbt
中,您必须配置包的必要属性,如上面链接的Production
页所述.我将在此处复制该页面的一些配置.假设您将使用rpm
格式在CentOS上进行部署.这是您需要放入build.sbt
的内容:
Then in the build.sbt
you'll have to configure the necessary properties of the package, as described on the Production
page linked above. I'll copy some of the configuration from that page here. Let's say, you'll use rpm
format to deploy on CentOS. Here's what you need to put in your build.sbt
:
lazy val root = (project in file("."))
.enablePlugins(PlayScala, RpmPlugin)
maintainer in Linux := "First Lastname <first.last@example.com>"
packageSummary in Linux := "My custom package summary"
packageDescription := "My longer package description"
rpmRelease := "1"
rpmVendor := "example.com"
rpmUrl := Some("http://github.com/example/server")
rpmLicense := Some("Apache v2")
然后从命令行启动sbt
并执行以下命令:rpm:packageBin
.它将构建您的应用并创建rpm
文件,该文件的放置和命名方式如下:./target/rpm/RPMS/noarch/your-application-name.noarch.rpm
.
Then start sbt
from command line and execute this command: rpm:packageBin
. It will build your app and create the rpm
file, which will be placed and named like this: ./target/rpm/RPMS/noarch/your-application-name.noarch.rpm
.
从那里开始,这是标准的rpm
,您可以像往常一样部署和启动它.
From there, it's a standard rpm
that you could deploy and start as usual.
这篇关于Scala Play框架Web应用程序托管流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!