Merge lp:~michael.nelson/charms/trusty/elasticsearch/elasticsearch2-with-xenial-support into lp:~onlineservices-charmers/charms/trusty/elasticsearch/elasticsearch2

Proposed by Michael Nelson
Status: Needs review
Proposed branch: lp:~michael.nelson/charms/trusty/elasticsearch/elasticsearch2-with-xenial-support
Merge into: lp:~onlineservices-charmers/charms/trusty/elasticsearch/elasticsearch2
Diff against target: 73 lines (+28/-1)
4 files modified
hooks/hooks.py (+5/-0)
hooks/install (+8/-0)
tasks/install-elasticsearch.yml (+12/-1)
tasks/setup-ufw.yml (+3/-0)
To merge this branch: bzr merge lp:~michael.nelson/charms/trusty/elasticsearch/elasticsearch2-with-xenial-support
Reviewer Review Type Date Requested Status
Canonical Onlineservices charmers Pending
Review via email: mp+315196@code.launchpad.net

Commit message

Update to support Xenial (where python2 is not installed by default)

Description of the change

Two changes to enable xenial deploys (without breaking trusty deploys):
 * Ensure python-minimal and python-yaml are installed *before* the install hook is run
 * Ensure openjdk-8-jre is used on xenial (trusty has 7)

When testing I also saw that the firewall setup, run during install, was sometimes curling localhost:9200 before it was available - so I added a wait there too.

I've not yet had a chance to test this on anything other than a local provider, but will do so next week.

If this passes tests etc., I'd also like to push this to:

https://code.launchpad.net/~onlineservices-charmers/charms/xenial/elasticsearch/trunk

as well (and not diverge the charm for the trusty/xenial versions - at least not yet as it's not necessary).

Historical note: online-services initially maintained the elasticsearch branch, but when ES 2.0 was released, there were backwards incompatible changes, so we created and additionally maintained the elasticsearch2 branch which is targeted in the MP. Independently, Charles and Marco then landed ES2.0 support to the original elasticsearch branch (breaking 1.0 support), so the two have diverged slightly.

To post a comment you must log in.

Unmerged revisions

46. By Michael Nelson

Support xenial as well as trusty installations

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2015-10-27 22:30:30 +0000
+++ hooks/hooks.py 2017-01-20 07:02:23 +0000
@@ -97,4 +97,9 @@
9797
9898
99if __name__ == "__main__":99if __name__ == "__main__":
100 # Ensure if the hooks/hooks.py has been called directly that we treat
101 # it as an install hook.
102 if sys.argv[0] == 'hooks/hooks.py':
103 sys.argv[0] = 'hooks/install'
104
100 hooks.execute(sys.argv)105 hooks.execute(sys.argv)
101106
=== added file 'hooks/install'
--- hooks/install 1970-01-01 00:00:00 +0000
+++ hooks/install 2017-01-20 07:02:23 +0000
@@ -0,0 +1,8 @@
1#!/bin/bash
2set -o errexit
3set -o nounset
4
5# Ensure /usr/bin/python is available (for xenial support with current
6# python2 charm).
7apt-get install --assume-yes python-minimal python-yaml
8hooks/hooks.py
09
=== removed symlink 'hooks/install'
=== target was u'hooks.py'
=== modified file 'tasks/install-elasticsearch.yml'
--- tasks/install-elasticsearch.yml 2015-11-20 03:06:23 +0000
+++ tasks/install-elasticsearch.yml 2017-01-20 07:02:23 +0000
@@ -16,7 +16,7 @@
16 state: present16 state: present
17 when: apt_repository != ""17 when: apt_repository != ""
1818
19- name: Install dependent packages.19- name: Install dependent packages for trusty or other non-xenial.
20 apt: pkg={{ item }} state=latest update_cache=yes20 apt: pkg={{ item }} state=latest update_cache=yes
21 tags:21 tags:
22 - install22 - install
@@ -24,6 +24,17 @@
24 with_items:24 with_items:
25 - openjdk-7-jre-headless25 - openjdk-7-jre-headless
26 - ufw26 - ufw
27 when: ansible_distribution_major_version != "16"
28
29- name: Install dependent packages for xenial.
30 apt: pkg={{ item }} state=latest update_cache=yes
31 tags:
32 - install
33 - upgrade-charm
34 with_items:
35 - openjdk-8-jre-headless
36 - ufw
37 when: ansible_distribution_major_version == "16"
2738
28- name: Check for local elasticsearch.deb in payload.39- name: Check for local elasticsearch.deb in payload.
29 stat: path=files/elasticsearch.deb40 stat: path=files/elasticsearch.deb
3041
=== modified file 'tasks/setup-ufw.yml'
--- tasks/setup-ufw.yml 2014-10-31 03:43:31 +0000
+++ tasks/setup-ufw.yml 2017-01-20 07:02:23 +0000
@@ -40,6 +40,9 @@
40 with_items: relations["peer"]40 with_items: relations["peer"]
41 when: firewall_enabled41 when: firewall_enabled
4242
43- name: Wait until the local service is available
44 wait_for: port=9200
45
43# Only deny incoming on 9300 once the unit is part of a cluster.46# Only deny incoming on 9300 once the unit is part of a cluster.
44- name: Record current cluster health47- name: Record current cluster health
45 uri: url=http://localhost:9200/_cluster/health return_content=yes48 uri: url=http://localhost:9200/_cluster/health return_content=yes

Subscribers

People subscribed via source and target branches