How to deploy EAR into the WAS cluster and IBM HTTP server by Monitored Directory Deployment functionality - deployment

My goal is to automatically deploy EAR file in WebSphere Application server cluster by Monitored Directory Deployment. So my deployment target is cluster. WAS version is 9.0.0.10. Everything works fine if I drop EAR file in
monitored directory for example '/{monitored_directory_defined_in_WAS}/clusters/my_cluster_name/'. Application is deployed and started. But I also want to deploy that application into the IBM HTTP server(resides in the same WebSphere cell with cluster) in the same automatically process by Monitored Directory Deployment.
I tried to manually predefine deploymentTargets(cluster and ibm http server) in deployment.xml file, put it in the EAR file, and drop EAR in the '/{monitored_directory_defined_in_WAS}/clusters/my_cluster_name/', but WAS deploy EAR only in cluster. As a consequence I must manually via WAS console map all modules from EAR to ibm http server, but I do not want to do it manually.
My second idea/attempt was sto create separate monitored directory for the ibm http server '/{monitored_directory_defined_in_WAS}/servers/my_ibm_http_server_name/'.
First I drop EAR into the '/{monitored_directory_defined_in_WAS}/clusters/my_cluster_name/' and right after that I drop EAR in to the '/{monitored_directory_defined_in_WAS}/servers/my_ibm_http_server_name/'. Result is that the EAR modules are deployed only in to the web server, and that is not my goal.
Is that even possible by WAS Monitored Deployment Directory functionality?
Is it allowed to manually create the deployment.xml file and add it to the EAR file?

First of all installing via monitored director is not recommended in the production environments, as it lacks control.
As you correctly suspected it is not possible to install it to the cluster and web server - check Installing enterprise application files by adding them to a monitored directory.
Because you can use only one server directory, drag and drop to map
applications to combinations of servers is limited. Scenarios
requiring use of more than one server, such as mapping to an
application server and a web server, are not supported by direct drag
and drop of an application file.
However, you still want to use it, you may deploy property file into monitored directory. That property file can fully customize your deployment e.g. configuring also module to map to web server.
Check Installing enterprise application files by adding properties files to a monitored directory for more details
UPDATE
If you have issues, I'd suggest the following approach - install your application 'classically' via admin console and map it to both web server and cluster. Then run wsadmin command to extract propertes:
AdminTask.extractConfigProperties('[-propertiesFileName myApp.props -configData Deployment=MyApplication -options [[SimpleOutputFormat true]]]')
Try to use format from that exported file for your properties
I had time to run it in my environment. I have app with 2 modules inside, one module is just mapped to the cluster, other is mapped to both cluster and web server. Here is relevant part of the property file:
taskName=MapModulesToServers
row1={ module=HelloTestUI #readonly
uri=HelloTestUI.war,WEB-INF/web.xml #readonly
server=WebSphere:cell=!{cellName},cluster=!{clusterName} }
row0={ module=HelloTestWeb #readonly
uri=HelloTestWeb.war,WEB-INF/web.xml #readonly
server=WebSphere:cell=!{cellName},cluster=!{clusterName}+WebSphere:cell=!{cellName},node=!{nodeName},server=!{serverName} }
I didnt try to use that property file to deploy the app via monitored directory, but as you can see the entry is created and mapping is done via + sign that connects cluster and web server.
If you dont see the mapping to your web server, make sure you saved the changes done in the console, and then connected via wsadmin, otherwise wsadmin will have not current data.

Related

retrieve deployed EAR on WIldfly domain

Is there a way to retrieve an EAR deployed in a Wildfly in domain mode?
If I have only one server-group with two servers (e.g. server-one and server-two) each host has a directory ubnder domain called servers/server-one(two)/data/content containing all deployed artifacts, but they are encrypted.
Is there a way (maybe from Wildfly Admin Console) to retrieve the original deployed EAR?
This is not currently supported but will be in the future. For what it's worth the contents is not encrypted. The content file is just a compressed file.

bluemix packaged server deployment: subsequent deployments

I have an application that was pushed to the Liberty runtime via the packaged server deployment method. In the future, if I make changes to my code without having to change my server.xml, do I still have to build a package and deploy the same way? Or can I just Commit and Push my changes from Eclipse or DevOps straight into Bluemix?
you still have to push your application using the packaged server deployment method, because even if the push action uploads only what needs to be updated, it makes a full restaging once the upload is completed.
By this way, if you push only your application files without using the packaged server deployment method, it will use its server.xml template overwriting all your previous customizations.
If you are using IBM Eclipse Tools for Bluemix you can take advantage of incremental publishing support by putting your packaged server in development mode. Right click on your packaged server and select Enable Development Mode. Once enabled, you can make changes to applications that are deployed on the packaged server and then once you are finished with the changes, right click on the Bluemix server and select Publish. No re-push is required and only changed files will be copied over to the Bluemix server saving a lot of time. See the following for more details: http://www-01.ibm.com/support/knowledgecenter/SS8PJ7_9.5.0/com.ibm.etools.iwd.doc/topics/tincrementalpublish.html. As you mentioned, if you change the server configuration (server.xml) then you will need to re-push the packaged server. Incremental publishing is supported for applications deployed directly to Liberty on Bluemix as well.

How to use MS Web Deploy to deploy to remote server in a datetime stamped folder

All the deployments in my work place are manual. I have been looking at ways to automate all of this using MSBUILD and MS Web Deploy. What I have managed to get working is as follows:
build/compile solutions
run database migrations
deploy directly to website using ms web deploy
All from one MSBUILD script.
This differs slightly from the manual process, as when a new version of a website is deployed manually, it is put into a new folder that is datetime stamped. And then IIS is pointed to the new folder.
My question is, how would I do these last 2 actions? i.e. write to a specific folder that sits a level higher up than the folder the current website points to, and then repoint to the new folder IIS.
Web Deploy does not support this functionality directly. Thankfully it does provide the runCommand provider, which is what you'll end up using.
%windir%\system32\inetsrv\appcmd.exe is the utility you'll use to swap site directories. An example of usage can be found here: How do I change the physical path of web site in IIS7 with APPCMD?
Create a script that calls appcmd. This script will always sit on your destination server. You can either decide to include it as a part of your site deployment, or move it along into the new directory from the old one. The "web deploy user" on the destination machine needs to have the appropriate credentials and access to create directories.
In your MSBUILD script, prior to deployment, call the script on the destination server. E.g.
msdeploy.exe -verb:sync -source:runcommand="C:\path\to\wwwroot\bin\script.bat"
-dest:auto,wmsvc=https://contoso.com:8172/msdeploy.axd,username=%username%,password=%password%
Then deploy as usual
NOTE:
Try to avoid this way of deploying entirely. If you're looking to snapshot your site, consider deploying to a package (zip), and then deploying that package to your destination server. Rollbacks should be handled by deploying an older package, not by repointing to an older directory.

Failed to deploy worklight adapter in Worklight

When deploying the BPM project in a development environment, everything works. However, when trying to move the project to the WAS application server, the adapter deployment fails (.war and .wlapp deployment passes successfully):
Failed to deploy adapter 'BPMAdapter.adapter'. : Procedure 'getRest' in adapter 'BPMAdapter' requires security test 'BPMAdapter-securityTest' which is not defined in authenticationConfig.xml.
We've verified the security test exists in authenticationConfig.xml, here's the portion of the tests, so it is, in fact present:
<securityTests>
<customSecurityTest name="BPMAdapter-securityTest">
<test isInternalUserID="true" realm="BPMAuthRealm"/>
</customSecurityTest>
<webSecurityTest name="BPMApp-web-securityTest">
<testUser realm="BPMAuthRealm"/>
</webSecurityTest>
<mobileSecurityTest name="BPMApp-strong-mobile-securityTest">
<testUser realm="BPMAuthRealm"/>
<testDeviceId provisioningType="none"/>
</mobileSecurityTest>
<mobileSecurityTest name="BPMApp-mobile-securityTest">
<testUser realm="BPMAuthRealm"/>
</mobileSecurityTest>
</securityTests>
These are the steps we've taken:
Testing server: Windows 2008 R2 Datacenter
Database: DB2 10.1
Application Server: WAS 8.0.0.3 ND
Installed Worklight Server Enterprise 5.0.5 with DB2 databases successfully. (Worklight is working at: http://internal:9082
Installed in the server (for the sake of not having problems with JDBC during build) Worklight Studio Enterprise 5.0.5 successfully.
Imported the project into a new workspace inside Studio.
Deployed worklight adapter BPMAdapter.xml successfully.
Right click on the app (BPMApp) and "Build All and Deploy" successfully.
Opened http://internalIP:8080/console (Development Jetty based worklight console) to see if the application deployed, and indeed it's shown in the list (Both the apps and the adapter).
Tested with "Preview as common resources" to verify the application works, success.
Now we proceed to make the adjustments to the files needed for WAS deployment:
Changed the in the application-descriptor.xml file from
http://${local.IPAddress}:8080 to http://internalIP:9082/worklight (this example shows the same approach http://goo.gl/xbynL)
At that point we open the bin dir and copy to a folder in the desktop all the *.wlapp files and the BPMAdapter.adapter file.
Now we make the changes in the worklight.properties file:
publicWorkLightHostname=the operational hostname for the worklight server
publicWorkLightProtocol=http
publicWorkLightPort=9082
publicWorkLightContext=/worklight
wl.db.jndi.name=jdbc/WorklightDS
wl.db.type=DB2
wl.db.url=jdbc:db2:Worklight
wl.db.username=wluser
wl.db.password=correctpassword
wl.reports.db.jndi.name=jdbc/WorklightReportsDS
wl.reports.db.type=${wl.db.type}
wl.reports.db.url=${wl.db.url}
wl.reports.db.username=${wl.db.username}
wl.reports.db.password=${wl.db.password}
Saved the worklight.properties and immediately the *.war is regenerated, we copy the *.war to the deployment folder for later upload to WAS.
Create in WAS the Enterprise application according to: (Infocenter for WL 5.0.5 - Deploying a customization .war file to WebSphere Application Server Full Profile) making sure that In the "Class loader order" pane, click Classes loaded with local class loader first (parent last) and In the modules section the "Class loader order" pane, click Classes loaded with local class loader first (parent last).
WAR upload and start-up is successful.
With the .war uploaded (context root BPMWorklight) we go in the browser to http://internalIP:9082/BPMWorklight/console/#catalog
and upload the BPMApp-all.wlapp (we don't upload the other three iPhone, android or common, just the -all.wlapp) the upload is successful.
We proceed to upload in http://internalIP:9082/BPMWorklight/console/#catalog
the adapter BPMAdapter.adapter, we get the error "Failed to deploy adapter 'BPMAdapter.adapter'. : Procedure 'getRest' in adapter 'BPMAdapter' requires security test 'BPMAdapter-securityTest' which is not defined in authenticationConfig.xml."
See my answer here: Failed deploying application using Worklight Console: "Failed to deploy application <appName>.wlapp'. : ERROR
Make sure that the Worklight Server version that is installed on WebSphere matches that of the Worklight Studio Eclipse plug-in used to create the .war, .wlapps and .adapter files.
In addition, make sure that:
you use the same context root ("BPMWorklight") for all:
in application-descriptor.xml
in worklight.properties
name of the .war file
you have removed the previous .war installed by default by the Worklight installation on WAS
I am getting the feeling that you have several Worklight .war files deployed and they are somehow using the wrong .war, thus not finding/using the correct authenticationConfig.xml, which could explain not finding the securityTest.
In Worklight 5.0.x, there should be only 1 Worklight .war file at a time.

Deployment scanner/folder in JBoss AS7 domain managed mode

Is there a deployment folder where a war can be placed in the master node so that it gets deployed to all the slave nodes in a domain managed setup in JBoss AS7?
I know that we can use the JBoss CLI to deploy to a server group which places the artifact in the JBOSS_HOME/domain/data//content directory.
However I would like to find out if there is a way that it can be placed in a deployments folder under the domain of the master node (e.g. JBOSS_HOME/domain/deployments) that is similar to the one available in the standalone mode (i.e. JBOSS_HOME/standalone/deployments) so that the deployment scanner picks it up and makes it available to the slave nodes in the domain without the explicit deploy command via CLI.
To summarize the comments above: There is no deployment directory in domain mode.
You can use the CLI
the web console
the maven plugin
or create your own deployment manager.
I wrote a, now old, blog post on how to do this on a standalone server, but it could be slightly changed to use on a domain server. Have a look at how it's done with the jboss-as-maven-plugin for an example.