Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Since a cApp consists of a set of artifacts to be deployed in different products, when a user tries to deploy a cApp in a particular carbon product, all its artifacts cannot be deployed in that particular product instance. To sort out which can be deployed in which, the ServerRole property is used.

The ServerRole Property

A server role is a parameter that is mentioned in the carbon.xml file (<PRODUCT_HOME>/repository/conf) of all WSO2 Carbon-based products. When a cApp is being deployed, it reads the ServerRoles property from the carbon.xml and deploys only the resources which match the server-role values in there. 

...

In cApp development time, you have to specify a server role for each and every artifact in the cApp. It assigns a logical ServerRole to each and every artifact since, at development time, we are aware of the physical server in which a particular artifact will be deployed.

For example, say you are developing an Axis2 service and planning to deploy all your services in a single Application Server 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 assigned to 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 ServerRole.

Using the Management Console

This is the easiest and the most recommended way to configure your server roles. For more information, please refer to section: Configuring Server Roles for Carbon Applications.

Using carbon.xml File

You can find the ServerRoles element in <PRODUCT_HOME>/repository/conf/carbon.xml file. For example,

Code Block

<ServerRoles>
     <Role>DataServicesServer</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, configuration is as follows.

Code Block

<ServerRoles>
     <Role>appserver1</Role>
     <Role>dataservices1</Role>
</ServerRoles>

Before setting the above, ensure that the current server has capability to deploy Axis2 services and data services. 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 acted by the current Carbon instance. When you start the server, pass the server roles as a comma separated list. For example,

Code Block

sh wso2server.sh -DserverRoles=appserver1,dataservices1

...