/knotx-cookbook

Cookbook for automated Knot.x deployment.

Primary LanguageRubyApache License 2.0Apache-2.0

knotx-cookbook

Cookbook that installs and knotx instance.

Supported Platforms

  • CentOS/RHEL 6.x
  • CentOS/RHEL 7.x

Attributes

knotx.rb

Key Type Description Default
default['knotx']['user'] String Knotx user knotx
default['knotx']['group'] String Knotx group knotx
default['knotx']['base_dir'] String Common installation directory /opt/knotx
default['knotx']['log_dir'] String Logging directory /var/log/knotx
default['knotx']['log_level']['main'] String Main logging level INFO
default['knotx']['log_level']['netty'] String Netty logging level INFO
default['knotx']['log_level']['root'] String Root logging level ERROR
default['knotx']['release_url'] String Base of download link used when only knotx version is provided https://github.com/Cognifide/knotx/releases/download
default['knotx']['debug_enabled'] Boolean Enable debug on dedicated port false
default['knotx']['jmx_enabled'] Boolean Enable JMX on dedicated port true
default['knotx']['jvm_config_path'] String Path to JVM config relative to instance install directory knotx.conf
default['knotx']['jmx_ip'] String JMX IP 0.0.0.0
default['knotx']['jmx_port'] String JMX port 18092
default['knotx']['debug_port'] String Debug port 28092
default['knotx']['port'] String Knotx instance port 8092
default['knotx']['min_heap'] String JVM minimum heap size 256
default['knotx']['max_heap'] String JVM maximum heap size 1024
default['knotx']['code_cache'] String JVM code cache size 64
default['knotx']['extra_opts'] String JVM additional options
default['knotx']['app_config_path'] String Path to knotx application config relative to instance install directory config.json
default['knotx']['app_config_extra'] String Additonal knotx startup paramters, for exmaple path to additonal extension
default['knotx']['config']['git_enabled'] String If true, then configuration is pulled from git to 'config' directory residing in instance directory false
default['knotx']['config']['git_dir'] String Directory where git config should be cloned
default['knotx']['config']['git_url'] String URL to git repository with config https://github.com/Cognifide/knotx.git
default['knotx']['config']['git_user'] String User to access git repository
default['knotx']['config']['git_pass'] String Password to access git repository
default['knotx']['config']['git_revision'] String Revision, tag or branch name to pull from git repository master
default['knotx']['source']['knotx_init'] String Source cookbook for knotx init script template knotx
default['knotx']['source']['knotx_conf'] String Source cookbook for knotx.conf template knotx
default['knotx']['source']['config_json'] String Source cookbook for config.json file knotx
default['knotx']['source']['logback_xml'] String Source cookbook for logback.xml template knotx

knotx_instance resource attributes

Key Type Description Default
id String Isntance ID. Used to create init scripts, instance directory and logfiles Value of resoruce name
version String Which version of knotx should be deployed 1.0.0-RC7
source String Direct link to knotx jar that should be deployed. It overwrites 'version' attrbiute

Instance specific attributes

In case we want to create second instance of knotx on the same server named 'main2' we can just define instance specific atrributes that will overwrite the default ones.

default['knotx']['main2']['jmx_port'] = '18093'
default['knotx']['main2']['debug_port'] = '28093'
default['knotx']['main2']['port'] = '8093'

Usage scenarios

Simple installation

include_recipe 'knotx::commons'

knotx_instance 'Knotx Main: Install' do
  id 'main'
  version '1.0.0-RC2'
end

Installation with knotx extensions (automated installation is comming...)

include_recipe 'knotx::commons'

base_dir = "#{node['knotx']['base_dir']}/main/app"

directory base_dir do
  owner node['knotx']['user']
  group node['knotx']['group']
  mode '0755'
  recursive true
  action :create
end

remote_file "#{base_dir}/knotx-ext.jar" do
  source "https://remotelink.com/knotx-ext.jar"
  owner node['knotx']['user']
  group node['knotx']['group']
  mode '0755'
  action :create

  notifies :restart, 'service[knotx-main]', :delayed
end

knotx_instance 'Knotx Main: Install' do
  id 'main'
  version '1.0.0-RC2'
end

service 'knotx-main' do
  action :nothing
end

Work in progress

TODO:

  • extensions installation
  • further improve logic in HWRP
  • switch between core and example possible
  • jar cleanup after version switch
  • all actions including restart/start/stop
  • add extensions testing with multiple knotx instances

develop