WebSphere Application Server traditional in Containers

Recipe

  1. Review the Java in Containers recipes
  2. Execute /work/configure.sh as the last step in your Containerfile
  3. Review the WAS traditional recipes
  4. Review the Java recipe
  5. Review the Operating System Recipes

Container Images

  • WebSphere Application Server traditional images:
    • 9.0.5: FROM icr.io/appcafe/websphere-traditional
    • 8.5.5: FROM icr.io/appcafe/websphere-traditional:8.5.5.26
    • See all tags:
      curl -s https://icr.io/v2/appcafe/websphere-traditional/tags/list | jq .tags

Resources

Log Analysis Dashboards

WAS traditional provides a Kibana dashboard example.

Build Example

  1. Create Containerfile:
    FROM icr.io/appcafe/websphere-traditional
    COPY --chown=was:root twasdiag.ear /work/app/
    COPY --chown=was:root trace.jy /work/config/
    RUN /work/configure.sh
    1. twasdiag.ear taken from https://github.com/IBM/twasdiag/releases/latest
    2. trace.jy:
      AdminControl.setAttribute(AdminControl.queryNames('type=HPELLogDataService,process=server1,*'), "purgeMaxSize", "1024")
  2. Build:
    podman build --platform linux/amd64 -t twas .
  3. Run:
    podman run --rm --platform linux/amd64 -p 9043:9043 -p 9443:9443 twas
  4. Access:
    1. Administrative Console: https://localhost:9043/ibm/console
    2. twasdiag: https://localhost:9443/twasdiag

Run Examples

With a custom password

Create a file in the current directory named PASSWORD with an administrative password as its contents. For example:

wsadmin

Then run:

podman run --rm --platform linux/amd64 -p 9043:9043 -p 9443:9443 -v $(pwd)/PASSWORD:/tmp/PASSWORD -e ENABLE_BASIC_LOGGING=true icr.io/appcafe/websphere-traditional

With an auto-generated password

With an auto-generated password:

podman run --rm --platform linux/amd64 -p 9043:9043 -p 9443:9443 -e ENABLE_BASIC_LOGGING=true icr.io/appcafe/websphere-traditional

After you see "open for e-business", access the administrative console with the user name wsadmin and the password from the PASSWORD file at https://localhost:9043/ibm/console/login.do?action=secure

To find the password, first find the container; for example:

$ podman ps
CONTAINER ID  IMAGE                                        COMMAND               CREATED         STATUS         PORTS                                           NAMES
3c7a57912f96  icr.io/appcafe/websphere-traditional:latest  env JVM_EXTRA_CMD...  47 seconds ago  Up 47 seconds  0.0.0.0:9043->9043/tcp, 0.0.0.0:9443->9443/tcp  vigilant_knuth

Then cat the file in the container; for example:

podman exec -it 3c7a57912f96 cat /tmp/PASSWORD

Common Actions

Dynamically Set Diagnostic Trace

  1. Exec into the container
  2. Start wsadmin:
    /opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython
  3. Set trace:
    AdminControl.invoke(AdminControl.completeObjectName("type=TraceService,process=server1,*"), "setTraceSpecification", "*=info:com.ibm.ws.rsadapter.jdbc.WSJdbcCallableStatement=all:com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement=all:com.ibm.ws.rsadapter.jdbc.WSJdbcStatement=all")
  4. Exit wsadmin:
    exit

wsadmin examples

Copy *.py files into /work/config/.

  • Print static HPEL configuration:
    print AdminConfig.showall(AdminConfig.list("HPELLog", AdminConfig.getid("/Cell:DefaultCell01/Node:DefaultNode01/Server:server1/HighPerformanceExtensibleLogging:/")))
  • Print dynamic HPEL configuration:
    print AdminControl.getAttribute(AdminControl.queryNames('type=HPELLogDataService,process=server1,*'), "purgeMaxSize")
  • Update HPEL log and trace settings to a max disk usage of 1GB each:
    print "Updating trace settings"
    AdminConfig.modify(AdminConfig.list("HPELLog", AdminConfig.getid("/Cell:DefaultCell01/Node:DefaultNode01/Server:server1/HighPerformanceExtensibleLogging:/")), "[[purgeMaxSize 1000]]")
    AdminConfig.modify(AdminConfig.list("HPELTrace", AdminConfig.getid("/Cell:DefaultCell01/Node:DefaultNode01/Server:server1/HighPerformanceExtensibleLogging:/")), "[[purgeMaxSize 1000]]")
    AdminConfig.save()