Deploying a Java Web Application on Amazon Elastic Beanstalk

My team is developing a Java web application that will be deployed to 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 am experimenting with the CLI tools provided by Amazon.

Basically, I followed the steps described in the Amazon Blog Post after converting the subversion repository to the git repository. I followed the steps described in this SO answer

After completing the above steps, I issued the git aws.push command , which completed successfully. But during the launch of the application errors occur and. Therefore, I downloaded the war file from Beanstalk and found that the folder structure was messed up and the source files were not compiled into class files. It appears that the source files are loading as such.

Do I need to create an application (using ant) ​​before using aws.push? Or am I missing something?

+4
source share
3 answers

I now seem to have an answer to my question.

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

I developed a shell script that does the following:

  • Check the source code from the subversion repository.
  • Create and create a WAR file using Apache Ant
  • Exploding a WAR file into a git repository (initialized with Amazon EB)
  • Add the exploded files to the git repository and commit the changes.
  • Use aws.push to deploy the war file in EB.

(I do not have access to the shell script right now, so I can not provide detailed commands)

Here is the shell script in the main form

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 

A known issue with this script is related to obsolete class files. To get rid of it, you will have to empty the git repository.

Here is the ant target:

 <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> 
+6
source

It is you using Maven and Beanstalker , the equivalent git aws.push functionality can be renewed to a single command, whether you use git or not.

$ mvn package beanstalk:fast-deploy

but make sure your pom is ready

+1
source

I had the same problem - it seems that the git method is intended only for working with PHP applications.

I'm currently looking for another Java-based tool, since I am not using Eclipse, and the AWS console is a clumsy way to manage releases (and downloads are very slow).

-1
source

All Articles