且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

部署Java Web应用程序到亚马逊弹性魔豆

更新时间:2022-12-06 13:55:57

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

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>