Docker image for WAS 9 and scripts to deploy spring boot application using wsadmin script
docker pull ibmcom/websphere-traditional
docker run -p 9043:9043 -d ibmcom/websphere-traditional:latest
URL: https://localhost:9043/ibm/console/login.do?action=secure
username: wsadmin
password: ?
NOTE: password need to run this script to get it:
docker exec -it CONTAINER_ID cat /tmp/PASSWORD
Then, simply change the password:
- Logging to the console
- Users and Groups
- Manage Users
- Select
wsadmin
- New Password - NOTE: no need for the old password
- OK
To get inside the container
docker exec -it CONTAINER_ID /bin/bash
It should package by war
Just add into the pom.xml
:
<packaging>war</packaging>
then, we need two files: ibm-web-bnd.xml
ibm-web-ext.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-bnd
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"
version="1.0">
<virtual-host name="default_host"/>
</web-bnd>
<?xml version="1.0" encoding="UTF-8"?>
<web-ext
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
version="1.0">
<context-root uri="/"/>
</web-ext>
then, yuo should put these files in your application by adding
the files inside the main/webapp/WEB-INF/
create the folders if
it's not exists
Now we get through the wsadmin script docs for deployment
The IBM Docs for the commands to install it's inside AdminApp object
For example of install app: I wrote small script to install some app
wsadmin.sh
in /opt/IBM/WebSphere/AppServer/bin/wsadmin.sh
In the below lab, a WAS Docker image is used to create a container
as the running environment. In the image, WebSphere Application Server is installed
in folder /opt/IBM/WebSphere/AppServer
.
$PATH_TO_WSADMIN/wsadmin.sh -username wsadmin -password wsadmin -lang jython # Logging
AdminApp.install('demo.war', '[-appname HelloWorld -cell DefaultCell01 -server server1]')
AdminConfig.save()
Sync1 = AdminControl.completeObjectName('type=NodeSync,process=nodeagent,node=AppSrvNode01,*')
AdminControl.invoke(Sync1, 'sync')
And you can put it as Python file
Then, you need to just logged in to wsadmin
and use this command:
execfile('deploy.py')
Using this IBM docs for run the deploy.py
without logging inside the wsadmin.sh
to interact with it.
wsadmin.sh commands options IBM docs
-f
option to run the file.
wsadmin.sh -username wsadmin -password wsadmin -lang jython -f deploy.py
If you want to update the application use this script:
AdminApp.update('HelloWorld', 'app', '[-operation update -contents /tmp/demo-2.war -usedefaultbindings -nodeployejb]')
IBM Docs: Update application IBM docs
In update-class-loader.py file.
Based on the IBM Docs for update the module class loader order - Update Module Class Loader Order
- Commands for the AdminApp object using wsadmin scripting
- https://www.ibm.com/docs/en/was/9.0.5?topic=scripting-application-serving-environment-wsadmin
- ibm-web-bnd.xml IBM Docs
- ibm-web-ext.xml IBM Docs
- Installing enterprise applications using wsadmin scripting
- Update application IBM docs
- wsadmin.sh commands options IBM docs