Java的游戏2 - 部署 [英] Java Play 2 - Deployment
问题描述
更新2012年8月18号
Updated 08.18.2012
我使用的播放2.0.2,我想部署我的应用程序到Amazon Web服务。我认为,要做到这一点最简单的方法是通过Elasticbeanstalk。
I am using Play 2.0.2 and I want to deploy my app to Amazon Webservices. I think the easiest way to do this is via Elasticbeanstalk.
我用Play2war打包我的应用程序 https://github.com/dlecan/play2-war-plugin/
I used Play2war to package my app https://github.com/dlecan/play2-war-plugin/
我能够将它与包装
play war
据play2war的使用指南,我改名为我的文件ROOT.war,因为我使用的Linux 32位Tomcat7。
According to the usage guide of play2war, I renamed my file to ROOT.war because i used Linux 32bit Tomcat7.
我也用这个servlet 3.0如在play2war本教程中介绍。 (Tomcat的7 - >的servlet 3.0)。
I also used the servlet 3.0 as described in the tutorial on play2war. (tomcat 7 -> servlet 3.0).
文件大小为31MB。
我每次使用Elasticbeanstalk,我得到了相同的日志。
Every time I use Elasticbeanstalk, I get the same log.
2012-08-18 00:25 GMT+0200
WARN
Environment health has been set to RED
2012-08-18 00:25 GMT+0200
INFO
Launched environment: elosource. However, there were issues during launch. See event log for details.
2012-08-18 00:25 GMT+0200
INFO
Your health check URL may be misconfigured. If your application does not respond to requests at http://elosource.elasticbeanstalk.com:80/, modify the health check URL to a valid path.
我在Linux 32/64位,Tomcat7(的servlet 3)的Tomcat6(Servlet2.5中)进行了测试。我总是得到相同的结果。
I tested it with Linux 32/64 bit , Tomcat7(servlet 3) and Tomcat6(servlet2.5). I always get the same result.
我也尝试添加一个额外的HTML文件的健康检查。
I also tried adding an extra html file for the health checker.
-
你有什么建议我做什么?
What would you recommend me to do?
做什么选择我得在EC2上运行我的应用程序?
What alternatives do I have to get my app running on ec2?
有没有解释我是如何手动部署我的应用程序,以EC2与所有需要的dependcies,像MongoDB的指南,玩等?
Is there a guide that explains how I manually deploy my app to ec2 with all the needed dependcies, like mongodb, play etc?
另外WAR文件是相当巨大的〜30MB,与我的DSL 1k的是一个真正的痛苦上传这样一个拉赫文件。有没有办法只能上载与Elasticbeanstalk的变化?
Also WAR files are relatively huge ~30mb, with my dsl 1k it is a real pain to upload such a lage file. Is there a way to only upload the changes with Elasticbeanstalk?
推荐答案
好吧,我知道这是不是直接回答你的问题,因为我没有使用魔豆,但你的意见,一问它:
Ok, I know this is not the straight answer to your question as I am not using beanstalk, but as you asked for it in one of the comments:
下面是我的在Linux EC2实例安装一个JVM上运行我的play2的应用程序:
Here is how I run my play2 app on a linux EC2 instance with a jvm installed:
- 在本地计算机上,在你的项目目录,执行
播放DIST
- 发送
DIST / yourapp-1.0-SNAPSHOT.zip
文件(或任何DIST你的名字 配置),以EC2实例 - SSH到您的实例
- 解压缩到你想要的目录中的DIST文件和
光盘
有 - 运行
使用chmod + x起动
- 运行
的nohup ./start&安培;
- on your local machine, in your project directory, run
play dist
- send the
dist/yourapp-1.0-SNAPSHOT.zip
file (or whatever dist name you have configured) to the EC2 instance - ssh to your instance
- unzip the dist file in the directory you want and
cd
there - run
chmod +x start
- run
nohup ./start &
您现在有你play2的应用程序运行在EC2上本机,用的WebSocket和所有的很酷的东西。我没有要任何特殊的游戏配置的工作。我使用的游戏设置为任何其他数据库的RDS数据库。
you now have your play2 application running natively on EC2, with websocket and all the cool stuff. I didn't have to configure anything special in play for that to work. I am using an RDS database configured as any other DB in play.
显然,它比豆茎多一点麻烦,因为你必须配置在自己的服务器,并手动设置自动缩放。但是,这是我所发现的运行play2所有在AWS上的功能现在最好的办法。
Clearly, it's a bit more hassle than beanstalk as you have to configure the server on your own and set up the autoscaling manually. But this is the best way that I have found to run play2 with all the features on AWS for now.
我希望这有助于。
这篇关于Java的游戏2 - 部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!