This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Configuring Server Role
In cApp development time, you have to specify a Server Role for each and every artifact in the cApp because at development time, the physical server in which a particular artifact will be deployed is unknown. Therefore, a logical Server Role is assigned for each and every artifact.
For example, if you are developing an Axis2 service and are going to deploy all your services in a single AppServer instance in the production setup, you may set the server role as "appserver1."
At the deployment time of the cApp, you have to set the Server Roles for each and every Carbon instance in your setup. You can set one or more roles which can be enacted by the current Carbon instance. The product name is set as the default value for the Server Role of each product. The following three methods can be used to set the server role.
Using Server Roles Manager UI
This is the easiest way to set the server role of your Carbon instance.
See Adding a Server Role and Deleting a Server Role.
Tip
This is the most recommended way to configure your server roles.
Using Carbon XML Configuration
In the $GREG_HOME/repository/conf/carbon.xml
file, you can find the following element.
<ServerRoles> <Role>ApplicationServer</Role> </ServerRoles>
You can set multiple role elements here to specify the roles acted by the current server.
For example, if you want this server to act as "appserver1" and "dataservices1" servers, the configuration will be as follows.
Tip
Before setting this, you have to make sure that the current server has the capabilities of deploying Axis2 services and data services.
<ServerRoles> <Role>appserver1</Role> <Role>dataservices1</Role> </ServerRoles>
When you deploy a cApp artifact on this server, all artifacts which have the above two Server Roles will be deployed on the current instance. Others will be ignored.
Using a system property
You can use the system property serverRoles
to specify the Server Roles that can be enacted by the current Carbon instance. So when you start the server, pass the Server Roles as a comma separated list as follows.
For example:
sh wso2server.sh -DserverRoles=appserver1,dataservices1
Note
Once you use the Server Roles UI to configure your Server Roles, you cannot change that configuration using other two methods because when you use the UI, the Server Roles will be stored in the Registry and after that, the values in Registry are given priority over the values set using other two methods.