layout | title | categories | parent | weight |
---|---|---|---|---|
post |
Puppet XAP Module |
SBP |
production.html |
100 |
{% summary page %}This pattern explains how to use Puppet to install and configure XAP.{% endsummary %}
{% tip %}
Author: Shay Hassidim
Recently tested with GigaSpaces version: XAP 9.6
Last Update: Feb 2014
{% toc minLevel=1|maxLevel=1|type=flat|separator=pipe %} {% endtip %}
{%section%} {%column width=50% %}
This XAP module for Puppet performs two main tasks:
Step 1: Install Gigaspaces XAP.
Step 2: Configure node with one or more XAP roles e.g. Management role, Container role and Web-ui role. {%endcolumn%} {%column width=45% %} {%endcolumn%} {%endsection%}
To simulate the IT network we have built 3 virtual machines with VirtuaBox.
Step 1: Download and install Virtual Box
Step 2: Download the learning puppet VM notify to download the OVF file. http://info.puppetlabs.com/download-learning-puppet-VM.html
After download is completed follow the instructions at Importing the VM into VirtualBox. When the import is complete successfully the puppet master is ready.
Step 3: To prepare puppet agent clone the puppet master and follow the instructions at Learning Puppet - Preparing an Agent VM.
Step 4: Create a new VM with windows 7 installation then download and puppet agent for windows and install it.
After completing the steps above your development and testing environment should consist of 3 virtual machines:
- Centos Linux - puppet master
- Centos Linux - puppet agent
- Windows 7 - puppet agent for windows
XAP puppet module dependent on other puppet's modules that should be installed:
- Connect to the master VM: ssh root@<vm_ip_address>
- Type password: puupet
- List the already installed modules: puppet module list
- puppet module install biemond/jdk7
- puppet module install reidmv/windows_package
- puppet module install liamjbennett/windows_firewall
List the installed module again by running: puppet module list , and you expected to see the above module is installed.
To install the XAP module copy XAP folder under the modules
directory in your puppet labs installation.
-
Navigate to your puppet labs configuration directory: {% highlight java%} a. cd /etc/puppetlabs/puppet/modules/ and then Copy the xap directory under the modules directory b. If you clone it from github: cd /etc/puppetlabs/puppet/modules/ git clone https://github.com/Gigaspaces/xap-puppet.git mv xap-puppet xap {% endhighlight %}
-
Run: puppet module list, to see the module:
The directory layout and structure is a standard puppet module layout:
- files - include extracted XAP directory and all the JDK version according the nodes platform in your network
- manifests - include all the logic and classed the module used
- templates - include all the template files used to generate scripts at runtime when agent node request a configuration catalog
The init.pp
is the entry point of any puppet module.
{% highlight java%}
class xap{
require xap::params
case $kernel{
'windows' : {
xap::windows_install{'windows-xap-install':}
}
default : {
xap::linux_install{'linux-xap-install':}
}
}
#copy gigaspaces-xap dir to the target xap installation directoary file { "${xap::params::gigaspaces_xap_target}" : source => "puppet:///modules/${module_name}/${xap::params::gigaspaces_xap_source}", recurse => true, ensure => directory, } ~> #configure installation xap::configure{'configure xap environment':}
}
class xap::manager ( $global_lus = 0, $lus = 1, $global_gsm = 0, $gsm = 1, $gsc = 2, ) inherits xap {
xap::gs_agent{'xap_manager': name => "manager_gsa_global_lus_${global_lus}gsa_lus${lus}gsa_global_gsm${global_gsm}gsa_gsm${gsm}gsa_gsc${gsc}", g_lus => $global_lus, l_lus => $lus, g_gsm => $global_gsm, l_gsm => $gsm, l_gsc => $gsc, } }
class xap::container ( $global_lus = 0, $lus = 0, $global_gsm = 0, $gsm = 0, $gsc = 4, )inherits xap {
xap::gs_agent{'xap_container': name => "container_gsa_global_lus_${global_lus}gsa_lus${lus}gsa_global_gsm${global_gsm}gsa_gsm${gsm}gsa_gsc${gsc}", l_gsc => $gsc, } }
class xap::webui inherits xap {
xap::web_ui {"xap_webui":} } {% endhighlight %}
The params.pp should include all the configuration. See example below: {% highlight java %} class xap::params {
$jdk_version = '7' # jdk version
$jdk_update ='45' # jdk update
$jdk_file =
$gigaspaces_xap_source = 'gigaspaces-xap-premium-9.6.2-ga'
$gigaspaces_xap_target =
#configure environment $extension = $kernel ? { 'windows' => 'bat', default => 'sh', }
$config_dir = $kernel ? { 'windows' => 'c:/gigaspaces', default => '/opt/gigaspaces', }
$gs_webui_war_file = "gs-webui-9.6.2-9900-RELEASE.war"
#LOOKUPLOCATORS value $lookup_locators = '192.168.141.130'
$lookup_groups ="gigaspaces-9.6.2-XAPPremium-ga"
$java_vm_name = $kernel ? { default => 'ALL', }
$java_home =
$com_sun_jini_reggie_initialUnicastDiscoveryPort=4174 $com_gs_transport_protocol_lrmi_bind_port_start=8000 $com_gs_transport_protocol_lrmi_bind_port_end=8100 $com_gigaspaces_system_registryPort=10098 $com_gigaspaces_start_httpPort=9813 $com_gs_webui_port=8099
$Xms = '300m' $Xmx ='8g' $Xmn ='' $XXCMSInitiatingOccupancyFraction = '60' } {% endhighlight %}
There are three roles supported:
-
xap::manager role
-
xap::container role
-
xap::webui
To associate a node with a role edit the /etc/puppetlabs/puppet/manifests/site.pp
and add for each node the target roles. Example:
{% highlight java %}
filebucket { 'main': server => 'learn.localdomain', path => false, }
File { backup => 'main' }
node default {
} node 'agent1.localdomain' { include xap::manager include xap::webui }
node 'win7-agent' { include xap::container } {% endhighlight %}