简体   繁体   English

在Windows Azure上部署Play 2.3.X应用程序

[英]Deploying a Play 2.3.X application on Windows Azure

I recently created a small web application using Play 2.3.4. 我最近使用Play 2.3.4创建了一个小型Web应用程序。 It runs fine locally so now I want to run it on Windows Azure. 它在本地运行良好所以现在我想在Windows Azure上运行它。

So far, I've created a Java website using the Azure application gallery by following this guide http://azure.microsoft.com/en-us/documentation/articles/web-sites-java-get-started/ . 到目前为止,我已按照本指南http://azure.microsoft.com/en-us/documentation/articles/web-sites-java-get-started/使用Azure应用程序库创建了一个Java网站。 The server I chose was Apache Tomcat 7. The next steps are this guide, http://azure.microsoft.com/en-us/documentation/articles/web-sites-java-add-app/ , which state that I need to place a WAR file in the webapps folder. 我选择的服务器是Apache Tomcat 7.接下来的步骤是本指南, http://azure.microsoft.com/en-us/documentation/articles/web-sites-java-add-app/ ,其中说明我需要将WAR文件放在webapps文件夹中。 I've followed the guide to package my Play application as a WAR file using the Play2War plugin. 我已经按照指南使用Play2War插件将我的Pl​​ay应用程序打包为WAR文件。 I then added that WAR file to d:\\home\\site\\wwwroot\\bin\\apache-tomcat-7.0.52\\webapps through FTP. 然后我通过FTP将WAR文件添加到d:\\ home \\ site \\ wwwroot \\ bin \\ apache-tomcat-7.0.52 \\ webapps。

However, when I go to the website all I see is the default tomcat page. 但是,当我访问网站时,我看到的是默认的tomcat页面。

First Question : 第一个问题

Did I use the Play2War plugin correctly? 我是否正确使用了Play2War插件?

I modified plugins.sbt and build.sbt 我修改了plugins.sbt和build.sbt

plugins.sbt plugins.sbt

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.4")

// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.3-beta2") 

build.sbt build.sbt

import com.github.play2war.plugin._

name := """playtest4"""

version := "1.0-SNAPSHOT"

Play2WarPlugin.play2WarSettings

Play2WarKeys.servletVersion := "3.0"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  javaWs
)

Afterwards, I installed sbt and ran the sbt war command. 之后,我安装了sbt并运行了sbt war命令。 The play2war deployment page says that if I want to deploy my app as root context http://host:port/ I need to rename the WAR app as ROOT.war for Tomcat 7, but that still didn't work. play2war部署页面说如果我想以root用户身份部署我的应用程序http://host:port/我需要将WAR应用程序重命名为ROOT.war用于Tomcat 7,但这仍然无效。

Second Question : 第二个问题

Is there an easier way to deploy my app on Azure? 有没有更简单的方法在Azure上部署我的应用程序?

Thanks! 谢谢!

Please let me know your azure website name and I can investigate. 请让我知道您的azure网站名称,我可以调查。 Please make sure the folder ROOT in :\\home\\site\\wwwroot\\bin\\apache-tomcat-7.0.52\\webapps is deleted before your upload your ROOT.war file. 在上传ROOT.war文件之前,请确保删除位于:\\ home \\ site \\ wwwroot \\ bin \\ apache-tomcat-7.0.52 \\ webapps中的文件夹ROOT。 Also once you upload your ROOT.war, tomcat should automatically deploy the war file ie extract its contents into the ROOT directory. 此外,一旦上传了ROOT.war,tomcat就会自动部署war文件,即将其内容提取到ROOT目录中。 But just to be sure, restart your azure website and then hit your azure website. 但只是为了确定,重新启动你的azure网站然后点击你的azure网站。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM