Working with Glassfish and Clusters
WARNING
The technique outline below does not work. Until we have sorted out how to do a manual deployment without the admin console (browser), use the admin console (browser).
info
Autodeploy does not work if a cluster is installed. This presents me with a problem as I need applications to be deployed automatically. Notes below will help get through this.
Cluster Directory Structure
When a cluster has been created, glassfish creates a new folder structure in the glassfish root called ./nodes/<node name>/<server-name>/applications/<war-file-name>
The following parameters can be found in the admin console under Clusters int the tree panel on the left, and selecting the Instances tab in the main panel on the right.
In the server instances table in the main panel look for
<node name> the Node column
<server-name> the Name column
Method for Deployment
Copy the war file into directory within a running docker container (I have created a folder called wars in glassfish install directory)
docker cp d:\Dropbox\work\netbeans\DBankWebTier\dist\DBankWebTier.war e54566dec8bf:/opt/glassfish4/glassfish/wars
In this example, the war file DBankWebTier.war is copied to the directory /opt/glassfish4/glassfish/wars in the container e54566dec8bf
Extract the contents into the glassfish folder for applications for a server within a cluster
docker exec e54566dec8bf bash -c "cd /opt/glassfish4/glassfish/nodes/localhost-domain2/tc-server1/applications/DBankWebTier; exec jar xf /opt/glassfish4/glassfish/wars/DBankWebTier.war"
In this example, the exec command opens a bash shell, the -c positions the shell in the directory /opt/glassfish4/glassfish/nodes/localhost-domain2/tc-server1/applications/DBankWebTier. The semi-colon ";" is used to separate commands to the bash shell. The second command is a linux exec command executing the jar application.
Java jar application
The jar application does not have an option to extract the contents of a jar file to a specific directory. You have to e=be in the directory where you want the files extracted to.
Deploying a war file
Use this batch file to deploy the war file to the cluster within a docker container.