Sandeep Nair
Sandeep Nair

Reputation: 3650

Programatically undeploy web application from server

Is it possible to programatically undeploy web applications(WARs specifically) from server. If the answer is yes, is the way to undeploy different for different servers.

I am specifically looking for undeploying from following servers

I know it may be a long answer if the way to undeploy is different across different servers. In that case I am more than happy to get some generic solution or pointers for this information

Upvotes: 1

Views: 998

Answers (2)

EricMinick
EricMinick

Reputation: 1477

Sandeep,

I'm not aware of a standard, in-container way of one web-application undeploying another. My instinct is that the apps themselves are "contained" and the spec doesn't intend for them to manage their container.

That said, most / all of these web containers provide APIs for deploying and undeploying web applications. The approaches are not common though, and when my development colleagues create a new integration for our uDeploy product, we have to research each in turn. For instance, with Tomcat you can use the Tomcat Manager APIs. You could use the open source Apache Ant tasks as an example of what you want to do: http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing_Manager_Commands_With_Ant

For Websphere, you are probably are writing jython scripts or doing some of your own programming against the JMX APIs. Weblogic is somewhere in-between as it provides some nice Ant scripts you could borrow, as well as direct APIs.

Good Luck!

Upvotes: 2

tqheel
tqheel

Reputation: 11

I'm not sure exactly what you mean by "undeploy", but if you have SSH access to the web servers, you can install Git source control management to "toggle" different versions of a web app regardless of the web server in question. For example, say you have two Git branches: 1) "production", and 2) "offline". the production branch would contain the production version of the web app. The "offline" branch could contain only one file , e.g., index.html that tells users that the site is "down for maintenance" or what have you.

You switch branches with:

git checkout production

or

git checkout offline

and git automatically swaps out all the files in the file system and the web server never knows the difference. You can write a shell script to do this and even assign it as a cron job to happen at a scheduled time if you want to.

Be aware that you will kill all user sessions when you do this, so you will want to do this at planned intervals or after notifying users.

You can find everthing you need to need to use git here: http://git-scm.com/

Upvotes: 0

Related Questions