Sorry to bring up a really old thread, but I hate it when people don't post their final solutions. Hopefully this can help someone else. We control the env to deploy to using a profile and connect to the deployment manager via soap. A custom script (jython) was written that maps the app to all the "web servers" as part of the deploy. The only config that needs to be put into each project is what cluster and virtual host to deploy to, per env.
Then we can deploy from our CI server using a command like "mvn clean integration-test -Dwas6-deploy=dev" In our corporate parent pom, I have this in the plugin management section: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>was6-maven-plugin</artifactId> <version>1.1</version> <executions> <execution> <id>integration-test</id> <phase>integration-test</phase> <goals> <goal>wsDefaultBindings</goal> <goal>wsUninstallApp</goal> <goal>installApp</goal> <goal>wsAdmin</goal> </goals> </execution> </executions> <configuration> <updateExisting>false</updateExisting> <args> <param>${was6.deploymentMgrPath}</param> <param>${was6.applicationName}</param> <param>${was6.targetCluster}</param> </args> </configuration> </plugin> In the settings.xml file, we have this: <profile> <id>was6-auto-deploy-base</id> <activation> <property> <name>was6-deploy</name> </property> </activation> <properties> <was6.wasHome>/opt/WebSphere/AppServer</was6.wasHome> <was6.conntype>SOAP</was6.conntype> <was6.language>jython</was6.language> <was6.script>/path/to/script/was_script.py</was6.script> </properties> </profile> <profile> <id>was6-auto-deploy-dev</id> <activation> <property> <name>was6-deploy</name> <value>dev</value> </property> </activation> <properties> <was6.host>wasdevadmin.example.com</was6.host> <was6.port>8879</was6.port> <was6.deploymentMgrPath>/opt/WebSphere/AppServer/profiles/DmgrDev</was6.deploymentMgrPath> </properties> </profile> In the pom.xml of the ear, this is the config that's added: <profile> <id>was6</id> <activation> <property> <name>was6-deploy</name> </property> </activation> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>was6-maven-plugin</artifactId> </plugin> </plugins> </build> </profile> <profile> <id>was6-dev</id> <activation> <property> <name>was6-deploy</name> <value>dev</value> </property> </activation> <properties> <was6.virtualHost>DEV_VIRTUAL_HOST_NAME</was6.virtualHost> <was6.targetCluster>DEV_CLUSTER_NAME</was6.targetCluster> <!-- see http://jira.codehaus.org/browse/MWAS-33 --> <was6.server>DEV_CLUSTER_NAME</was6.server> <!-- This is how the ear is identified in websphere --> <was6.applicationName>${project.artifactId}</was6.applicationName> </properties> </profile> The custom script that I wrote is: import sys def syncNodes(): nodes = AdminControl.queryNames("WebSphere:type=NodeSync,*").split() for node in nodes: AdminControl.invoke(node, "sync") #print node # end sync nodes def startAppOnCluster(appName,clusterName): members = getClusterMembers(cluster) for clusterMember in members: changeAppOnClusterMember(appName, clusterMember, 'startApplication') # this will return a list of the cluster members for the given cluster def getClusterMembers(cluster): members = [] for clusterMember in AdminConfig.list('ClusterMember', AdminConfig.getid( '/ServerCluster:'+clusterName)).split(lineSeparator): members.append(clusterMember[:clusterMember.find("(")]) return members # Change an application on a specific cluster def changeAppOnClusterMember(appName, clusterMember, command): appMan = AdminControl.queryNames('process='+clusterMember+',type=ApplicationManager,*') #print "app man"+appMan try: print "Changing " + appName + " on " + clusterMember + " running command " + command if(AdminApp.isAppReady(appName)) : AdminControl.invoke(appMan, command, appName) else: print "ERROR : app. not ready " except: print "ERROR: couldn't change " + appName + " on " + clusterMember else: print "Done!" # this will parse out the values for a webserver into a dictionary (map) that we can use # in multiple places def getCellNodeAndServer(wasString): # parse out the part between the first open bracket and the pipe subStr = wasString[wasString.find("(")+1:wasString.find("|")] tokens = subStr.split("/") # values out of the string values = {} values['cell'] = tokens[1] values['node'] = tokens[3] values['server'] = tokens[5] return values # this will take a string like the following: # WebDev01(cells/DevCell/nodes/NodeDev01/servers/WebDev01|server.xml#WebServer_1153749486049) # and turn it into something like: # WebSphere:cell=DevCell,node=NodeDev01,server=WebDev01 def buildWasString(wasString): # get the map of values values = getCellNodeAndServer(wasString) return "WebSphere:cell=" + values['cell'] + ",node=" + values['node'] + ",server=" + values['server'] # this will grab the cluster object, figure out the correct string that is needed # to map (or remap) an app to this cluster def getClusterFullName(cluster): fullName = AdminControl.completeObjectName("type=Cluster,name=" + cluster + ",*") prefixRemoved = fullName[fullName.find(":")+1:] # extract the cell and node info we need for pairs in prefixRemoved.split(","): pair = pairs.split("=") key = pair[0] value = pair[1] if ("cell" == key): return "WebSphere:cell=" + value + ",cluster=" + cluster # this builds up the argument for mapping the cluster AND the webservers # to a web module def getMapToServerArgument(cluster): arg = getClusterFullName(cluster) webservers = AdminConfig.list('WebServer').split() for webserver in webservers: arg = arg + "+" + buildWasString(webserver) return arg # this will actually change the deployment def mapAppToWebServers(appName, cluster): option = [[".*", ".*", getMapToServerArgument(cluster)]] mapWebModuleOption = ["-MapModulesToServers", option] AdminApp.edit(appName, mapWebModuleOption) # this will regenerate the web plugin after a deploy def generatePropagatePlugin(profileLocation): generator = AdminControl.completeObjectName('type=PluginCfgGenerator,*') # for each web server, generate and propagate the config webservers = AdminConfig.list('WebServer').split() for webserver in webservers: # get the map of values values = getCellNodeAndServer(webserver) argument = str(profileLocation) + "/config " argument += str(values['cell']) + " " + str(values['node']) + " " + str(values['server']) print "argument is: " + argument AdminControl.invoke(generator, 'generate', argument + " true") AdminControl.invoke(generator, 'propagate', argument) # this is the code that gets run when this script is executed if (len(sys.argv) == 3): dmgrPath = sys.argv[0] appName = sys.argv[1] cluster = sys.argv[2] print "Modifying websphere install. Using app name '" + appName + "', and cluster '" + cluster + "'" + " and deployment mgr '" + dmgrPath + "'" print "map modules" mapAppToWebServers(appName, cluster) print "save the config" AdminConfig.save() print "sync nodes" syncNodes() print "generate / propagate the plugin" generatePropagatePlugin(dmgrPath) print "Done modifying the deployment for '" + appName + "'" else: print "there are not the correct number of args to modify the deployment." print "The first should be the app name and the second should be the cluster name" # end script YYMV, but this might help as a starting point. Jim On Fri, Jan 16, 2009 at 9:22 PM, David J, M. Karlsen <da...@davidkarlsen.com > wrote: > Jim Sellers wrote: > >> Hello. >> >> Using the was6 maven plugin I'm trying to have our CI server deploy to our >> clustered dev env. It's mostly working, except the web modules aren't being >> associated with our web servers. >> >> eg. using the admin console on the "Manage Modules" step, I'd link the web >> module to a cluster and 2 apache servers (Servers -> Web Servers). Normally >> the servers that are associated with the web module look like this: >> WebSphere:cell=DevCell,cluster=MY_CLUSTER_NAME >> WebSphere:cell=DevCell,node=NodeDev02,server=WebDev02 >> WebSphere:cell=DevCell,node=NodeDev01,server=WebDev01 >> >> Looking at some python scripts for deploys, there is an option >> "-MapModulesToServers" for this functionality, but I can't find the same in >> the ws_ant.sh file or using the bindings option. >> >> 1) does anyone know if it's possible with the was6 plugin? >> 2) is there some config that I'm doing wrong in maven or if something can >> be changed in websphere to make this work? >> >> Thanks for your time, >> Jim >> > You can map it to virual hosts like in the example in the bottom of the > page: > http://mojo.codehaus.org/was6-maven-plugin/examples/generating-default-bindings.html > If this is not suitable you will have to write a script and feed it to: > http://mojo.codehaus.org/was6-maven-plugin/wsAdmin-mojo.html > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > >