部署Java Web应用程序到亚马逊弹性魔豆 [英] Deploying Java web application to Amazon Elastic Beanstalk

查看:141
本文介绍了部署Java Web应用程序到亚马逊弹性魔豆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队正在开发一个Java Web应用程序将被部署在亚马逊弹性魔豆。开发环境是Eclipse和颠覆。他们可以使用Eclipse插件来部署,但自动化部署,我尝试用由亚马逊提供的命令行工具。

My team is developing a Java web application which is to be deployed in Amazon Elastic Beanstalk. The development environment is Eclipse and Subversion. They were able to deploy it using the Eclipse plugin, but to automate the deployment I'm experimenting with the CLI tools provided by Amazon.

基本上,我紧跟在的亚马逊的博客帖子转换版本库到Git仓库后。我跟着这太回答

Basically, I followed the steps detailed in the Amazon Blog post after converting the subversion repository into a git repository. I followed the steps explained in this SO answer

完成以上步骤后,我发出的命令混帐 aws.push ,这是顺利完成。但在运行应用程序中,有误差和。于是我下载了魔豆环境war文件,发现文件夹结构搞砸和源文件不编译成class文件。它看起来像源文件被上传这样。

After following the above steps, I issued the command git aws.push, which is successfully completed. But while running the application, there are errors and . So I downloaded the war file from the Beanstalk environment and found that the folder structure is messed up and the source files are not compiled to class files. It appears like the source files are uploaded as such.

我是否需要建立(使用ANT)使用aws.push在申请前?还是我失去了一些东西?

Do I need to build the application(using ant) prior to using aws.push? Or am I missing something?

推荐答案

现在看来,我有答案了我的问题。

It seems now I have the answer for my question.

aws.push 不仅是对PHP应用程序,而不是它也可以用于部署Java和PHP应用程序。我与已经成功地使用的 Apache Ant的并设置工作正常,在我们的UAT环境。

aws.push is not only for PHP applications, instead it can also be used for deploying Java and PHP applications. I have successfully used along with Apache Ant and the setup works fine in our UAT environment.

我公司开发的shell脚本执行以下操作:

I developed a shell script which does the following:

  1. 检查从Subversion版本库的源$ C ​​$ C
  2. 在建立和采用Apache Ant创建WAR文件
  3. 在爆炸使用Amazon WAR文件到一个Git仓库(初始化 EB工具)
  4. 分解的文件添加到git的回购协议并提交更改。
  5. 使用aws.push战争文件部署到EB。
  1. Check out the source code from subversion repository
  2. Build and created WAR file using Apache Ant
  3. Explode the WAR file to a git repository (initialised using Amazon EB tools)
  4. Add the exploded files to the git repo and commit the changes.
  5. Use aws.push to deploy the war file to EB.

(我没有进入shell脚本现在,所以我可能无法提供详细的命令)

下面是Shell脚本的基本形式

source_dir="/home/libregeek/myapp"
workingcopy="$source_dir/trunk"
gitrepo="$source_dir/gitrepo"
cd $workingcopy
svn update
ant createwar
cd $gitrepo
unzip -o $workingcopy/build/myapp.war
git add *
git commit -m "Deployed new version"
git aws.push

有一个已知的问题与此脚本相关陈旧的类文件。为了摆脱它,你可​​能要清理混帐回购协议。

There is a known issue with this script related to stale class files. To get away with it you may have to clean up the git repo.

下面是Ant目标:

<target name="createwar" depends="build" description="Create WAR file for deployment">
<war destfile="${alternate.path}/${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}">
<include name="**/*.*"/>
</fileset>
</war>
</target>

这篇关于部署Java Web应用程序到亚马逊弹性魔豆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆