forked from realityforge/chef-kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkibana2.rb
64 lines (51 loc) · 1.58 KB
/
kibana2.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Encoding: utf-8
include_recipe 'kibana'
package 'git'
git node['kibana']['base_dir'] do
repository node['kibana']['git']['url']
reference node['kibana']['git']['reference']
user node['kibana']['user']
group node['kibana']['group']
action :checkout
end
package 'libcurl4-gnutls-dev' if node['platform']['ubuntu']
if node['kibana']['rubyversion'] == '1.8' || node['kibana']['rubyversion'] == '1.9.1'
package "ruby#{node['kibana']['rubyversion']}-full"
else
package "ruby#{node['kibana']['rubyversion']}"
end
#gem1.8 doesn't get brought in with ruby1.8.x
if node['kibana']['rubyversion'] == '1.8'
package "rubygems#{node['kibana']['rubyversion']}"
end
gem_package 'bundler' do
gem_binary "/usr/bin/gem#{node['kibana']['rubyversion']}"
action :install
end
# kibana requires eventmachine which requires a gem with native extensions. Thus we need
# to include build-essentials prior to installing kibana
include_recipe 'build-essential::default'
bash 'kibana bundle install' do
cwd node['kibana']['base_dir']
code 'bundle install'
end
service 'kibana' do
provider Chef::Provider::Service::Upstart
supports start: true, restart: true, stop: true, status: true
action :nothing
end
template '/etc/init/kibana.conf' do
source 'upstart.conf.erb'
mode '0600'
notifies :restart, 'service[kibana]', :delayed
end
template "#{node['kibana']['base_dir']}/KibanaConfig.rb" do
source 'KibanaConfig.rb.erb'
user node['kibana']['user']
group node['kibana']['group']
mode '0600'
notifies :restart, 'service[kibana]', :delayed
end
service 'kibana' do
action [:enable, :start]
end