How to implement continuous deployment for a web service

孤人 提交于 2019-12-05 11:42:34

Please correct me if I'm wrong. I understand that you're using the Tomcat version 7. The Cargo configuration for Tomcat 7 should be as the following: -

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.3.3</version>
    <configuration>
        <container>
            <containerId>tomcat7x</containerId>
            <type>remote</type>
        </container>
        <configuration>
            <type>runtime</type>
            <properties>
                <cargo.remote.username>myusername</cargo.remote.username>
                <cargo.remote.password>mypassword</cargo.remote.password>
                <cargo.hostname>MY_HOST</cargo.hostname>
                <cargo.protocol>http</cargo.protocol>
                <cargo.servlet.port>SERVER_PORT</cargo.servlet.port>
            </properties>
        </configuration>
        <!-- Deployer configuration -->
        <deployer>
            <type>remote</type>
            <deployables>
                <deployable>
                    <groupId>ru.mycompany</groupId>
                    <artifactId>my-product</artifactId>
                    <type>war</type>
                    <properties>
                        <context>MY_CONTEXT</context>
                    </properties>
                </deployable>
            </deployables>
        </deployer>
    </configuration>
</plugin>

Please note that

  1. <cargo.hostname> is the remote host name or ip address.
  2. <cargo.protocol> is either http or https.
  3. <cargo.servlet.port> is the remote port based on the <cargo.protocol>, e.g. 8080 or 8443
  4. <context> is the context name to use when deploying the web application.

Please refer to Cargo: Tomcat 7.x and Maven2 Plugin Reference Guide for further information.

I hope this may help.

willome

You could use the cargo maven plugin to deploy on a remote server. See this example for a remote deployment on a Tomcat server : Maven: How do I deploy my WAR file to a remote Tomcat server?

As Charlee and Dmitri answered earlier, the cargo plugin would usually be the easiest way to go. While doing that, you might also consider the way you actually create your EC2 instances (as in many scenarios, both dev/test ones and production ones) you would like to always create fresh instances (see Martin Fowler's thoughts on this at http://martinfowler.com/bliki/PhoenixServer.html and http://martinfowler.com/bliki/SnowflakeServer.html .

An interesting solution for doing so is provided by Ravello Systems, which basically lets you easily create a full blown replica of an application in the cloud, and they even implemented a maven plugin to help in automating that. Take a look at http://www.ravellosystems.com/blog/ravello_maven_plugin/ - you can tie the whole process together end-to-end with maven - from creating the environment to deploying the application, testing it, and tearing it down.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!