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

Proposed by Michael Nelson
Status: Merged
Merged at revision: 20
Proposed branch: lp:~michael.nelson/charms/trusty/kibana/trunk
Merge into: lp:~canonical-is-sa/charms/trusty/kibana/trunk
Diff against target: 164 lines (+74/-11)
8 files modified
config.yaml (+9/-1)
hooks/config-changed (+18/-0)
hooks/install (+7/-2)
hooks/start (+1/-3)
hooks/stop (+3/-2)
hooks/web-relation-joined (+3/-2)
metadata.yaml (+1/-1)
tests/12-port-change.py (+32/-0)
To merge this branch: bzr merge lp:~michael.nelson/charms/trusty/kibana/trunk
Reviewer Review Type Date Requested Status
Michael Foley (community) Approve
Review via email: mp+275947@code.launchpad.net

Commit message

Merge upstream (which now has web-relation-joined http relation).
Fixed conflicts.
Fixed charm proof errors.

Description of the change

This branch just re-merges the upstream lp:charms/trusty/kibana and resolves the conflicts (main one being that upstream still uses 'web' rather than 'website', even though it's changed the type to 'http').

Once this is merged, we should be able to ask for this MP to be merged upstream:

https://code.launchpad.net/~canonical-is-sa/charms/trusty/kibana/trunk/+merge/260026

so that the exec.d support and elasticsearch url support gets added upstream.

I'm just testing this now with a local deploy.

To post a comment you must log in.
Revision history for this message
Michael Foley (foli) wrote :

This looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2015-03-26 03:45:25 +0000
3+++ config.yaml 2015-10-28 04:20:49 +0000
4@@ -11,8 +11,16 @@
5 type: string
6 default: '74c6b8b79d1bfc7e4d5376e3c9ecb0fa1e79c986'
7 description: the sha1sum of the kibana_source
8+ port:
9+ type: int
10+ default: 80
11+ description: The tcp port on which nginx will listen.
12+ path:
13+ type: string
14+ default: ''
15+ description: 'The url path of kibana. This is required if kibana is
16+ proxied at a non root path. e.g. http://example.com/kibana/'
17 elasticsearch_url:
18 type: string
19 default: '"http://"+window.location.hostname'
20 description: URL to for elasticsearch line in config.sh, defaults to '"http://"+window.location.hostname'
21-
22
23=== added file 'hooks/config-changed'
24--- hooks/config-changed 1970-01-01 00:00:00 +0000
25+++ hooks/config-changed 2015-10-28 04:20:49 +0000
26@@ -0,0 +1,18 @@
27+#!/bin/bash
28+set -eux
29+
30+PORT=$(config-get port)
31+KIBANA_PATH=$(config-get path)
32+
33+sed -i "s/listen.*/listen *:$PORT;/" /etc/nginx/sites-available/kibana
34+
35+sed -i "s@elasticsearch: .*@elasticsearch: '//'+window.location.hostname+'$KIBANA_PATH',@" /srv/kibana3/config.js
36+
37+service nginx reload
38+
39+[[ -r .PREVOPENPORT ]] && PREVOPENPORT=$(cat .PREVOPENPORT) || PREVOPENPORT=''
40+[[ -z "$PREVOPENPORT" ]] || close-port $PREVOPENPORT/tcp
41+
42+open-port $PORT/tcp
43+echo $PORT > .PREVOPENPORT
44+
45
46=== modified file 'hooks/install'
47--- hooks/install 2015-04-21 00:28:13 +0000
48+++ hooks/install 2015-10-28 04:20:49 +0000
49@@ -31,8 +31,10 @@
50
51 pushd /srv
52
53-tar xzvf /tmp/kibana.tgz
54-mv ${KIBANA_SOURCE_UNPACK_DIRECTORY} kibana3
55+if [[ ! -d kibana3 ]]; then
56+ tar xzvf /tmp/kibana.tgz
57+ mv ${KIBANA_SOURCE_UNPACK_DIRECTORY} kibana3
58+fi
59
60 rm -f /etc/nginx/sites-enabled/default
61
62@@ -40,9 +42,12 @@
63
64 rm -f /srv/kibana3/config.js
65 install -o root -g root -m 0644 files/charm/config.js /srv/kibana3/config.js
66+
67 # edit the elasticsearch line to be the value of option elasticsearch_url
68 sed -r -i -e 's|(^\s*elasticsearch:\s*).*$|\1'"${ELASTICSEARCH_URL}"',|' /srv/kibana3/config.js
69
70+hooks/config-changed
71+
72 ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana
73 ln -s /etc/nginx/sites-available/es_cluster /etc/nginx/sites-enabled/es_cluster
74
75
76=== modified file 'hooks/start'
77--- hooks/start 2013-09-29 21:58:50 +0000
78+++ hooks/start 2015-10-28 04:20:49 +0000
79@@ -3,6 +3,4 @@
80 # Note that currently this is run directly after install
81 # i.e. 'service apache2 start'
82
83-initctl start nginx
84-#open-port 5601/tcp
85-open-port 80/tcp
86+service nginx start
87
88=== modified file 'hooks/stop'
89--- hooks/stop 2013-09-29 21:58:50 +0000
90+++ hooks/stop 2015-10-28 04:20:49 +0000
91@@ -6,5 +6,6 @@
92 # balancer to stop sending traffic.
93 # rm /srv/webroot/server-live.txt && sleep 30
94
95-initctl stop nginx
96-close-port 80/tcp
97+service nginx stop
98+[[ -r .PREVOPENPORT ]] && PREVOPENPORT=$(cat .PREVOPENPORT) || PREVOPENPORT=''
99+[[ -z "$PREVOPENPORT" ]] || close-port $PREVOPENPORT/tcp
100
101=== renamed file 'hooks/website-relation-joined' => 'hooks/web-relation-joined' (properties changed: -x to +x)
102--- hooks/website-relation-joined 2015-03-25 02:40:25 +0000
103+++ hooks/web-relation-joined 2015-10-28 04:20:49 +0000
104@@ -2,7 +2,8 @@
105 set -eux
106 juju-log $JUJU_REMOTE_UNIT joined
107
108+PORT=$(config-get port)
109+
110 # Set ip/port for web relation
111-relation-set port="80"
112+relation-set port="$PORT"
113 relation-set host=`unit-get private-address`
114-
115
116=== modified file 'metadata.yaml'
117--- metadata.yaml 2015-03-25 02:40:25 +0000
118+++ metadata.yaml 2015-10-28 04:20:49 +0000
119@@ -6,7 +6,7 @@
120 tags:
121 - applications
122 provides:
123- website:
124+ web:
125 interface: http
126 requires:
127 rest:
128
129=== added file 'tests/12-port-change.py'
130--- tests/12-port-change.py 1970-01-01 00:00:00 +0000
131+++ tests/12-port-change.py 2015-10-28 04:20:49 +0000
132@@ -0,0 +1,32 @@
133+#!/usr/bin/python3
134+
135+import amulet
136+import requests
137+
138+seconds = 20000
139+
140+d = amulet.Deployment(series='trusty')
141+
142+d.add('kibana')
143+d.configure('kibana', {'port': 81})
144+
145+d.expose('kibana')
146+
147+try:
148+ d.setup(timeout=seconds)
149+except amulet.helpers.TimeoutError:
150+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
151+except:
152+ raise
153+
154+
155+def test_web_interface():
156+ kibana_unit = d.sentry.unit['kibana/0']
157+ url = 'http://%s:81/' % kibana_unit.info['public-address']
158+ r = requests.get(url)
159+ if not r.ok:
160+ amulet.raise_status(amulet.FAIL,
161+ msg="Error getting kibana page.")
162+
163+
164+test_web_interface()

Subscribers

People subscribed via source and target branches