Merge lp:~mthaddon/charms/precise/kibana/download-source into lp:charms/kibana

Proposed by Tom Haddon on 2013-11-26
Status: Merged
Merged at revision: 7
Proposed branch: lp:~mthaddon/charms/precise/kibana/download-source
Merge into: lp:charms/kibana
Diff against target: 137 lines (+32/-32)
7 files modified
config.yaml (+13/-0)
files/charm/nginx.conf (+1/-1)
hooks/install (+14/-14)
hooks/rest-relation-changed (+1/-4)
hooks/rest-relation-departed (+0/-3)
hooks/rest-relation-joined (+1/-5)
hooks/web-relation-joined (+2/-5)
To merge this branch: bzr merge lp:~mthaddon/charms/precise/kibana/download-source
Reviewer Review Type Date Requested Status
Jacek Nykis (community) 2013-11-26 Approve on 2013-11-27
Review via email: mp+196705@code.launchpad.net

Description of the change

Allow us to specify the download source, actually confirm the checksum matches the downloaded source, and remove some spurious comments from hooks. Use /srv for kibana - /usr/share is for architecture-independent (shared) data per FHS.

I've done a test deploy of this charm with the some of the new config options set to confirm it works as expected.

To post a comment you must log in.
Jacek Nykis (jacekn) wrote :

Everything looks fine to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'config.yaml'
2--- config.yaml 1970-01-01 00:00:00 +0000
3+++ config.yaml 2013-11-26 12:56:39 +0000
4@@ -0,0 +1,13 @@
5+options:
6+ kibana_source:
7+ type: string
8+ default: 'https://download.elasticsearch.org/kibana/kibana/kibana-3.0.0milestone4.tar.gz'
9+ description: URL to download the source for kibana
10+ kibana_source_unpack_directory:
11+ type: string
12+ default: 'kibana-3.0.0milestone4'
13+ description: the name of the directory the tar.gz will unpack to
14+ kibana_source_checksum:
15+ type: string
16+ default: '3ee5416c8a61fa95ba9280631a66997e'
17+ description: the md5sum of the kibana_source
18
19=== modified file 'files/charm/nginx.conf'
20--- files/charm/nginx.conf 2013-09-29 21:58:50 +0000
21+++ files/charm/nginx.conf 2013-11-26 12:56:39 +0000
22@@ -5,7 +5,7 @@
23 access_log /var/log/nginx/kibana.access.log;
24
25 location / {
26- root /usr/share/kibana3;
27+ root /srv/kibana3;
28 index index.html index.htm;
29 }
30
31
32=== modified file 'hooks/install'
33--- hooks/install 2013-09-29 21:58:50 +0000
34+++ hooks/install 2013-11-26 12:56:39 +0000
35@@ -1,33 +1,33 @@
36 #!/bin/bash
37-# Here do anything needed to install the service
38-# i.e. apt-get install -y foo or bzr branch http://myserver/mycode /srv/webroot
39-# 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.
40-set -eux # -x for verbose logging to juju debug-log
41+set -eux
42 HOME=$PWD
43-CHECKSUM="8614d80e8afdb9d936e8574b24e9b405"
44-HOST=`unit-get private-address`
45+KIBANA_SOURCE=$(config-get kibana_source)
46+KIBANA_SOURCE_UNPACK_DIRECTORY=$(config-get kibana_source_unpack_directory)
47+KIBANA_SOURCE_CHECKSUM=$(config-get kibana_source_checksum)
48+HOST=$(unit-get private-address)
49
50 juju-log "install dependency"
51 apt-get install -y curl wget git nginx
52
53 juju-log "download kibana from elasticsearch.org"
54-wget -q -O /tmp/kibana-latest.tgz https://download.elasticsearch.org/kibana/kibana/kibana-latest.tar.gz
55+wget -q -O /tmp/kibana.tgz ${KIBANA_SOURCE}
56+echo "${KIBANA_SOURCE_CHECKSUM} /tmp/kibana.tgz" > /tmp/kibana.tgz.md5
57+md5sum -c /tmp/kibana.tgz.md5
58
59 install -o root -g root -m 0644 files/charm/nginx.conf /etc/nginx/sites-available/kibana
60 install -o root -g root -m 0644 files/charm/nginx_lb.conf /etc/nginx/sites-available/es_cluster
61
62-pushd /usr/share
63-
64-tar xzvf /tmp/kibana-latest.tgz
65-
66-mv kibana-latest kibana3
67+pushd /srv
68+
69+tar xzvf /tmp/kibana.tgz
70+mv ${KIBANA_SOURCE_UNPACK_DIRECTORY} kibana3
71
72 rm -f /etc/nginx/sites-enabled/default
73
74 popd
75
76-rm -f /usr/share/kibana3/config.js
77-install -o root -g root -m 0644 files/charm/config.js /usr/share/kibana3/config.js
78+rm -f /srv/kibana3/config.js
79+install -o root -g root -m 0644 files/charm/config.js /srv/kibana3/config.js
80
81
82 ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana
83
84=== modified file 'hooks/rest-relation-changed'
85--- hooks/rest-relation-changed 2013-09-29 21:58:50 +0000
86+++ hooks/rest-relation-changed 2013-11-26 12:56:39 +0000
87@@ -1,8 +1,5 @@
88 #!/bin/bash
89-# This must be renamed to the name of the relation. The goal here is to
90-# affect any change needed by relationships being formed, modified, or broken
91-# This script should be idempotent.
92-set -eux # -x for verbose logging to juju debug-log
93+set -eux
94 [ -z "$(relation-get cluster-name)" ] && exit 0
95
96 juju-log $JUJU_REMOTE_UNIT modified its settings
97
98=== modified file 'hooks/rest-relation-departed'
99--- hooks/rest-relation-departed 2012-11-06 04:38:09 +0000
100+++ hooks/rest-relation-departed 2013-11-26 12:56:39 +0000
101@@ -1,5 +1,2 @@
102 #!/bin/sh
103-# This must be renamed to the name of the relation. The goal here is to
104-# affect any change needed by the remote unit leaving the relationship.
105-# This script should be idempotent.
106 juju-log $JUJU_REMOTE_UNIT departed
107
108=== modified file 'hooks/rest-relation-joined'
109--- hooks/rest-relation-joined 2013-09-29 21:58:50 +0000
110+++ hooks/rest-relation-joined 2013-11-26 12:56:39 +0000
111@@ -1,6 +1,2 @@
112 #!/bin/bash
113-# This must be renamed to the name of the relation. The goal here is to
114-# affect any change needed by relationships being formed
115-# This script should be idempotent.
116-set -eux # -x for verbose logging to juju debug-log
117-juju-log $JUJU_REMOTE_UNIT joined
118\ No newline at end of file
119+juju-log $JUJU_REMOTE_UNIT joined
120
121=== modified file 'hooks/web-relation-joined'
122--- hooks/web-relation-joined 2012-11-22 16:43:50 +0000
123+++ hooks/web-relation-joined 2013-11-26 12:56:39 +0000
124@@ -1,10 +1,7 @@
125 #!/bin/bash
126-# This must be renamed to the name of the relation. The goal here is to
127-# affect any change needed by relationships being formed
128-# This script should be idempotent.
129-set -eux # -x for verbose logging to juju debug-log
130+set -eux
131 juju-log $JUJU_REMOTE_UNIT joined
132
133 # Set ip/port for web relation
134 relation-set port="80"
135-relation-set host=`unit-get private-address`
136\ No newline at end of file
137+relation-set host=`unit-get private-address`

Subscribers

People subscribed via source and target branches

to all changes: