Unknown macro: {next_previous_link3}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The newly introduced Configurator component aims to tackle the cumbersome task of product and instance configuration with complex requirements. In the case of a Cartridge instance, there are numerous run-time factors that you need to take into account for the correct configuration to take place. Some of these factors include clustering and database information, the role of the Cartridge type in the clustering context and even the role of the Cartridge on the product specific distributed setup (such as that of WSO2 API Manager). The Configurator simplifies these factors into a simple module.ini file, which includes all the parameters that are configurable in that specific Cartridge. 

Template Module

The Configurator operates on a set of configuration templates, which are referred to as a Template Module. A Template Module should be of the following folder structure and should contain the files and templates, which are needed to configure the specific Cartridge.

├── files
├── templates
└── module.ini

files

The files folder contains the static files, which do not require any template processing. For example, mysql-connector-java-5.1.36.jar file should go inside the files folder. 

templates

The templates folder contains the configurable template files. For example, if clustering can be configured in a particular template module for a Carbon product, the axis2.xml file should be included in the templates folder as a templated file, axis2.xml.template. The template file content for the clustering related area can look as follows:

 

axis2.xml.template
<clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="{{ CONFIG_PARAM_CLUSTERING }}">
<parameter name="membershipScheme">{{CONFIG_PARAM_MEMBERSHIP_SCHEME}}</parameter>
<parameter name="domain">{{CONFIG_PARAM_DOMAIN}}</parameter>
<parameter name="localMemberHost">{{CONFIG_PARAM_LOCAL_MEMBER_HOST}}</parameter>
<parameter name="localMemberPort">{{CONFIG_PARAM_LOCAL_MEMBER_PORT}}</parameter>
<parameter name="properties">
<property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
<property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
{% if CONFIG_PARAM_SUB_DOMAIN == 'mgt' %}
{% if CONFIG_PARAM_PT_HTTP_PROXY_PORT is defined -%}
<property name="port.mapping.80" value="{{CONFIG_PARAM_PT_HTTP_PROXY_PORT}}"/>
{% else -%}
<property name="port.mapping.80" value="9763"/>
{% endif -%}
{% if CONFIG_PARAM_PT_HTTPS_PROXY_PORT is defined -%}
<property name="port.mapping.443" value="{{CONFIG_PARAM_PT_HTTPS_PROXY_PORT}}"/>
{% else -%}
<property name="port.mapping.443" value="9443"/>
{% endif -%}
<property name="subDomain" value="mgt"/>
{% endif %}
<!-- Worker Setup-->
{% if CONFIG_PARAM_SUB_DOMAIN == 'worker' %}
<property name="subDomain" value="worker"/>
{% endif %}
</parameter>
<members>
{% for key, value in CONFIG_PARAM_WKA_MEMBERS.iteritems() -%}
<member>
<hostName>{{ key }}</hostName>
<port>{{ value }}</port>
</member>
{% endfor -%}
</members>

The Configurator uses the following templating language: Jinja Templating

module.ini

The module.ini file contains the configurable options for the specific template module. For example, for the above mentioned clustering enabled axis2.xml.template file, the following can be the likely entries of the module.ini file.

module.ini
[SETTINGS]
READ_FROM_ENVIRONMENT=true
CARBON_HOME=/opt/wso2am-1.9.1

[PARAMS]
CONFIG_PARAM_CLUSTERING=true
CONFIG_PARAM_MEMBERSHIP_SCHEME=wka
CONFIG_PARAM_DOMAIN=wso2.carbon.domain
CONFIG_PARAM_LOCAL_MEMBER_HOST=127.0.0.1
CONFIG_PARAM_LOCAL_MEMBER_PORT=4000
CONFIG_PARAM_WKA_MEMBERS=[127.0.0.1:4000]
CONFIG_PARAM_PORT_OFFSET=0
CONFIG_PARAM_PROFILE=Default

 

READ_FROM_ENVIRONMENT

If READ_FROM_ENVIRONMENT is set to true, then the Configurator will override any values specified in the module.ini file with values from the environment variables. 

CARBON_HOME

CARBON_HOME is the path to the product, which has to be configured using the specified templates. 

Running the Configurator

The Configurator has to be pointed to the location of the template module. It will look for the module.ini file, read the configuration values, process the templates inside templates folder, and copy the processed templates and the files inside files folder to the CARBON_HOME

Download Configurator

The Configurator is hosted on the Private PaaS Cartridge Repository. 

  1. Checkout the Cartridge Repository.

TODO

This section has to be updated when the release completes.

Create Template Module

Create the template module with the above mentioned folder structure. However, Private PaaS Cartridge Repository contains a list of Cartridges with Template Modules that can built. For example, if we are building the template module for WSO2 API Manager the following procedure can be followed. 

  1. Checkout the Private PaaS Cartridge repository.

    git clone https://github.com/wso2/private-paas-cartridges.git
  2. Navigate to WSO2 API Manager 1.9.1 Template Module.

    cd <PRIVATE_PAAS_CARTRIDGES_HOME>/wso2am/1.9.1/template-module/
  3. Build the Template Module.

    mvn clean install 
  4. Unzip the resulting ZIP file.

    cd /tmp
    unzip  <PRIVATE_PAAS_CARTRIDGES_HOME>/wso2am/1.9.1/template-module/target/wso2am-1.9.1-template-module-4.1.0.zip

Execute Configurator on the Template Module

Navigate to the Configurator folder and execute configurator.py, and pass the template module folder as a command line argument. 

Example:

./configurator.py -d /tmp/wso2am-1.9.1-template-module-4.1.0
  • No labels