ci.docker.websphere-traditional icon indicating copy to clipboard operation
ci.docker.websphere-traditional copied to clipboard

How to generate a random server name when starting the JVM

Open kirankolluri226 opened this issue 3 years ago • 1 comments

I am working on migrating an application from WAS ND to OpenShift (using docker images from WAS Base repo). This migration has been pretty straight forward for all applications i have worked on, but there is a specific application which runs fine when only one instance of WAS pod is running, but if i try to start a second pod the application will not start on the second pod. The reason being the application is reading the variable ${WAS_SERVER_NAME} from websphere variables and storing it in a DB table. For the application internal load balancing it looks like they have disabled startup of the jvm's with same name. Since i am using WAS traditional image and all was jvm's are named "server1" I am currently limited to start only one instance of this specific application. I am looking to see if i can generate a random uuid for the JVM name instead of "server1", so that when i start like 5 pods of this application each of them have a random name and i do not run into this issue in future. I have tried using /work/update_config.sh & /work/update_config.py trying to generate random uuid's and passing it to the python script, trying to see if i can fix this by just updating the websphere variable and having to update the actual jvm name. I am trying to see if i can implement this by updating the create_profile.sh as well. Any suggestions or inputs here are helpful, thanks in advance.

kirankolluri226 avatar Jun 24 '21 17:06 kirankolluri226

@kirankolluri226 Two options

  1. Check the server start script, new pod needs to set prefered name in SERVER_NAME=${SERVER_NAME:-"server1"} https://github.com/WASdev/ci.docker.websphere-traditional/blob/master/docker-build/8.5.5.20/scripts/start_server.sh
  2. make your application read diffrent variable, like hostname+servername that would make uniquename

srbala avatar Feb 23 '22 05:02 srbala