Skip to content

remyma/puppet-karaf

Repository files navigation

Karaf

Build Status Puppet Forge Version

Table of Contents

  1. Description
  2. Setup
  3. Usage - Configuration options and additional functionality
  4. Reference

Description

This module can be used to set up a single or multiple Karaf instances.

Current version tested by this module is Karaf 4.2.0.

Setup

The module manages the following

  • Download or copy and extract karaf zip file
  • Configure karaf
  • Install karaf as a service

Setup requirements

  • puppetlabs-java for Java installation

Beginning with karaf

Declare the top-level karaf class and set up an instance:

class { 'karaf':
}

Usage

How to install a single Karaf instance

  • Installation, make sure service is running and will be started at boot time :
class { 'karaf':
}

This will install and configure a service named 'karaf'.

  • You can specify repos to be added on karaf startup, as well as features to start during karaf boot
class { 'karaf':
   karaf_startup_feature_repos => ['mvn:org.apache.camel.karaf/apache-camel/2.18.1/xml/features'],
   karaf_startup_feature_boots => ['jndi', 'jms', 'camel', 'camel-swagger', 'camel-jms']
}
  • You can override karaf default logging configuration file by providing your own:
class { 'karaf':
   file_karaf_logging    => 'puppet:///modules/karaf/karaf/etc/org.ops4j.pax.logging.cfg'
}
  • If you need to update your maven settings (for instance if karaf needs to retrieve maven dependencies from nexus), you can override maven settings:
class { 'karaf':
   file_maven_settings   => 'puppet:///modules/karaf_is/maven/settings.xml'
}

How to configure a Karaf instance

You can configure your karaf instance by using parameters : check reference section to know all available parameters.

How to manage multiple karaf instances

If you want to install several karaf instances, just provide an array of instances you want to create. You have to fulfill karaf_configuration_properties property to specify different ports for the instances.

$karaf_instances = {
  'instance1' => {
    karaf_configuration_properties => {
      'org.apache.karaf.shell.cfg'      => {
        "sshPort" => 8101
      },
      'org.apache.karaf.management.cfg' => {
        "rmiRegistryPort" => 1099,
        "rmiServerPort"   => 44444,
      },
    },
  },
  'instance2' => {
    karaf_configuration_properties => {
      'org.apache.karaf.shell.cfg' => {
        "sshPort" => 8102
      },
      'org.apache.karaf.management.cfg' => {
        "rmiRegistryPort" => 1098,
        "rmiServerPort"   => 44445,
      },
    }
  },
}

class { 'karaf':
  instances => $karaf_instances
}

How to remove a karaf instance

$karaf_instances = {
  'instance1' => {
    ensure  => absent
  }
}

class { 'karaf':
  instances => $karaf_instances
}

Reference

Parameters

All parameters are optional.

version

String. Karaf version to install (eg. 4.0.10).

rootdir

String. Directory path where karaf will be installed.

install_from

String. 'web' or 'file'. If web, zip package is retrieved from url. If not, zip package has to be provided in module files/karaf/dist directory.

karaf_file_name

String. name of karaf directory when unzipped.

karaf_zip_url

String. Url of karaf zip. Used id install_from web

service_user_name

String. User name of user to run karaf

service_user_id

String. User id of user to run karaf

service_group_name

String. Group name of user to run karaf

service_group_id

String. Group id of user to run karaf

java_home

String. java home

default_env_vars

Array. Environment variables used in setenv.sh file. Example :

default_env_vars      => {
   'JAVA_MIN_MEM'  => '256M'
}

karaf_ssh_host

String. ssh host to connect to karaf console.

karaf_ssh_port

String. ssh port to connect to karaf console.

karaf_ssh_user

String. ssh user to connect to karaf console.

karaf_custom_properties

Array. custom properties to extend karaf properties in etc/custom.properties file.

karaf_users_definition

Array. list of users definition to add in etc/users.properties file. By default, it will add the karaf user as admin with karaf password (same as the default Karaf installation).

  karaf_users_definition => {
    'karaf' => 'karaf,_g_:admingroup'
  }

The syntax is explained in users.properties file

karaf_startup_feature_repos

Array. List of repos to declare at karaf startup.

karaf_startup_feature_boots

Array. List of features to automatically start on karf boot.

mvn_repositories

String. Maven repositories to override the ones in ${karaf.home}/etc/org.ops4j.pax.url.mvn.cfg file under org.ops4j.pax.url.mvn.repositories property.

file_maven_settings

String. Path of file to override maven settings.

file_karaf_logging

String. Path of file to override karaf logging.

karaf configuration properties

Array. List of configuration files (from karaf etc folder) with associated properties to override. Only works with single line value properties

karaf_configuration_properties => {
  'org.apache.karaf.shell.cfg'      => {
    "sshPort" => 8101
  },
  'org.apache.karaf.management.cfg' => {
    "rmiRegistryPort" => 1099,
    "rmiServerPort"   => 44444,
  },
},