File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Make script to install war files on EC2 instance from Maven

 
James Akins
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


So right now I am writing a script to have my instances download war files from my maven respository. This is what I have so far. This is written in Unix and I am having trouble getting started on the instructions on how to get the files from my Maven repository as well as JBoss. Any help would be appreciated! thanks in advance!


###############################
#BASIC START UP
###############################


sudo yum install httpd mysql mysql-server tomcat* java* apache*
chkconfig httpd on # turn on the web service
/etc/init.d/httpd start
if [ ! -f /var/www/html/
cd /var/www/html
#Maven and JBoss installation
wget http://download.jboss.org/jbossas/7.0/jboss-as-7.0.2.Final/jboss-as-web-7.0.2.Final.tar.gz
tar xvfz jboss-as-web-7.0.2.Final.tar.gz
wget http://www.poolsaboveground.com/apache/maven/maven-2/2.2.1/binaries/apache-maven-2.2.1-bin.tar.gz
tar xvfz apache-maven-2.2.1-bin.tar.gz
fi
yum -y update
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello James,

writing a script to have my instances download war files from my maven respository


I assume that you have your very own proxy repository where you store your artifacts and war files. The first thing coming to mind at the moment is to retrieve the war file via wget . You must already know the path to where your war file is on the repository so just issue a "wget" to retrieve the war file and then copy it ( scp ) to the ec2 instance.

However, just to share my experience , I also have a somewhat similar dev environment and what I do is that I have a parent pom where I am using the tomcat-maven-plugin to remote deploy my war to any remote server. Here is the maven-plugin for JBOSS . With these plugins you can also stop/start your jboss server instance remotely.
 
James Akins
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saif,

Thank you for the reply! I really appreciate it. Could you elaborate a little more on your "similiar dev environment"

Also, when i am copying (scp) to the ec2 instance, what command is that? would it just be:

scp <url>/path/to/file(s) ?

or

in my script would it be ok to have like my Index of /maven/internal/releases/com/0.0.1/etc..

scp -r <url>

thanks for helping out!
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,
Sorry for the delay in the reply , I was caught up in some work . In-case you are still working out on the problem
As for my "similar dev environment" , I have setup a central proxy repository with nexus in which all the developed artifacts are pushed once tested and staged. Then I have a maven module project in which I have defined all the modules of the web-application that exist as artifacts on the cached repo. A simple bash script retrieves the war files and then copies them to the respective tomcat servers deployed on seperate ec2 instances .

The command for scp will be like


the -r flag (recursive) is used when copying a directory.

Do post back for any further queries.
 
James Akins
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Saif,

That's no worries. I was able to gain some progress for this bash script.

Would it be possible if I could see the simple bash script that retrieves the war files and then cpies them to the respective tomcat servers deployed on separate ec2 instances?

In my discoveries, I was able to find similiar scripts, but it may seem that aws has a bug for writing a simple bash script that preconfigures your instance such as installing packages(so you dont have to do it yourself every time you start a new instance). Did you have a similiar problem with this?

 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my discoveries, I was able to find similiar scripts, but it may seem that aws has a bug for writing a simple bash script that preconfigures your instance such as installing packages(so you dont have to do it yourself every time you start a new instance). Did you have a similiar problem with this?


Well I didnt have any startup scripts running when the instance starts up , the scripts I have made have to be executed manually so I cant realy confirm about this problem, I will , how-ever do a bit of re-search myself to look further into this problem



Do post back for any further queries
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saif Asif wrote:
In my discoveries, I was able to find similiar scripts, but it may seem that aws has a bug for writing a simple bash script that preconfigures your instance such as installing packages(so you dont have to do it yourself every time you start a new instance). Did you have a similiar problem with this?


Well I didnt have any startup scripts running when the instance starts up , the scripts I have made have to be executed manually so I cant realy confirm about this problem, I will , how-ever do a bit of re-search myself to look further into this problem



Do post back for any further queries


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic