Merge lp:~paulcz/charms/precise/kibana/trunk into lp:charms/kibana

Proposed by Paul Czarkowski
Status: Merged
Merged at revision: 6
Proposed branch: lp:~paulcz/charms/precise/kibana/trunk
Merge into: lp:charms/kibana
Diff against target: 313 lines (+138/-65)
11 files modified
README.md (+4/-1)
files/charm/config.js (+54/-0)
files/charm/nginx.conf (+35/-0)
files/charm/nginx_lb.conf (+3/-0)
hooks/install (+27/-44)
hooks/rest-relation-changed (+9/-11)
hooks/rest-relation-joined (+1/-2)
hooks/start (+1/-3)
hooks/stop (+1/-3)
metadata.yaml (+2/-0)
revision (+1/-1)
To merge this branch: bzr merge lp:~paulcz/charms/precise/kibana/trunk
Reviewer Review Type Date Requested Status
Marco Ceppi (community) Approve
Review via email: mp+188243@code.launchpad.net

Description of the change

* updated for kibana3
* uses nginx to serve up kibana3
* uses nginx to proxy/LB for elasticsearch connectivity

To post a comment you must log in.
Revision history for this message
Marco Ceppi (marcoceppi) wrote :

LGTM +1

review: Approve
7. By Paul Czarkowski

default logstash dashboard

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2012-11-22 16:38:58 +0000
3+++ README.md 2013-09-29 22:20:07 +0000
4@@ -9,9 +9,12 @@
5 ----------------
6
7 using this charm :
8+
9 juju deploy kibana
10 juju expose kibana
11+
12 not much use on its own ... you'll probably want the full stack
13+
14 juju deploy elasticsearch
15 juju deploy logstash-indexer
16 juju add-relation logstash-indexer elasticsearch:cluster
17@@ -19,7 +22,7 @@
18 juju add-relation kibana elasticsearch:rest
19 juju expose kibana
20
21- browse to http://ip-address to begin searching.
22+browse to http://ip-address to begin searching.
23
24 Configuration
25 -------------
26
27=== added file 'files/charm/config.js'
28--- files/charm/config.js 1970-01-01 00:00:00 +0000
29+++ files/charm/config.js 2013-09-29 22:20:07 +0000
30@@ -0,0 +1,54 @@
31+/**
32+ * These is the app's configuration, If you need to configure
33+ * the default dashboard, please see dashboards/default
34+ */
35+define(['settings'],
36+function (Settings) {
37+
38+
39+ return new Settings({
40+
41+ /**
42+ * URL to your elasticsearch server. You almost certainly don't
43+ * want 'http://localhost:9200' here. Even if Kibana and ES are on
44+ * the same host
45+ *
46+ * By default this will attempt to reach ES at the same host you have
47+ * elasticsearch installed on. You probably want to set it to the FQDN of your
48+ * elasticsearch host
49+ * @type {String}
50+ */
51+ elasticsearch: "http://"+window.location.hostname,
52+
53+ /**
54+ * The default ES index to use for storing Kibana specific object
55+ * such as stored dashboards
56+ * @type {String}
57+ */
58+ kibana_index: "kibana-int",
59+
60+ /**
61+ * Panel modules available. Panels will only be loaded when they are defined in the
62+ * dashboard, but this list is used in the "add panel" interface.
63+ * @type {Array}
64+ */
65+ panel_names: [
66+ 'histogram',
67+ 'map',
68+ 'pie',
69+ 'table',
70+ 'filtering',
71+ 'timepicker',
72+ 'text',
73+ 'fields',
74+ 'hits',
75+ 'dashcontrol',
76+ 'column',
77+ 'derivequeries',
78+ 'trends',
79+ 'bettermap',
80+ 'query',
81+ 'terms'
82+ ]
83+ });
84+});
85\ No newline at end of file
86
87=== removed file 'files/charm/kibana-ruby.tar.gz'
88Binary files files/charm/kibana-ruby.tar.gz 2012-11-06 04:38:09 +0000 and files/charm/kibana-ruby.tar.gz 1970-01-01 00:00:00 +0000 differ
89=== added file 'files/charm/nginx.conf'
90--- files/charm/nginx.conf 1970-01-01 00:00:00 +0000
91+++ files/charm/nginx.conf 2013-09-29 22:20:07 +0000
92@@ -0,0 +1,35 @@
93+server {
94+ listen *:80 ;
95+
96+ server_name kibana;
97+ access_log /var/log/nginx/kibana.access.log;
98+
99+ location / {
100+ root /usr/share/kibana3;
101+ index index.html index.htm;
102+ }
103+
104+ location ~ ^/_aliases$ {
105+ proxy_pass http://es_cluster;
106+ proxy_read_timeout 90;
107+ }
108+ location ~ ^/.*/_search$ {
109+ proxy_pass http://es_cluster;
110+ proxy_read_timeout 90;
111+ }
112+ location ~ ^/.*/_mapping$ {
113+ proxy_pass http://es_cluster;
114+ proxy_read_timeout 90;
115+ }
116+
117+ location ~ ^/kibana-int/dashboard/.*$ {
118+ proxy_pass http://es_cluster;
119+ proxy_read_timeout 90;
120+ }
121+ location ~ ^/kibana-int/temp.*$ {
122+ proxy_pass http://es_cluster;
123+ proxy_read_timeout 90;
124+ }
125+}
126+
127+
128
129=== added file 'files/charm/nginx_lb.conf'
130--- files/charm/nginx_lb.conf 1970-01-01 00:00:00 +0000
131+++ files/charm/nginx_lb.conf 2013-09-29 22:20:07 +0000
132@@ -0,0 +1,3 @@
133+upstream es_cluster {
134+ server localhost:9200;
135+}
136\ No newline at end of file
137
138=== modified file 'hooks/install'
139--- hooks/install 2012-11-22 16:43:50 +0000
140+++ hooks/install 2013-09-29 22:20:07 +0000
141@@ -4,50 +4,33 @@
142 # Make sure this hook exits cleanly and is idempotent, common problems here are failing to account for a debconf question on a dependency, or trying to pull from github without installing git first.
143 set -eux # -x for verbose logging to juju debug-log
144 HOME=$PWD
145-CHECKSUM="fc290faf6967edad9f65b5182a2905c1"
146+CHECKSUM="8614d80e8afdb9d936e8574b24e9b405"
147 HOST=`unit-get private-address`
148
149 juju-log "install dependency"
150-apt-get install -y ruby curl wget rubygems rinetd
151-service rinetd stop
152-
153-juju-log "download and/or copy kibana tarball"
154-if [ -f "files/charm/kibana-ruby.tar.gz" ]
155- then
156- juju-log "kibana binary found local,copy to /tmp"
157- install -o root -g root -m 0644 files/charm/kibana-ruby.tar.gz /tmp/kibana-ruby.tar.gz
158- else
159- # Download and checksum
160- juju-log "kibana binary not found local ... download"
161- wget -q -O /tmp/kibana-ruby.tar.gz "https://github.com/rashidkpc/Kibana/tarball/kibana-ruby"
162- uncomment if you want to checksum
163- #if [[ $(md5sum "/tmp/kibana-ruby.tar.gz " | cut -d " " -f 1) != ${CHECKSUM} ]]; then
164- # juju-log --log-level CRITICAL "/tmp/kibana-ruby.tar.gz failed MD5 checksum"
165- # exit 1
166- #fi
167- fi
168-
169-juju-log "extract kibana tarball and moveto /opt/kibana"
170-mkdir -p /opt/kibana
171-cd /opt/kibana
172-tar xzvf /tmp/kibana-ruby.tar.gz --strip=1 --show-transformed-names
173-juju-log "install kibana required gems"
174-sed -i "s|http://rubygems.org|https://rubygems.org|" /opt/kibana/Gemfile
175-gem install bundler
176-bundle install
177-sed -i "s|KibanaHost =.*|KibanaHost = \"127.0.0.1\"|" /opt/kibana/KibanaConfig.rb
178-cd $HOME
179-juju-log "create kibana user"
180-useradd kibana
181-chown -R kibana. /opt/kibana
182-
183-juju-log "Install upstart init script"
184-install -o root -g root -m 0644 files/charm/kibana-service.conf /etc/init/kibana.conf
185-
186-# I want kibana to answer on port 80 ... using rinetd... so I don't need to run as root.
187-# Maybe I'll set up an apache reverse proxy to enable https at some point.
188-juju-log "configure rinetd to push ${HOST}:80 traffic to localhost:5601"
189-echo "${HOST} 80 127.0.0.1 5601" >> /etc/rinetd.conf
190-
191-
192-
193+apt-get install -y curl wget git nginx
194+
195+juju-log "download kibana from elasticsearch.org"
196+wget -q -O /tmp/kibana-latest.tgz https://download.elasticsearch.org/kibana/kibana/kibana-latest.tar.gz
197+
198+install -o root -g root -m 0644 files/charm/nginx.conf /etc/nginx/sites-available/kibana
199+install -o root -g root -m 0644 files/charm/nginx_lb.conf /etc/nginx/sites-available/es_cluster
200+
201+pushd /usr/share
202+
203+tar xzvf /tmp/kibana-latest.tgz
204+
205+mv kibana-latest kibana3
206+
207+rm -f /etc/nginx/sites-enabled/default
208+
209+popd
210+
211+rm -f /usr/share/kibana3/config.js
212+install -o root -g root -m 0644 files/charm/config.js /usr/share/kibana3/config.js
213+
214+
215+ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana
216+ln -s /etc/nginx/sites-available/es_cluster /etc/nginx/sites-enabled/es_cluster
217+
218+service nginx restart
219
220=== modified file 'hooks/rest-relation-changed'
221--- hooks/rest-relation-changed 2012-11-18 22:29:29 +0000
222+++ hooks/rest-relation-changed 2013-09-29 22:20:07 +0000
223@@ -12,21 +12,19 @@
224 juju-log Relation members:
225 relation-list
226
227+echo "upstream es_cluster {" > /etc/nginx/sites-available/es_cluster
228+
229 CLUSTER_NAME=`relation-get cluster-name`
230 ES_HOST_LIST="none"
231 for MEMBER in `relation-list`
232 do
233 ES_HOST=`relation-get private-address ${MEMBER}`
234- if [ ${ES_HOST_LIST} = "none" ]; then
235- ES_HOST_LIST="'${ES_HOST}:9200'"
236- else
237- ES_HOST_LIST=${ES_HOST_LIST},"'${ES_HOST}:9200'"
238- fi
239+ echo " server ${ES_HOST}:9200;" >> /etc/nginx/sites-available/es_cluster
240 done
241
242-juju-log "joined elasticsearch : ${CLUSTER_NAME} - hosts ${ES_HOST_LIST}"
243-# host setting should ensure this works even when multicast discovery is broken
244-
245-sed -i "s|Elasticsearch =.*|Elasticsearch = [ ${ES_HOST_LIST} ]|" /opt/kibana/KibanaConfig.rb
246-initctl restart kibana
247-service rinetd restart
248\ No newline at end of file
249+echo "}" >> /etc/nginx/sites-available/es_cluster
250+
251+juju-log "modified list of ES hosts kibana can talk to :-"
252+cat /etc/nginx/sites-available/es_cluster
253+
254+service nginx restart
255
256=== modified file 'hooks/rest-relation-joined'
257--- hooks/rest-relation-joined 2012-11-22 16:43:50 +0000
258+++ hooks/rest-relation-joined 2013-09-29 22:20:07 +0000
259@@ -3,5 +3,4 @@
260 # affect any change needed by relationships being formed
261 # This script should be idempotent.
262 set -eux # -x for verbose logging to juju debug-log
263-juju-log $JUJU_REMOTE_UNIT joined
264-
265+juju-log $JUJU_REMOTE_UNIT joined
266\ No newline at end of file
267
268=== modified file 'hooks/start'
269--- hooks/start 2012-11-11 18:31:31 +0000
270+++ hooks/start 2013-09-29 22:20:07 +0000
271@@ -3,8 +3,6 @@
272 # Note that currently this is run directly after install
273 # i.e. 'service apache2 start'
274
275-initctl start kibana
276+initctl start nginx
277 #open-port 5601/tcp
278-sleep 10s
279-service rinetd start
280 open-port 80/tcp
281
282=== modified file 'hooks/stop'
283--- hooks/stop 2012-11-11 18:31:31 +0000
284+++ hooks/stop 2013-09-29 22:20:07 +0000
285@@ -6,7 +6,5 @@
286 # balancer to stop sending traffic.
287 # rm /srv/webroot/server-live.txt && sleep 30
288
289-initctl stop kibana
290-#close-port 5601/tcp
291-service rinetd stop
292+initctl stop nginx
293 close-port 80/tcp
294
295=== modified file 'metadata.yaml'
296--- metadata.yaml 2012-11-06 04:38:09 +0000
297+++ metadata.yaml 2013-09-29 22:20:07 +0000
298@@ -3,6 +3,8 @@
299 maintainer: Paul Czarkowski <paul@paulcz.net>
300 description: |
301 alternative (better) logstash frontend
302+categories:
303+ - applications
304 provides:
305 web:
306 interface: kibana
307
308=== modified file 'revision'
309--- revision 2012-11-06 04:38:09 +0000
310+++ revision 2013-09-29 22:20:07 +0000
311@@ -1,1 +1,1 @@
312-1
313+2

Subscribers

People subscribed via source and target branches

to all changes: