Merge lp:~thomnico/charms/precise/elasticsearch/canonical-se into lp:~charmers/charms/precise/elasticsearch/trunk

Proposed by Nicolas Thomas
Status: Work in progress
Proposed branch: lp:~thomnico/charms/precise/elasticsearch/canonical-se
Merge into: lp:~charmers/charms/precise/elasticsearch/trunk
Diff against target: 148 lines (+30/-57)
5 files modified
hooks/config-changed (+2/-2)
hooks/install (+24/-52)
hooks/start (+2/-1)
hooks/stop (+1/-1)
revision (+1/-1)
To merge this branch: bzr merge lp:~thomnico/charms/precise/elasticsearch/canonical-se
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Abstain
Whit Morriss (community) Disapprove
Review via email: mp+219110@code.launchpad.net

Description of the change

Updated to use the repo provided by elasticsearch hence upgraded,

Adapted to new CLI/service .. much cleaner IMHO.

To post a comment you must log in.
Revision history for this message
Cory Johns (johnsca) wrote :

Nicolas,

Thanks for your change submission. I do agree that this is much cleaner. However I see an issue with a user upgrading from revision 28 to this revision: since there is no upgrade-charm logic to handle the change in the location of the service, config, and possibly data files, a user attempting to upgrade this charm could end up in a state of conflict. Unfortunately, I can't give my +1 for this change unless an upgrade-charm hook is added to handle this.

Additionally, I believe there is an Ansible-based charm also being reviewed, which would be another route for cleaning up the elasticsearch charm. Please take a look at the discussion on https://bugs.launchpad.net/charms/+bug/822979 regarding the charm at https://code.launchpad.net/~michael.nelson/charms/precise/elasticsearch/trunk to see if you might prefer to use your efforts to help with that.

Revision history for this message
Nicolas Thomas (thomnico) wrote :

Writting an upgrade hook should be a breath using pakcages..

I'm more interrested to have a working logstash/elastcisearch/kibana
bundle than anything.

If moving to ansible count me out .. let me know if following that route.

On 09/06/2014 17:46, Cory Johns wrote:
> Nicolas,
>
> Thanks for your change submission. I do agree that this is much cleaner. However I see an issue with a user upgrading from revision 28 to this revision: since there is no upgrade-charm logic to handle the change in the location of the service, config, and possibly data files, a user attempting to upgrade this charm could end up in a state of conflict. Unfortunately, I can't give my +1 for this change unless an upgrade-charm hook is added to handle this.
>
> Additionally, I believe there is an Ansible-based charm also being reviewed, which would be another route for cleaning up the elasticsearch charm. Please take a look at the discussion on https://bugs.launchpad.net/charms/+bug/822979 regarding the charm at https://code.launchpad.net/~michael.nelson/charms/precise/elasticsearch/trunk to see if you might prefer to use your efforts to help with that.
>

--
Best Regards,
Nicolas Thomas Sales Engineer - Canonical
http://insights.ubuntu.com/?p=889
GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9

Revision history for this message
Whit Morriss (whitmo) wrote :

Nicolas,

The ansible based charm will eventually be the official trusty charm.

WRT to this patch: it looks generally looks good for precise. It does removes the ability to optionally use a cached a copy of the elasticsearch binary (desired for speed of deployment or where network access is limited), so we would need to add that feature back to merge.

review: Disapprove
Revision history for this message
Stuart Bishop (stub) wrote :

Removing this from the reviewers queue, as the charm appears to be going in an incompatible direction.

Yes, to be accepted into the charm store it would need update-charm logic to migrate existing installations (assuming there are any working existing installations...).

Please request a fresh review from 'charmers' if you feel this should still be reviewed and landed in the charm-store.

review: Abstain
Revision history for this message
Nicolas Thomas (thomnico) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I understood that Ansible is now the direction ... you can then cancel
this..

On 10/09/2014 23:52, José Antonio Rey wrote:
> The proposal to merge
> lp:~thomnico/charms/precise/elasticsearch/canonical-se into
> lp:charms/elasticsearch has been updated.
>
> Status: Needs review => Work in progress
>
> For more details, see:
> https://code.launchpad.net/~thomnico/charms/precise/elasticsearch/canonical-se/+merge/219110
>
>
- --
Best Regards,
Nicolas Thomas - Solution Architect - Canonical
http://insights.ubuntu.com/?p=889
GPG FPR: D592 4185 F099 9031 6590 6292 492F C740 F03A 7EB9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJUK/Z0AAoJEEkvx0DwOn65lmUIAK/wGv9kTgZzXRW07hxCmqFp
tUzXP4aMUpBVKeEiEGxs+EFiiqZVA/Zykz+/xRKWRAOPm1qgmhG6ndJqQosim7wz
Zs44fmWpvhDvJ+CcpPSXjoJXUW9Ir7kKczr3Hu6QvCa4fnbqqYe19NVbTv8ofhNI
YPqLJAufng0auxfRuXgIgWdVz+0DyCAIrkSpkS5zX0tlns/nMScL9ZT3vfCb3laW
Kni6d/Og8kD6m3s0gjLtpzjy5n33tSjVYqsR0GNojaTLX8mWtBR+Q6urD07yJS4j
rWtt3GetMZo+sNPnnjJ0ncyRhcsWRqeGZWAnRCJnJGlMuZfEKo8nNHF5qNDMh9k=
=FWz6
-----END PGP SIGNATURE-----

Unmerged revisions

29. By Nicolas Thomas

move to use the repositories provided by elasticsearch hence upgrade version.
Adapt to the correct filesystem.
TODO test the EC2 autodetect feature.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/config-changed'
2--- hooks/config-changed 2012-11-04 04:06:00 +0000
3+++ hooks/config-changed 2014-05-10 21:52:43 +0000
4@@ -6,6 +6,6 @@
5
6 if [[ ${ZENMASTERS} != "false" ]]; then
7 juju-log "Updating- discovery.zen.ping.unicast.hosts: \"${ZENMASTERS}\""
8- echo "discovery.zen.ping.unicast.hosts: \"${ZENMASTERS}\"" >> /opt/elasticsearch/config/elasticsearch.yml
9- /opt/elasticsearch/bin/service/elasticsearch condrestart
10+ echo "discovery.zen.ping.unicast.hosts: \"${ZENMASTERS}\"" >> /etc/elasticsearch/elasticsearch.yml
11+ service elasticsearch force-reload
12 fi
13
14=== modified file 'hooks/install'
15--- hooks/install 2013-09-29 13:21:22 +0000
16+++ hooks/install 2014-05-10 21:52:43 +0000
17@@ -5,28 +5,18 @@
18 HOME=`dirname $0`
19 . $HOME/common.sh
20
21-juju-log "Check if we've installed elasticsearch before"
22-
23-if [ ! -f "/opt/elasticsearch-$VERSION/bin/elasticsearch" ]; then
24- juju-log "Installing OpenJDK"
25- apt-get install -y default-jre-headless wget curl
26-
27- juju-log "Downloading elasticsearch"
28-
29- # Check if a local copy of the jar exists
30- if [ -f $HOME/../files/charm/elasticsearch-$VERSION.tar.gz ]
31- then
32- juju-log "elasticsearch binary found local,copy to /tmp"
33- install -o root -g root -m 0644 $HOME/../files/charm/elasticsearch-$VERSION.tar.gz /tmp/elasticsearch-$VERSION.tar.gz
34- else
35- # Download and checksum
36- juju-log "elasticsearch wrapper binary not found local ... download"
37- wget -q -O /tmp/elasticsearch-$VERSION.tar.gz "${DOWNLOADURL}/elasticsearch-$VERSION.tar.gz"
38- if [[ $(sha1sum "/tmp/elasticsearch-$VERSION.tar.gz" | cut -d " " -f 1) != ${CHECKSUM} ]]; then
39- juju-log --log-level CRITICAL "Checksum of elasticsearch-$VERSION.tar.gz failed"
40- exit 1
41- fi
42- fi
43+juju-log "Setup elasticsearch repository"
44+
45+wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -
46+
47+echo "deb http://packages.elasticsearch.org/elasticsearch/1.0/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list
48+
49+apt-get update
50+
51+ juju-log "Installing "
52+ apt-get install -y default-jre-headless wget curl elasticsearch
53+
54+
55
56 juju-log "Installing service wrapper"
57 if [ -f $HOME/../files/charm/es-wrapper.tar.gz ]
58@@ -42,35 +32,22 @@
59 exit 1
60 fi
61 fi
62- juju-log "untar elasticsearch"
63- cd /opt
64- tar xzvf /tmp/elasticsearch-$VERSION.tar.gz
65- ln -s elasticsearch-$VERSION elasticsearch
66- rm /tmp/elasticsearch-$VERSION.tar.gz
67- juju-log "untar elasticsearch service wrapper"
68- tar xzvf /tmp/es-wrapper.tar.gz
69- rm /tmp/es-wrapper.tar.gz
70- mv *servicewrapper*/service elasticsearch/bin/
71- rm -Rf *servicewrapper*
72-
73- cd /opt/elasticsearch
74-
75- juju-log "Setup elasticsearch as a service"
76- /opt/elasticsearch/bin/service/elasticsearch install
77-
78- juju-log "Update elasticsearch config"
79- sed -i "s/<Path to ElasticSearch Home>/\/opt\/elasticsearch/" bin/service/elasticsearch.conf
80- sed -i "s/set\.default\.ES_HEAP_SIZE=.*/set.default.ES_HEAP_SIZE=${HEAP_SIZE}/" bin/service/elasticsearch.conf
81- sed -i "s/wrapper.app.parameter.1.*/wrapper.app.parameter.1=$BOOTSTRAP_CLASS/" bin/service/elasticsearch.conf
82- sed -i "s/# cluster.name:.*/cluster.name: $CLUSTER_NAME/" config/elasticsearch.yml
83+
84+
85
86 # If Amazon install some magic stuff to allow auto-discovery of other ES nodes.
87 if [ ! -z "$ACCESS_KEY" ] && [ ! -z "$SECRET_KEY" ]; then
88- juju-log "Install elasticsearch aws plugin"
89- bin/plugin -install elasticsearch/elasticsearch-cloud-aws/1.4.0 > /dev/null
90+ PLUGIN="echo ` /usr/share/elasticsearch/bin/plugin -l |grep head`"
91+ if [ ! -z "$PLUGIN" ]
92+ then
93+ # install elasticsearch head
94+ juju-log "Install elasticsearch aws plugin"
95+ /usr/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head
96+ fi
97
98- juju-log "Update elastisearch config for ec2"
99- cat >> config/elasticsearch.yml << EOF
100+ juju-log "Install elasticsearch aws plugin"
101+ juju-log "Update elastisearch config for ec2"
102+ cat >> config/elasticsearch.yml << EOF
103 ################################ EC2 Discovery ################################
104
105 cloud:
106@@ -82,10 +59,5 @@
107 discovery:
108 type: ec2
109 EOF
110- fi
111-
112-# install elasticsearch head
113-/opt/elasticsearch/bin/plugin -install mobz/elasticsearch-head
114-
115
116 fi
117
118=== modified file 'hooks/start'
119--- hooks/start 2014-01-23 21:09:52 +0000
120+++ hooks/start 2014-05-10 21:52:43 +0000
121@@ -9,7 +9,8 @@
122
123 open-port 9200/tcp
124 open-port 9300/tcp
125-/opt/elasticsearch/bin/service/elasticsearch start
126+service elasticsearch start
127+
128
129 # load up logstash template.
130 # https://github.com/logstash/logstash/wiki/Elasticsearch-Storage-Optimization
131
132=== modified file 'hooks/stop'
133--- hooks/stop 2012-11-11 18:34:00 +0000
134+++ hooks/stop 2014-05-10 21:52:43 +0000
135@@ -12,4 +12,4 @@
136
137 #close-port 9200/tcp
138 #close-port 9300/tcp
139-/opt/elasticsearch/bin/service/elasticsearch stop
140+service elasticsearch stop
141\ No newline at end of file
142
143=== modified file 'revision'
144--- revision 2013-09-29 13:21:22 +0000
145+++ revision 2014-05-10 21:52:43 +0000
146@@ -1,1 +1,1 @@
147-28
148+30

Subscribers

People subscribed via source and target branches

to all changes: