Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to distribute websphere server configuration (datasources,jms,...) to multiple instances?

For a team of developers it is essential that everybody sets up and configures the application server. In our case we are using websphere 8.5.

I'm looking for an easy way to do this. Normally you do it using the profile management tool located in WAS_HOME/bin/ProfileManagement and this tool works quiet well. But after the installation of the websphere server one still needs to configure the server profile - creating datasources, JMS queues, buses, variables and so on. So I thought it would be nice if there is a way to apply these configurations to an existing profile.

My first try was to just configure one profile and then make a configuration backup using

 %WAS_HOME%/bin/backupConfig.bat

But the configuration contains e.g. the hostname and other host dependent configurations. So the backupConfig.bat tool is not what I'm looking for.

The next thought that came in my mind is that I might could create a special profileTemplate. So that others can use the profile management tool and use this template. But the template structure does not seem to be made for customization. A lot of files and nearly no documentation can be found of how to create an own profile template.

So I came across the augment templates. These template are used (as the name implies) to add specific configuration to an existing profile. I found a lot of documentation of how to apply an augmentation to an existing profile but no documentation of how to create an augmentation.

At last I think that there must be some way of exporting websphere datasource, buses, jms etc. configuration and apply them to other profiles, because in very big installations the operations team must have this ability.

I know that I can add container-specific descriptors to the EAR. E.g. META-INF/ibmconfig/cells/defaultCell/applications/defaultApp/resources.xml. But I don't want to build environment specific EAR files, because it couples our builds to the infrastructure and thus we have to build and redeploy when ever operations changes the infrastructure, e.g. hostnames, IPs, passwords.

Does anyone know how to manage the distribution of datasource, buses, jms, etc. to multiple websphere installations?

like image 822
René Link Avatar asked Oct 01 '22 06:10

René Link


2 Answers

In addition to wsadmin scripts - which are very good for these kind of tasks, I'd suggest Properties-based configuration. It might be more useful for you, since it allows to export many configuration objects at one time and then apply it to different environments. It is also might a bit easier, since you work on plain text files instead of jython scripts.

Properties file based configuration enables you to:

  • Extract data out of the configuration repository to create properties files.
  • Update a properties file to manipulate the configuration, as needed.
  • Apply the updated data in the properties file to a target configuration repository.

See more details here:
Properties-based configuration
Infocenter documentation
Education assistant

like image 99
Gas Avatar answered Oct 12 '22 01:10

Gas


I suggest you to use wsadmin shell scripting and create a script for resource creation. A bonus is that you can run it directly from RAD (right click Run As->Administrative Script).

Here is the complete example written in Jython for JDBC resource creation along with JAAS login information (note: I'm using Oracle Database, your setup could be different depending on database you are using):

cell=AdminConfig.showAttribute(AdminConfig.list("Cell"), "name")
node=AdminConfig.showAttribute(AdminConfig.list("Node"), "name")

#Add JAAS credentials 
print "Adding JAAS credentials"
security = AdminConfig.getid('/Cell:'+cell+'/Security:/') 
alias = ['alias', node+'/dbUser'] 
userid = ['userId', 'DBUSER'] 
password = ['password', 'PASSWORD'] 
jaasAttrs = [alias, userid, password] 
AdminConfig.create('JAASAuthData', security, jaasAttrs) 
AdminConfig.save()  

#Add JDBC jar path 
print "Adding JDBC jar path"
AdminTask.setVariable('[-variableName ORACLE_JDBC_DRIVER_PATH -variableValue ${WAS_INSTALL_ROOT}/lib/ext -scope Cell='+cell+',Node='+node+']') 
AdminConfig.save()

#JDBC Provider print "Adding JDBC Provider"
AdminTask.createJDBCProvider('[-scope Node='+node+',Server=server1  -databaseType Oracle -providerType "Oracle JDBC Driver" -implementationType "Connection pool data source" -name "Oracle JDBC Driver" -description "Oracle JDBC Driver-compliant Provider." -classpath ${ORACLE_JDBC_DRIVER_PATH}/ojdbc6.jar]') 
AdminConfig.save()

#JDBC Datasources print "Creating Datasource"
AdminJDBC.createDataSourceAtScope("Node="+node+",Server=server1", "Oracle JDBC Driver", "test", "jdbc/test", "com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper", "jdbc:oracle:thin:@10.0.0.1:1521:TEST",  [['componentManagedAuthenticationAlias', node+'/test'], ['containerManagedPersistence', 'true']])   
AdminConfig.save()
like image 33
Magic Wand Avatar answered Oct 12 '22 01:10

Magic Wand