Skip to content

Commit

Permalink
add support for kibana6
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin Chary committed Jun 18, 2018
1 parent e489154 commit 992bef4
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req
* `node['kibana']['kibana3_version']` - Kibana3 exact version.
* `node['kibana']['kibana4_version']` - Kibana4 exact version.
* `node['kibana']['kibana5_version']` - Kibana5 exact version.
* `node['kibana']['kibana6_version']` - Kibana6 exact version.
* `node['kibana']['base_dir']` - The base directory of kibana. Defaults to `/opt/kibana`.
* `node['kibana']['user']` - The user under which Kibana is installed. Defaults to `kibana`.
* `node['kibana']['group']` - The group under which Kibana is installed. Defaults to `kibana`.
Expand All @@ -38,6 +39,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req
* `node['kibana']['kibana3_checksum']` - Checksum of the tarball.
* `node['kibana']['kibana4_checksum']` - Checksum of the tarball.
* `node['kibana']['kibana5_checksum']` - Checksum of the tarball.
* `node['kibana']['kibana6_checksum']` - Checksum of the tarball.
* `node['kibana']['git']['url']` - The URL to Kibana repository. Defaults to `https://github.com/elasticsearch/kibana.git`.
* `node['kibana']['git']['reference']` - The git reference in the Kibana repository. Defaults to `'v' + node['kibana']['kibana3_version']`.
* `node['kibana']['rubyversion']` - The version of Ruby and Gems to use for Kibana. Defaults to `1.9.1`.
Expand Down Expand Up @@ -82,6 +84,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req
* kibana::kibana3
* kibana::kibana4
* kibana::kibana5
* kibana::kibana6
* kibana::nginx

## kibana::apache
Expand Down
5 changes: 5 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
default['kibana']['kibana5_checksum'] = '253dea10f0fa535c6c984981c4012559b43907d4bc6f21668b43295428cef21d'
default['kibana']['kibana5_url'] = "https://artifacts.elastic.co/downloads/kibana/kibana-#{node['kibana']['kibana5_version']}-linux-x86_64.tar.gz"

#<> Kibana6 exact version, checksum, URL
default['kibana']['kibana6_version'] = '6.3.0'
default['kibana']['kibana6_checksum'] = 'f3d89d6d7239138e57ca87e834c52057db97a7acd7b6c0e6ac2ea642674c6992'
default['kibana']['kibana6_url'] = "https://artifacts.elastic.co/downloads/kibana/kibana-#{node['kibana']['kibana6_version']}-linux-x86_64.tar.gz"

#<> The base directory of kibana.
default['kibana']['base_dir'] = '/opt/kibana'
#<> The user under which Kibana is installed.
Expand Down
57 changes: 57 additions & 0 deletions recipes/kibana6.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# frozen_string_literal: true

include_recipe 'kibana'

if node['kibana']['install_method'] == 'release'
ark 'kibana' do
url node['kibana']['kibana6_url']
version node['kibana']['kibana6_version']
checksum node['kibana']['kibana6_checksum']
path node['kibana']['base_dir']
home_dir File.join(node['kibana']['base_dir'], 'current')
owner node['kibana']['user']
end
config_path = 'current/config/kibana.yml'
elsif node['kibana']['install_method'] == 'package'
node.default['kibana']['service']['bin_path'] = 'bin'
if platform_family? 'debian'
apt_repository 'kibana' do
uri node['kibana']['repository_url']
distribution ''
components %w[stable main]
key node['kibana']['repository_key']
end
else
Chef::Log.warn "I do not support your platform: #{node['platform_family']}"
end

package 'kibana'
config_path = 'config/kibana.yml'
else
Chef::Application.fatal!("Since Kibana version 4, install method can only be only 'release' or 'package'")
end

# Install service
include_recipe 'kibana::_service'

# Apply config template
template File.join(node['kibana']['base_dir'], config_path) do
cookbook node['kibana']['config']['cookbook']
source 'kibana6.yml.erb'
owner node['kibana']['user']
group node['kibana']['group']
mode '0644'
variables(
bind: node['kibana']['interface'],
port: node['kibana']['port'],
es_user: node['kibana']['elasticsearch']['user'] || 'kibana',
es_pass: node['kibana']['elasticsearch']['password'] || 'kibana',
es_host: node['kibana']['elasticsearch']['hosts'].first,
es_port: node['kibana']['elasticsearch']['port'],
index: node['kibana']['index'],
defaultapp: node['kibana']['defaultapp'],
logging_option: node['kibana']['logging_option'],
extra_config: node['kibana']['extra_config']
)
notifies :restart, 'service[kibana]'
end
71 changes: 71 additions & 0 deletions templates/default/kibana6.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !! Managed by Chef, do not edit !!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

# Kibana is served by a back end server. This controls which port to use.
server.port: <%= @port %>

# The host to bind the server to.
server.host: "<%= @bind %>"

# The Elasticsearch instance to use for all your queries.
elasticsearch.url: "http://<%= @es_host %>:<%= @es_port %>"

# preserve_elasticsearch_host true will send the hostname specified in `elasticsearch`. If you set it to false,
# then the host you use to connect to *this* Kibana instance will be sent.
elasticsearch.preserveHost: true

# Kibana uses an index in Elasticsearch to store saved searches, visualizations
# and dashboards. It will create a new index if it doesn't already exist.
kibana.index: "<%= @index %>"

# If your Elasticsearch is protected with basic auth, this is the user credentials
# used by the Kibana server to perform maintence on the kibana_index at statup. Your Kibana
# users will still need to authenticate with Elasticsearch (which is proxied thorugh
# the Kibana server)
elasticsearch.username: <%= @es_user %>
elasticsearch.password: <%= @es_pass %>

# Optional settings that provide the paths to the PEM-format SSL certificate and key files.
# These files validate that your Elasticsearch backend uses the same key files.
# elasticsearch.ssl.cert: /path/to/your/client.crt
# elasticsearch.ssl.key: /path/to/your/client.key

# If you need to provide a CA certificate for your Elasticsarech instance, put
# the path of the pem file here.
# elasticsearch.ssl.ca: /path/to/your/CA.pem

# The default application to load.
kibana.defaultAppId: "<%= @defaultapp %>"

# Time in milliseconds to wait for elasticsearch to respond to pings, defaults to
# request_timeout setting
# elasticsearch.pingTimeout: 1500

# Time in milliseconds to wait for responses from the back end or elasticsearch.
# This must be > 0
elasticsearch.requestTimeout: 300000

# Time in milliseconds for Elasticsearch to wait for responses from shards.
# Set to 0 to disable.
elasticsearch.shardTimeout: 0

# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
# elasticsearch.startupTimeout: 5000

# SSL for outgoing requests from the Kibana Server (PEM formatted)
# server.ssl.cert: /path/to/your/server.key
# server.ssl.key: /path/to/your/server.crt

# Set the path to where you would like the process id file to be created.
# pid.file: /var/run/kibana.pid

# If you would like to send the log output to a file you can set the path below.
# This will also turn off the STDOUT log output.
# logging.dest: ./kibana.log
<%= @logging_option -%>

# Extra config
<% @extra_config.each do |k,v| %>
<%= k %>: <%= v %>
<% end %>

0 comments on commit 992bef4

Please sign in to comment.