~evarlast/charms/trusty/kibana/trunk

« back to all changes in this revision

Viewing changes to hooks/install

  • Committer: Tom Haddon
  • Date: 2013-11-27 10:56:57 UTC
  • mfrom: (6.1.4 kibana)
  • Revision ID: tom.haddon@canonical.com-20131127105657-5x9ua332p3i4rz4t
[mthaddon,r=jacekn] 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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
 
# Here do anything needed to install the service
3
 
# i.e. apt-get install -y foo  or  bzr branch http://myserver/mycode /srv/webroot
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.
5
 
set -eux # -x for verbose logging to juju debug-log
 
2
set -eux 
6
3
HOME=$PWD
7
 
CHECKSUM="8614d80e8afdb9d936e8574b24e9b405"
8
 
HOST=`unit-get private-address`
 
4
KIBANA_SOURCE=$(config-get kibana_source)
 
5
KIBANA_SOURCE_UNPACK_DIRECTORY=$(config-get kibana_source_unpack_directory)
 
6
KIBANA_SOURCE_CHECKSUM=$(config-get kibana_source_checksum)
 
7
HOST=$(unit-get private-address)
9
8
 
10
9
juju-log "install dependency"
11
10
apt-get install -y curl wget git nginx
12
11
 
13
12
juju-log "download kibana from elasticsearch.org"
14
 
wget -q -O /tmp/kibana-latest.tgz https://download.elasticsearch.org/kibana/kibana/kibana-latest.tar.gz
 
13
wget -q -O /tmp/kibana.tgz ${KIBANA_SOURCE}
 
14
echo "${KIBANA_SOURCE_CHECKSUM}  /tmp/kibana.tgz" > /tmp/kibana.tgz.md5
 
15
md5sum -c /tmp/kibana.tgz.md5
15
16
 
16
17
install -o root -g root -m 0644 files/charm/nginx.conf /etc/nginx/sites-available/kibana
17
18
install -o root -g root -m 0644 files/charm/nginx_lb.conf /etc/nginx/sites-available/es_cluster
18
19
 
19
 
pushd /usr/share
20
 
 
21
 
tar xzvf /tmp/kibana-latest.tgz
22
 
 
23
 
mv kibana-latest kibana3
 
20
pushd /srv
 
21
 
 
22
tar xzvf /tmp/kibana.tgz
 
23
mv ${KIBANA_SOURCE_UNPACK_DIRECTORY} kibana3
24
24
 
25
25
rm -f /etc/nginx/sites-enabled/default
26
26
 
27
27
popd
28
28
 
29
 
rm -f /usr/share/kibana3/config.js
30
 
install -o root -g root -m 0644 files/charm/config.js /usr/share/kibana3/config.js
 
29
rm -f /srv/kibana3/config.js
 
30
install -o root -g root -m 0644 files/charm/config.js /srv/kibana3/config.js
31
31
 
32
32
 
33
33
ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana