Skip to content
/ was-9 Public

Docker image for WAS 9 and scripts to deploy spring boot application using wsadmin script

Notifications You must be signed in to change notification settings

BSA10/was-9

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

was-9

Docker image for WAS 9 and scripts to deploy spring boot application using wsadmin script

Docker Image

Docker Hub

Pull

docker pull ibmcom/websphere-traditional

Run

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

Exec

To get inside the container

docker exec -it CONTAINER_ID /bin/bash

Deploy Spring Boot

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

Deployment Script

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 Path

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.

Usage

$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')

How you can run 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

Update Application

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

Update Class loader order

In update-class-loader.py file.

Based on the IBM Docs for update the module class loader order - Update Module Class Loader Order

Reference

About

Docker image for WAS 9 and scripts to deploy spring boot application using wsadmin script

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages