Deploying to Multiple Servers at Once

View: New views
3 Messages — Rating Filter:   Alert me  

Deploying to Multiple Servers at Once

by rfeldman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!

I am trying to deploy a WAR to multiple servers at once. Each server has an identical configuration, same authentication information...only the URL is different.

The way I have been trying to do this is with profiles such as the following:

                <profile>
                        <id>env-foo1</id>
                        <properties>
                                <deploy.env>dev</deploy.env>
                                <tomcat.manager>http://foo1/manager</tomcat.manager>
                                <tomcat.manager.username>foo</tomcat.manager.username>
                                <tomcat.manager.password>bar</tomcat.manager.password>
                        </properties>
                        <build>
                                <plugins>
                                        <plugin>
                                                <groupId>org.codehaus.cargo</groupId>
                                                <artifactId>cargo-maven2-plugin</artifactId>
                                        </plugin>
                                </plugins>
                        </build>
                </profile>

I have N of these profiles, one for each server (env-foo1 with <tomcat.manager>http://foo1/manager</tomcat.manager>, env-foo2 with <tomcat.manager>http://foo2/manager</tomcat.manager>, etc.).

What I am trying to do is tto deploy to all of these servers at once, so that instead of using -Penv-foo1,env-foo2,env-foo3... I can instead use something like -DallFooServers to deploy the whole batch (meaning the individual URLs are managed only in the POM, rather than both in the POM and at the command line).

I tried creating several of these profiles and giving them all a common <activation>, but Maven would just pick one of them and run it, ignoring the others.

Does anyone know of a way to do this?

Thanks very much in advance!

-Richard

Re: Deploying to Multiple Servers at Once

by Matt Wringe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Wed, 2009-01-21 at 13:20 -0800, rfeldman wrote:

> Hello!
>
> I am trying to deploy a WAR to multiple servers at once. Each server has an
> identical configuration, same authentication information...only the URL is
> different.
>
> The way I have been trying to do this is with profiles such as the
> following:
>
> <profile>
> <id>env-foo1</id>
> <properties>
> <deploy.env>dev</deploy.env>
> <tomcat.manager>http://foo1/manager</tomcat.manager>
> <tomcat.manager.username>foo</tomcat.manager.username>
> <tomcat.manager.password>bar</tomcat.manager.password>
> </properties>
> <build>
> <plugins>
> <plugin>
> <groupId>org.codehaus.cargo</groupId>
> <artifactId>cargo-maven2-plugin</artifactId>
> </plugin>
> </plugins>
> </build>
> </profile>
>
> I have N of these profiles, one for each server (env-foo1 with
> <tomcat.manager>http://foo1/manager</tomcat.manager>, env-foo2 with
> <tomcat.manager>http://foo2/manager</tomcat.manager>, etc.).
>
> What I am trying to do is tto deploy to all of these servers at once, so
> that instead of using -Penv-foo1,env-foo2,env-foo3... I can instead use
> something like -DallFooServers to deploy the whole batch (meaning the
> individual URLs are managed only in the POM, rather than both in the POM and
> at the command line).
>
> I tried creating several of these profiles and giving them all a common
> <activation>, but Maven would just pick one of them and run it, ignoring the
> others.

So will doing -Penv-foo1,env-foo2 will correctly start up two servers,
or are you having issues with that also?

If using the above profiles are starting the servers properly and you
just want to have a nice profile option for all of them, then its a
maven configuration problem and not a cargo one.

Can you give a bit more detail?

> Does anyone know of a way to do this?
>
> Thanks very much in advance!
>
> -Richard


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Deploying to Multiple Servers at Once

by matinh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 22 January 2009 Matt Wringe wrote:

> On Wed, 2009-01-21 at 13:20 -0800, rfeldman wrote:
> > Hello!
> >
> > I am trying to deploy a WAR to multiple servers at once. Each server
> > has an identical configuration, same authentication information...only
> > the URL is different.
> >
> > The way I have been trying to do this is with profiles such as the
> > following:
> >
> > <profile>
> > <id>env-foo1</id>
> > <properties>
> > <deploy.env>dev</deploy.env>
> > <tomcat.manager>http://foo1/manager</tomcat.manager>
> > <tomcat.manager.username>foo</tomcat.manager.username>
> > <tomcat.manager.password>bar</tomcat.manager.password>
> > </properties>
> > <build>
> > <plugins>
> > <plugin>
> > <groupId>org.codehaus.cargo</groupId>
> > <artifactId>cargo-maven2-plugin</artifactId>
> > </plugin>
> > </plugins>
> > </build>
> > </profile>
> >
> > I have N of these profiles, one for each server (env-foo1 with
> > <tomcat.manager>http://foo1/manager</tomcat.manager>, env-foo2 with
> > <tomcat.manager>http://foo2/manager</tomcat.manager>, etc.).
> >
> > What I am trying to do is tto deploy to all of these servers at once,
> > so that instead of using -Penv-foo1,env-foo2,env-foo3... I can instead
> > use something like -DallFooServers to deploy the whole batch (meaning
> > the individual URLs are managed only in the POM, rather than both in
> > the POM and at the command line).
> >
> > I tried creating several of these profiles and giving them all a common
> > <activation>, but Maven would just pick one of them and run it,
> > ignoring the others.
>
> So will doing -Penv-foo1,env-foo2 will correctly start up two servers,
> or are you having issues with that also?
AFAIKT it will only start up one, as your profiles only seem to define some
properties. Activating more than one profile is very likely to just
override the properties defined by some other profile.

So once maven is going to call your plugin, your configuration contains only
the property values defined by the profile activated last.

The above is just my guess, coming from my understanding of maven profiles.
I didn't test anything.

hth,
- martin


signature.asc (204 bytes) Download Attachment