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
=== modified file 'README.md'
--- README.md 2012-11-22 16:38:58 +0000
+++ README.md 2013-09-29 22:20:07 +0000
@@ -9,9 +9,12 @@
9----------------9----------------
1010
11 using this charm :11 using this charm :
12
12 juju deploy kibana13 juju deploy kibana
13 juju expose kibana14 juju expose kibana
15
14 not much use on its own ... you'll probably want the full stack16 not much use on its own ... you'll probably want the full stack
17
15 juju deploy elasticsearch18 juju deploy elasticsearch
16 juju deploy logstash-indexer19 juju deploy logstash-indexer
17 juju add-relation logstash-indexer elasticsearch:cluster20 juju add-relation logstash-indexer elasticsearch:cluster
@@ -19,7 +22,7 @@
19 juju add-relation kibana elasticsearch:rest22 juju add-relation kibana elasticsearch:rest
20 juju expose kibana23 juju expose kibana
2124
22 browse to http://ip-address to begin searching.25browse to http://ip-address to begin searching.
2326
24Configuration27Configuration
25-------------28-------------
2629
=== added file 'files/charm/config.js'
--- files/charm/config.js 1970-01-01 00:00:00 +0000
+++ files/charm/config.js 2013-09-29 22:20:07 +0000
@@ -0,0 +1,54 @@
1/**
2 * These is the app's configuration, If you need to configure
3 * the default dashboard, please see dashboards/default
4 */
5define(['settings'],
6function (Settings) {
7
8
9 return new Settings({
10
11 /**
12 * URL to your elasticsearch server. You almost certainly don't
13 * want 'http://localhost:9200' here. Even if Kibana and ES are on
14 * the same host
15 *
16 * By default this will attempt to reach ES at the same host you have
17 * elasticsearch installed on. You probably want to set it to the FQDN of your
18 * elasticsearch host
19 * @type {String}
20 */
21 elasticsearch: "http://"+window.location.hostname,
22
23 /**
24 * The default ES index to use for storing Kibana specific object
25 * such as stored dashboards
26 * @type {String}
27 */
28 kibana_index: "kibana-int",
29
30 /**
31 * Panel modules available. Panels will only be loaded when they are defined in the
32 * dashboard, but this list is used in the "add panel" interface.
33 * @type {Array}
34 */
35 panel_names: [
36 'histogram',
37 'map',
38 'pie',
39 'table',
40 'filtering',
41 'timepicker',
42 'text',
43 'fields',
44 'hits',
45 'dashcontrol',
46 'column',
47 'derivequeries',
48 'trends',
49 'bettermap',
50 'query',
51 'terms'
52 ]
53 });
54});
0\ No newline at end of file55\ No newline at end of file
156
=== removed file 'files/charm/kibana-ruby.tar.gz'
2Binary 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 differ57Binary 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
=== added file 'files/charm/nginx.conf'
--- files/charm/nginx.conf 1970-01-01 00:00:00 +0000
+++ files/charm/nginx.conf 2013-09-29 22:20:07 +0000
@@ -0,0 +1,35 @@
1server {
2 listen *:80 ;
3
4 server_name kibana;
5 access_log /var/log/nginx/kibana.access.log;
6
7 location / {
8 root /usr/share/kibana3;
9 index index.html index.htm;
10 }
11
12 location ~ ^/_aliases$ {
13 proxy_pass http://es_cluster;
14 proxy_read_timeout 90;
15 }
16 location ~ ^/.*/_search$ {
17 proxy_pass http://es_cluster;
18 proxy_read_timeout 90;
19 }
20 location ~ ^/.*/_mapping$ {
21 proxy_pass http://es_cluster;
22 proxy_read_timeout 90;
23 }
24
25 location ~ ^/kibana-int/dashboard/.*$ {
26 proxy_pass http://es_cluster;
27 proxy_read_timeout 90;
28 }
29 location ~ ^/kibana-int/temp.*$ {
30 proxy_pass http://es_cluster;
31 proxy_read_timeout 90;
32 }
33}
34
35
036
=== added file 'files/charm/nginx_lb.conf'
--- files/charm/nginx_lb.conf 1970-01-01 00:00:00 +0000
+++ files/charm/nginx_lb.conf 2013-09-29 22:20:07 +0000
@@ -0,0 +1,3 @@
1upstream es_cluster {
2 server localhost:9200;
3}
0\ No newline at end of file4\ No newline at end of file
15
=== modified file 'hooks/install'
--- hooks/install 2012-11-22 16:43:50 +0000
+++ hooks/install 2013-09-29 22:20:07 +0000
@@ -4,50 +4,33 @@
4# 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.4# 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.
5set -eux # -x for verbose logging to juju debug-log5set -eux # -x for verbose logging to juju debug-log
6HOME=$PWD6HOME=$PWD
7CHECKSUM="fc290faf6967edad9f65b5182a2905c1"7CHECKSUM="8614d80e8afdb9d936e8574b24e9b405"
8HOST=`unit-get private-address`8HOST=`unit-get private-address`
99
10juju-log "install dependency"10juju-log "install dependency"
11apt-get install -y ruby curl wget rubygems rinetd11apt-get install -y curl wget git nginx
12service rinetd stop12
1313juju-log "download kibana from elasticsearch.org"
14juju-log "download and/or copy kibana tarball"14wget -q -O /tmp/kibana-latest.tgz https://download.elasticsearch.org/kibana/kibana/kibana-latest.tar.gz
15if [ -f "files/charm/kibana-ruby.tar.gz" ]15
16 then16install -o root -g root -m 0644 files/charm/nginx.conf /etc/nginx/sites-available/kibana
17 juju-log "kibana binary found local,copy to /tmp"17install -o root -g root -m 0644 files/charm/nginx_lb.conf /etc/nginx/sites-available/es_cluster
18 install -o root -g root -m 0644 files/charm/kibana-ruby.tar.gz /tmp/kibana-ruby.tar.gz18
19 else19pushd /usr/share
20 # Download and checksum20
21 juju-log "kibana binary not found local ... download"21tar xzvf /tmp/kibana-latest.tgz
22 wget -q -O /tmp/kibana-ruby.tar.gz "https://github.com/rashidkpc/Kibana/tarball/kibana-ruby"22
23 uncomment if you want to checksum23mv kibana-latest kibana3
24 #if [[ $(md5sum "/tmp/kibana-ruby.tar.gz " | cut -d " " -f 1) != ${CHECKSUM} ]]; then24
25 # juju-log --log-level CRITICAL "/tmp/kibana-ruby.tar.gz failed MD5 checksum"25rm -f /etc/nginx/sites-enabled/default
26 # exit 126
27 #fi27popd
28 fi28
2929rm -f /usr/share/kibana3/config.js
30juju-log "extract kibana tarball and moveto /opt/kibana"30install -o root -g root -m 0644 files/charm/config.js /usr/share/kibana3/config.js
31mkdir -p /opt/kibana31
32cd /opt/kibana32
33tar xzvf /tmp/kibana-ruby.tar.gz --strip=1 --show-transformed-names33ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana
34juju-log "install kibana required gems"34ln -s /etc/nginx/sites-available/es_cluster /etc/nginx/sites-enabled/es_cluster
35sed -i "s|http://rubygems.org|https://rubygems.org|" /opt/kibana/Gemfile35
36gem install bundler36service nginx restart
37bundle install
38sed -i "s|KibanaHost =.*|KibanaHost = \"127.0.0.1\"|" /opt/kibana/KibanaConfig.rb
39cd $HOME
40juju-log "create kibana user"
41useradd kibana
42chown -R kibana. /opt/kibana
43
44juju-log "Install upstart init script"
45install -o root -g root -m 0644 files/charm/kibana-service.conf /etc/init/kibana.conf
46
47# I want kibana to answer on port 80 ... using rinetd... so I don't need to run as root.
48# Maybe I'll set up an apache reverse proxy to enable https at some point.
49juju-log "configure rinetd to push ${HOST}:80 traffic to localhost:5601"
50echo "${HOST} 80 127.0.0.1 5601" >> /etc/rinetd.conf
51
52
53
5437
=== modified file 'hooks/rest-relation-changed'
--- hooks/rest-relation-changed 2012-11-18 22:29:29 +0000
+++ hooks/rest-relation-changed 2013-09-29 22:20:07 +0000
@@ -12,21 +12,19 @@
12juju-log Relation members:12juju-log Relation members:
13relation-list13relation-list
1414
15echo "upstream es_cluster {" > /etc/nginx/sites-available/es_cluster
16
15CLUSTER_NAME=`relation-get cluster-name`17CLUSTER_NAME=`relation-get cluster-name`
16ES_HOST_LIST="none"18ES_HOST_LIST="none"
17for MEMBER in `relation-list`19for MEMBER in `relation-list`
18do20do
19 ES_HOST=`relation-get private-address ${MEMBER}`21 ES_HOST=`relation-get private-address ${MEMBER}`
20 if [ ${ES_HOST_LIST} = "none" ]; then22 echo " server ${ES_HOST}:9200;" >> /etc/nginx/sites-available/es_cluster
21 ES_HOST_LIST="'${ES_HOST}:9200'"
22 else
23 ES_HOST_LIST=${ES_HOST_LIST},"'${ES_HOST}:9200'"
24 fi
25done23done
2624
27juju-log "joined elasticsearch : ${CLUSTER_NAME} - hosts ${ES_HOST_LIST}"
28# host setting should ensure this works even when multicast discovery is broken
29
30sed -i "s|Elasticsearch =.*|Elasticsearch = [ ${ES_HOST_LIST} ]|" /opt/kibana/KibanaConfig.rb
31initctl restart kibana
32service rinetd restart
33\ No newline at end of file25\ No newline at end of file
26echo "}" >> /etc/nginx/sites-available/es_cluster
27
28juju-log "modified list of ES hosts kibana can talk to :-"
29cat /etc/nginx/sites-available/es_cluster
30
31service nginx restart
3432
=== modified file 'hooks/rest-relation-joined'
--- hooks/rest-relation-joined 2012-11-22 16:43:50 +0000
+++ hooks/rest-relation-joined 2013-09-29 22:20:07 +0000
@@ -3,5 +3,4 @@
3# affect any change needed by relationships being formed3# affect any change needed by relationships being formed
4# This script should be idempotent.4# This script should be idempotent.
5set -eux # -x for verbose logging to juju debug-log5set -eux # -x for verbose logging to juju debug-log
6juju-log $JUJU_REMOTE_UNIT joined6juju-log $JUJU_REMOTE_UNIT joined
7
8\ No newline at end of file7\ No newline at end of file
98
=== modified file 'hooks/start'
--- hooks/start 2012-11-11 18:31:31 +0000
+++ hooks/start 2013-09-29 22:20:07 +0000
@@ -3,8 +3,6 @@
3# Note that currently this is run directly after install3# Note that currently this is run directly after install
4# i.e. 'service apache2 start'4# i.e. 'service apache2 start'
55
6initctl start kibana6initctl start nginx
7#open-port 5601/tcp7#open-port 5601/tcp
8sleep 10s
9service rinetd start
10open-port 80/tcp8open-port 80/tcp
119
=== modified file 'hooks/stop'
--- hooks/stop 2012-11-11 18:31:31 +0000
+++ hooks/stop 2013-09-29 22:20:07 +0000
@@ -6,7 +6,5 @@
6# balancer to stop sending traffic.6# balancer to stop sending traffic.
7# rm /srv/webroot/server-live.txt && sleep 307# rm /srv/webroot/server-live.txt && sleep 30
88
9initctl stop kibana9initctl stop nginx
10#close-port 5601/tcp
11service rinetd stop
12close-port 80/tcp10close-port 80/tcp
1311
=== modified file 'metadata.yaml'
--- metadata.yaml 2012-11-06 04:38:09 +0000
+++ metadata.yaml 2013-09-29 22:20:07 +0000
@@ -3,6 +3,8 @@
3maintainer: Paul Czarkowski <paul@paulcz.net>3maintainer: Paul Czarkowski <paul@paulcz.net>
4description: |4description: |
5 alternative (better) logstash frontend5 alternative (better) logstash frontend
6categories:
7 - applications
6provides:8provides:
7 web:9 web:
8 interface: kibana10 interface: kibana
911
=== modified file 'revision'
--- revision 2012-11-06 04:38:09 +0000
+++ revision 2013-09-29 22:20:07 +0000
@@ -1,1 +1,1 @@
1112

Subscribers

People subscribed via source and target branches

to all changes: