Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deploy java maven project to ec2 with pallet?

I'm wondering exactly how I would set this up. I have a normal java/tomcat/mysql app, and I want to deploy to EC2. I'd like to use pallet to provision the box, configure it, and deploy my war there. I'm hoping I can do this via a maven plugin?

I guess my other option is to create a lein project and deploy the war using a relative path, but I'm hoping for the maven plugin...

like image 652
Kevin Avatar asked Sep 04 '26 08:09

Kevin


1 Answers

I can't speak to the AWS and Pallet part of your question, but assuming you have a running tomcat instance you can use the Apache Cargo project directly from maven to deploy your app:

Here is a sanitized version of our cargo configuration:

        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.2.1</version>
            <configuration>
              <container>
                <containerId>tomcat6x</containerId>
                <type>remote</type>
              </container>

              <configuration>
                <type>runtime</type>
                <properties>
                    <cargo.hostname>${tomcat.hostname}</cargo.hostname>   
                    <cargo.servlet.port>8080</cargo.servlet.port>
                    <cargo.remote.username>$[tomcat.username}</cargo.remote.username>
                    <cargo.remote.password>${tomcat.password}</cargo.remote.password>
                </properties>
              </configuration>

              <deployer>
                <type>remote</type>
                <deployables>
                  <deployable>
                    <groupId>com.mycompany</groupId>
                    <artifactId>MyWebApp</artifactId>
                    <type>war</type>
                    <pingURL>http://my.company.com/url</pingURL>
                    <pingTimeout>80000</pingTimeout>
                    <properties>
                        <context>ROOT</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>
            </configuration>
        </plugin>

You can then get this run with this command (set the relevant properties of course):

mvn -DskipTests package cargo:deploy

More information on Using Apache Cargo with Maven is here: http://cargo.codehaus.org/Maven2+Plugin+Getting+Started

like image 171
JBCP Avatar answered Sep 06 '26 21:09

JBCP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!