Merge lp:~michael.nelson/charms/trusty/kibana/kibana4 into lp:~canonical-is-sa/charms/trusty/kibana/kibana4

Proposed by Michael Nelson
Status: Merged
Merged at revision: 21
Proposed branch: lp:~michael.nelson/charms/trusty/kibana/kibana4
Merge into: lp:~canonical-is-sa/charms/trusty/kibana/kibana4
Diff against target: 456 lines (+159/-135)
14 files modified
README.md (+2/-2)
config.yaml (+2/-10)
files/charm/config.js (+0/-75)
files/charm/config.yml (+79/-0)
files/charm/kibana.init (+32/-0)
files/charm/kibana_lb.conf (+15/-0)
files/charm/nginx.conf (+3/-33)
files/charm/nginx_lb.conf (+1/-1)
hooks/config-changed (+1/-2)
hooks/install (+15/-11)
hooks/start (+1/-0)
hooks/stop (+1/-0)
tests/11-scale-elastic.py (+1/-1)
tests/12-port-change.py (+6/-0)
To merge this branch: bzr merge lp:~michael.nelson/charms/trusty/kibana/kibana4
Reviewer Review Type Date Requested Status
Tim Kuhlman (community) Approve
Review via email: mp+276604@code.launchpad.net

Commit message

Required changes for Kibana 4

Description of the change

This branch merges a community branch [1] (not landed upstream) to support kibana4, and then makes a few changes.

I'll comment inline below on the significant changes.

[1] https://code.launchpad.net/~chris.macnaughton/charms/trusty/kibana/version_bump/+merge/274029

To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :

Including inline comments.

Revision history for this message
Tim Kuhlman (timkuhlman) wrote :

lgtm, will merge.
Adding the comments was great, thanks.

review: Approve

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 2015-03-31 16:03:49 +0000
3+++ README.md 2015-11-03 23:41:21 +0000
4@@ -19,7 +19,7 @@
5 juju deploy logstash-indexer
6 juju add-relation logstash-indexer elasticsearch:cluster
7 juju deploy kibana
8- juju add-relation kibana elasticsearch:rest
9+ juju add-relation kibana elasticsearch
10 juju expose kibana
11
12 browse to http://ip-address to begin searching.
13@@ -31,7 +31,7 @@
14 configured values in 'kibana_source' and 'kibana_source_checksum', which
15 default to::
16
17- https://download.elasticsearch.org/kibana/kibana/kibana-3.1.1.tar.gz
18+ https://download.elastic.co/kibana/kibana/kibana-4.2.0-linux-x64.tar.gz
19
20 It will, obviously, require internet access on deployed nodes.
21
22
23=== modified file 'config.yaml'
24--- config.yaml 2015-10-28 04:08:59 +0000
25+++ config.yaml 2015-11-03 23:41:21 +0000
26@@ -1,15 +1,11 @@
27 options:
28 kibana_source:
29 type: string
30- default: 'https://download.elasticsearch.org/kibana/kibana/kibana-3.1.1.tar.gz'
31+ default: 'https://download.elastic.co/kibana/kibana/kibana-4.2.0-linux-x64.tar.gz'
32 description: URL to download the source for kibana
33- kibana_source_unpack_directory:
34- type: string
35- default: 'kibana-3.1.1'
36- description: the name of the directory the tar.gz will unpack to
37 kibana_source_checksum:
38 type: string
39- default: '74c6b8b79d1bfc7e4d5376e3c9ecb0fa1e79c986'
40+ default: '094e197c687012211ae0e291faf3111d47e714d9'
41 description: the sha1sum of the kibana_source
42 port:
43 type: int
44@@ -20,7 +16,3 @@
45 default: ''
46 description: 'The url path of kibana. This is required if kibana is
47 proxied at a non root path. e.g. http://example.com/kibana/'
48- elasticsearch_url:
49- type: string
50- default: '"http://"+window.location.hostname'
51- description: URL to for elasticsearch line in config.sh, defaults to '"http://"+window.location.hostname'
52
53=== removed file 'files/charm/config.js'
54--- files/charm/config.js 2015-03-26 03:45:25 +0000
55+++ files/charm/config.js 1970-01-01 00:00:00 +0000
56@@ -1,75 +0,0 @@
57-/** @scratch /configuration/config.js/1
58- *
59- * == Configuration
60- * config.js is where you will find the core Kibana configuration. This file contains parameter that
61- * must be set before kibana is run for the first time.
62- */
63-define(['settings'],
64-function (Settings) {
65-
66-
67- /** @scratch /configuration/config.js/2
68- *
69- * === Parameters
70- */
71- return new Settings({
72-
73- /** @scratch /configuration/config.js/5
74- *
75- * ==== elasticsearch
76- *
77- * The URL to your elasticsearch server. You almost certainly don't
78- * want +http://localhost:9200+ here. Even if Kibana and Elasticsearch are on
79- * the same host. By default this will attempt to reach ES at the same host you have
80- * kibana installed on. You probably want to set it to the FQDN of your
81- * elasticsearch host
82- */
83- elasticsearch: "http://"+window.location.hostname,
84-
85- /** @scratch /configuration/config.js/5
86- *
87- * ==== default_route
88- *
89- * This is the default landing page when you don't specify a dashboard to load. You can specify
90- * files, scripts or saved dashboards here. For example, if you had saved a dashboard called
91- * `WebLogs' to elasticsearch you might use:
92- *
93- * default_route: '/dashboard/elasticsearch/WebLogs',
94- */
95- default_route : '/dashboard/file/default.json',
96-
97- /** @scratch /configuration/config.js/5
98- *
99- * ==== kibana-int
100- *
101- * The default ES index to use for storing Kibana specific object
102- * such as stored dashboards
103- */
104- kibana_index: "kibana-int",
105-
106- /** @scratch /configuration/config.js/5
107- *
108- * ==== panel_name
109- *
110- * An array of panel modules available. Panels will only be loaded when they are defined in the
111- * dashboard, but this list is used in the "add panel" interface.
112- */
113- panel_names: [
114- 'histogram',
115- 'map',
116- 'goal',
117- 'table',
118- 'filtering',
119- 'timepicker',
120- 'text',
121- 'hits',
122- 'column',
123- 'trends',
124- 'bettermap',
125- 'query',
126- 'terms',
127- 'stats',
128- 'sparklines'
129- ]
130- });
131-});
132
133=== added file 'files/charm/config.yml'
134--- files/charm/config.yml 1970-01-01 00:00:00 +0000
135+++ files/charm/config.yml 2015-11-03 23:41:21 +0000
136@@ -0,0 +1,79 @@
137+# Kibana is served by a back end server. This controls which port to use.
138+port: 5601
139+
140+# The host to bind the server to.
141+host: "0.0.0.0"
142+
143+# The Elasticsearch instance to use for all your queries.
144+# This is proxied via /etc/nginx/sites-enabled/kibana_load_balancer
145+elasticsearch_url: http://localhost:9200
146+
147+# preserve_elasticsearch_host true will send the hostname specified in `elasticsearch`. If you set it to false,
148+# then the host you use to connect to *this* Kibana instance will be sent.
149+elasticsearch_preserve_host: true
150+
151+# Kibana uses an index in Elasticsearch to store saved searches, visualizations
152+# and dashboards. It will create a new index if it doesn't already exist.
153+kibana_index: ".kibana"
154+
155+# If your Elasticsearch is protected with basic auth, this is the user credentials
156+# used by the Kibana server to perform maintence on the kibana_index at statup. Your Kibana
157+# users will still need to authenticate with Elasticsearch (which is proxied thorugh
158+# the Kibana server)
159+# kibana_elasticsearch_username: user
160+# kibana_elasticsearch_password: pass
161+
162+# If your Elasticsearch requires client certificate and key
163+# kibana_elasticsearch_client_crt: /path/to/your/client.crt
164+# kibana_elasticsearch_client_key: /path/to/your/client.key
165+
166+# If you need to provide a CA certificate for your Elasticsarech instance, put
167+# the path of the pem file here.
168+# ca: /path/to/your/CA.pem
169+
170+# The default application to load.
171+default_app_id: "discover"
172+
173+# Time in milliseconds to wait for elasticsearch to respond to pings, defaults to
174+# request_timeout setting
175+# ping_timeout: 1500
176+
177+# Time in milliseconds to wait for responses from the back end or elasticsearch.
178+# This must be > 0
179+request_timeout: 300000
180+
181+# Time in milliseconds for Elasticsearch to wait for responses from shards.
182+# Set to 0 to disable.
183+shard_timeout: 0
184+
185+# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
186+# startup_timeout: 5000
187+
188+# Set to false to have a complete disregard for the validity of the SSL
189+# certificate.
190+verify_ssl: true
191+
192+# SSL for outgoing requests from the Kibana Server (PEM formatted)
193+# ssl_key_file: /path/to/your/server.key
194+# ssl_cert_file: /path/to/your/server.crt
195+
196+# Set the path to where you would like the process id file to be created.
197+# pid_file: /var/run/kibana.pid
198+
199+# If you would like to send the log output to a file you can set the path below.
200+# This will also turn off the STDOUT log output.
201+# log_file: ./kibana.log
202+
203+# Plugins that are included in the build, and no longer found in the plugins/ folder
204+bundled_plugin_ids:
205+ - plugins/dashboard/index
206+ - plugins/discover/index
207+ - plugins/doc/index
208+ - plugins/kibana/index
209+ - plugins/markdown_vis/index
210+ - plugins/metric_vis/index
211+ - plugins/settings/index
212+ - plugins/table_vis/index
213+ - plugins/vis_types/index
214+ - plugins/visualize/index
215+
216
217=== added file 'files/charm/kibana.init'
218--- files/charm/kibana.init 1970-01-01 00:00:00 +0000
219+++ files/charm/kibana.init 2015-11-03 23:41:21 +0000
220@@ -0,0 +1,32 @@
221+# Kibana 4
222+#
223+description "Kibana 4"
224+
225+start on virtual-filesystems
226+stop on runlevel [06]
227+
228+# Respawn it if the process exits
229+respawn
230+
231+# We're setting high here, we'll re-limit below.
232+limit nofile 65550 65550
233+
234+setuid kibana
235+setgid kibana
236+
237+console log
238+script
239+ # Defaults - Please set KB_HOME
240+ PATH=/bin:/usr/bin:$PATH
241+ KB_HOME=/srv/kibana4
242+ KB_LOG_FILE=/var/log/kibana/kibana.log
243+ KB_NICE=19
244+
245+ HOME="${HOME:-$KB_HOME}"
246+
247+ # Export variables
248+ export PATH HOME
249+ test -n "${JAVACMD}" && export JAVACMD
250+
251+ exec nice -n ${KB_NICE} ${KB_HOME}/bin/kibana --config /etc/kibana/config.yml --log-file ${KB_LOG_FILE}
252+end script
253
254=== added file 'files/charm/kibana_lb.conf'
255--- files/charm/kibana_lb.conf 1970-01-01 00:00:00 +0000
256+++ files/charm/kibana_lb.conf 2015-11-03 23:41:21 +0000
257@@ -0,0 +1,15 @@
258+upstream kibana {
259+ server localhost:5601;
260+}
261+
262+server {
263+ listen *:9200;
264+
265+ location / {
266+ # Only proxy local requests for ES.
267+ allow 127.0.0.1;
268+ deny all;
269+ proxy_pass http://es_cluster;
270+ proxy_read_timeout 90;
271+ }
272+}
273
274=== modified file 'files/charm/nginx.conf'
275--- files/charm/nginx.conf 2014-04-14 15:59:48 +0000
276+++ files/charm/nginx.conf 2015-11-03 23:41:21 +0000
277@@ -5,39 +5,9 @@
278 access_log /var/log/nginx/kibana.access.log;
279
280 location / {
281- root /srv/kibana3;
282- index index.html index.htm;
283- }
284-
285- location ~ ^/_aliases$ {
286- proxy_pass http://es_cluster;
287- proxy_read_timeout 90;
288- }
289- location ~ ^/.*/_aliases$ {
290- proxy_pass http://es_cluster;
291- proxy_read_timeout 90;
292- }
293- location ~ ^/_nodes$ {
294- proxy_pass http://es_cluster;
295- proxy_read_timeout 90;
296- }
297- location ~ ^/.*/_search$ {
298- proxy_pass http://es_cluster;
299- proxy_read_timeout 90;
300- }
301- location ~ ^/.*/_mapping$ {
302- proxy_pass http://es_cluster;
303- proxy_read_timeout 90;
304- }
305-
306- location ~ ^/kibana-int/dashboard/.*$ {
307- proxy_pass http://es_cluster;
308- proxy_read_timeout 90;
309- }
310- location ~ ^/kibana-int/temp.*$ {
311- proxy_pass http://es_cluster;
312- proxy_read_timeout 90;
313- }
314+ proxy_pass http://kibana;
315+ proxy_read_timeout 90;
316+ }
317 }
318
319
320
321=== modified file 'files/charm/nginx_lb.conf'
322--- files/charm/nginx_lb.conf 2013-09-29 21:58:50 +0000
323+++ files/charm/nginx_lb.conf 2015-11-03 23:41:21 +0000
324@@ -1,3 +1,3 @@
325 upstream es_cluster {
326 server localhost:9200;
327-}
328\ No newline at end of file
329+}
330
331=== modified file 'hooks/config-changed'
332--- hooks/config-changed 2015-10-28 04:09:57 +0000
333+++ hooks/config-changed 2015-11-03 23:41:21 +0000
334@@ -6,9 +6,8 @@
335
336 sed -i "s/listen.*/listen *:$PORT;/" /etc/nginx/sites-available/kibana
337
338-sed -i "s@elasticsearch: .*@elasticsearch: '//'+window.location.hostname+'$KIBANA_PATH',@" /srv/kibana3/config.js
339-
340 service nginx reload
341+service kibana restart
342
343 [[ -r .PREVOPENPORT ]] && PREVOPENPORT=$(cat .PREVOPENPORT) || PREVOPENPORT=''
344 [[ -z "$PREVOPENPORT" ]] || close-port $PREVOPENPORT/tcp
345
346=== modified file 'hooks/install'
347--- hooks/install 2015-10-28 04:08:59 +0000
348+++ hooks/install 2015-11-03 23:41:21 +0000
349@@ -7,9 +7,7 @@
350 HOME=$PWD
351 KIBANA_TARBALL=files/kibana.tgz
352 KIBANA_SOURCE=$(config-get kibana_source)
353-KIBANA_SOURCE_UNPACK_DIRECTORY=$(config-get kibana_source_unpack_directory)
354 KIBANA_SOURCE_CHECKSUM=$(config-get kibana_source_checksum)
355-ELASTICSEARCH_URL=$(config-get elasticsearch_url)
356 HOST=$(unit-get private-address)
357
358 juju-log "install dependency"
359@@ -26,29 +24,35 @@
360 cp $KIBANA_TARBALL /tmp/kibana.tgz
361 fi
362
363+groupadd kibana
364+useradd -s /bin/false -g kibana kibana
365+mkdir -p /var/log/kibana
366+chown kibana:kibana /var/log/kibana
367+
368 install -o root -g root -m 0644 files/charm/nginx.conf /etc/nginx/sites-available/kibana
369 install -o root -g root -m 0644 files/charm/nginx_lb.conf /etc/nginx/sites-available/es_cluster
370-
371+install -o root -g root -m 0644 files/charm/kibana_lb.conf /etc/nginx/sites-available/kibana_load_balancer
372+install -o root -g root -m 0644 files/charm/kibana.init /etc/init/kibana.conf
373+mkdir -p /etc/kibana/
374+install -o root -g root -m 0644 files/charm/config.yml /etc/kibana/kibana.conf
375 pushd /srv
376
377-if [[ ! -d kibana3 ]]; then
378+if [[ ! -d kibana4 ]]; then
379 tar xzvf /tmp/kibana.tgz
380- mv ${KIBANA_SOURCE_UNPACK_DIRECTORY} kibana3
381+ # Note: charm does not currently support changing kibana source.
382+ mv kibana-4.* kibana4
383+ chown -R kibana:kibana kibana4
384 fi
385
386 rm -f /etc/nginx/sites-enabled/default
387
388 popd
389
390-rm -f /srv/kibana3/config.js
391-install -o root -g root -m 0644 files/charm/config.js /srv/kibana3/config.js
392-
393-# edit the elasticsearch line to be the value of option elasticsearch_url
394-sed -r -i -e 's|(^\s*elasticsearch:\s*).*$|\1'"${ELASTICSEARCH_URL}"',|' /srv/kibana3/config.js
395-
396 hooks/config-changed
397
398 ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana
399 ln -s /etc/nginx/sites-available/es_cluster /etc/nginx/sites-enabled/es_cluster
400+ln -s /etc/nginx/sites-available/kibana_load_balancer /etc/nginx/sites-enabled/kibana_load_balancer
401
402 service nginx restart
403+service kibana restart
404
405=== modified file 'hooks/start'
406--- hooks/start 2015-10-28 04:09:57 +0000
407+++ hooks/start 2015-11-03 23:41:21 +0000
408@@ -4,3 +4,4 @@
409 # i.e. 'service apache2 start'
410
411 service nginx start
412+service kibana restart
413\ No newline at end of file
414
415=== modified file 'hooks/stop'
416--- hooks/stop 2015-06-18 20:10:31 +0000
417+++ hooks/stop 2015-11-03 23:41:21 +0000
418@@ -7,5 +7,6 @@
419 # rm /srv/webroot/server-live.txt && sleep 30
420
421 service nginx stop
422+service kibana stop
423 [[ -r .PREVOPENPORT ]] && PREVOPENPORT=$(cat .PREVOPENPORT) || PREVOPENPORT=''
424 [[ -z "$PREVOPENPORT" ]] || close-port $PREVOPENPORT/tcp
425
426=== modified file 'tests/11-scale-elastic.py'
427--- tests/11-scale-elastic.py 2015-03-12 18:48:08 +0000
428+++ tests/11-scale-elastic.py 2015-11-03 23:41:21 +0000
429@@ -50,7 +50,7 @@
430
431 time.sleep(3)
432
433- url = 'http://%s/_all/_search' % kibana_unit.info['public-address']
434+ url = 'http://%s:9200/_all/_search' % kibana_unit.info['public-address']
435 test_dir = os.path.dirname(__file__)
436 test_data_file = os.path.join(test_dir, '11-scale-elastic-query.json')
437 with open(test_data_file) as fp:
438
439=== modified file 'tests/12-port-change.py'
440--- tests/12-port-change.py 2015-06-18 17:11:44 +0000
441+++ tests/12-port-change.py 2015-11-03 23:41:21 +0000
442@@ -8,8 +8,14 @@
443 d = amulet.Deployment(series='trusty')
444
445 d.add('kibana')
446+d.add('elasticsearch')
447+
448 d.configure('kibana', {'port': 81})
449
450+d.add_unit('elasticsearch', 2)
451+
452+d.relate('kibana:rest', 'elasticsearch:client')
453+
454 d.expose('kibana')
455
456 try:

Subscribers

People subscribed via source and target branches