Merge lp:~lazypower/charms/trusty/docker/i-hate-bzr into lp:charms/trusty/docker

Proposed by Charles Butler
Status: Work in progress
Proposed branch: lp:~lazypower/charms/trusty/docker/i-hate-bzr
Merge into: lp:charms/trusty/docker
Diff against target: 200 lines (+74/-37)
7 files modified
Makefile (+1/-1)
README.md (+20/-2)
config.yaml (+9/-1)
hooks/setup.py (+0/-22)
hooks/setup.sh (+0/-9)
playbooks/config-changed.yaml (+31/-0)
tests/10-deploy-test (+13/-2)
To merge this branch: bzr merge lp:~lazypower/charms/trusty/docker/i-hate-bzr
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Needs Fixing
Review via email: mp+265462@code.launchpad.net

Description of the change

Updates to v0.1.6 of the docker charm, which adds AUFS backend storage support.

The existing charm deploys device mapper, leaving this enabled by default is not desireable as Docker Inc has depreciated support for this storage engine. Its possible to upgrade existing clusters, however the upgrade path takes some manual intervention of exporting and re-importing the containers.

This has potential side-effects for data-containers, and existing services which will prevent them from starting. Full export and recovery instructions are included in the README along with validation of AUFS storage driver from a devicemapper upgrade have been included in the test suite.

To post a comment you must log in.
8. By Charles Butler

Removes local charm from test

Revision history for this message
Matt Bruzek (mbruzek) wrote :

This branch seems to merge successfully, I think you have mastered bzr.

I like the changes in made in this pull request, but the tests do not pass on bundletester on azure or kvm.

Issue #1: There may be something wrong with the way you install charm-tools. Running "make lint" fails with "SyntaxError: invalid syntax". I created a bug about this problem: https://bugs.launchpad.net/charm-tools/+bug/1477194

This error may be related to your use of tox or how you install charm-tools. I was able to "pip install charm-tools" in another virtualenv WITHOUT any Syntax errors.

Issue #2: The docker daemon does not start on the unit. At the end of the tests I expect to see the docker daemon running on the unit and it is not.

Issue #3: I believe the test that checks for version 1.7.0 needs a sleep after the wait. I have created a merge proposal for this branch https://code.launchpad.net/~mbruzek/charms/trusty/docker/sleep5/+merge/265554 with my suggestion.

review: Needs Fixing

Unmerged revisions

8. By Charles Butler

Removes local charm from test

7. By Charles Butler

Fresh tree to deal with BZRs inconsistent lack of brain cells

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2015-07-10 20:52:16 +0000
3+++ Makefile 2015-07-21 21:47:33 +0000
4@@ -6,7 +6,7 @@
5 /usr/bin/tox:
6 sudo apt-get install -y python-tox python-dev python-virtualenv
7
8-lint: /usr/bin/tox
9+lint: /usr/bin/tox
10 tox -e lint
11
12
13
14=== modified file 'README.md'
15--- README.md 2015-07-17 13:22:34 +0000
16+++ README.md 2015-07-21 21:47:33 +0000
17@@ -22,7 +22,7 @@
18
19 Step by step instructions on using the docker charm:
20
21- juju deploy cs:trusty/docker
22+ juju deploy cs:~lazypower/trusty/docker
23
24 ## Scale out Usage
25
26@@ -47,6 +47,15 @@
27 leverage a yaml file to spin up and manage multiple containers that
28 comprise a single application stack.
29
30+- aufs : **new as of v0.1.6** Defaults the backend storage driver to AUFS. The
31+ older option of device mapper was horribly broken in most setups, and has
32+ been completely depreciated by the Docker foundation. Disable to keep the
33+ DeviceMapper backend. - Not recommended. **note** this will break existing
34+ containers if you upgrade existing setups. Ensure you account for this when
35+ upgrading your docker clusters that are previously deployed with this charm.
36+
37+ > See blurb under Known Issues for migration instructions.
38+
39 ## Known Limitations and Issues
40
41
42@@ -86,7 +95,16 @@
43 There is however [a bug](https://github.com/chuckbutler/docker-charm/issues/13) to track the
44 progress of this feature.
45
46-
47+#### AUFS Upgrade Stopped my containers from working
48+
49+If you have older containers deployed and running, you will need to pause them
50+and export. Once the tarballs of the containers have been exported - upgrade
51+your cluster and reimport following the CLI instructions below as a guide
52+
53+ docker export <<container id>> > mycontainer-latest.tgz
54+ # upgrade
55+ docker import -i mycontainer-latest - mycontainer:latest
56+ docker run <<options>> mycontainer:latest
57
58
59 # Contact Information
60
61=== modified file 'config.yaml'
62--- config.yaml 2015-07-10 20:52:16 +0000
63+++ config.yaml 2015-07-21 21:47:33 +0000
64@@ -16,4 +16,12 @@
65 default: true
66 description: |
67 Install docker compose, the formation launch utility
68-
69+ aufs:
70+ type: boolean
71+ default: true
72+ description: |
73+ Change the backend storage driver from devicemapper to AUFS.
74+ The device mapper storage engine is known to be problematic, and AUFS
75+ is not enabled by default in Ubuntu. This will install AUFS support and
76+ swap the backend. **NOTE** It is not recommended to reconfigure this post
77+ deployment. You may incur dataloss.
78
79=== removed file 'hooks/setup.py'
80--- hooks/setup.py 2015-07-17 13:22:34 +0000
81+++ hooks/setup.py 1970-01-01 00:00:00 +0000
82@@ -1,22 +0,0 @@
83-import subprocess
84-import sys
85-import os
86-
87-
88-def pre_install():
89- """
90- Do any setup required before the install hook.
91- """
92- try:
93- import charmhelpers # noqa
94- import ansiblecharm # noqa
95- from path import path # noqa
96- except ImportError:
97- subprocess.check_call(['hooks/setup.sh'])
98- subprocess.check_call("pip install -r hooks/python-pkgs.txt",
99- shell=True)
100-
101- from path import path
102-
103- pth = str(path(os.environ['CHARM_DIR']) / 'src/ansiblecharm')
104- sys.path.append(pth)
105
106=== removed file 'hooks/setup.sh'
107--- hooks/setup.sh 2015-06-10 20:39:25 +0000
108+++ hooks/setup.sh 1970-01-01 00:00:00 +0000
109@@ -1,9 +0,0 @@
110-#!/bin/bash
111-set -e
112-
113-apt-get install -y \
114- python-dev \
115- python-pip \
116- git
117-
118-easy_install -U pip
119
120=== modified file 'playbooks/config-changed.yaml'
121--- playbooks/config-changed.yaml 2015-06-10 20:39:25 +0000
122+++ playbooks/config-changed.yaml 2015-07-21 21:47:33 +0000
123@@ -13,6 +13,36 @@
124 service_label: "service={{ service_name }}"
125 unit_label: "unit={{ local_unit }}"
126
127+- name: grab release info
128+ shell: uname -r
129+ register: rel
130+ when: aufs == true
131+
132+- set_fact:
133+ thisrel: "{{ rel.stdout }}"
134+ when: aufs == true
135+
136+- name: Install AUFS backend supporting packages
137+ apt: name={{item}} state=present
138+ with_items:
139+ - "linux-image-extra-{{thisrel}}"
140+ - aufs-tools
141+ when: aufs == true
142+
143+- name: stop docker to remove device mapper
144+ service: "name={{docker_version_name}} state=stopped"
145+ when: aufs == true
146+
147+- name: Remove Devicemapper backend if present
148+ file: path=/var/lib/docker/devicemapper state=absent
149+ when: aufs == true
150+
151+- name: Register AUFS option
152+ docker_opts: action=add
153+ key="storage-driver" val="aufs"
154+ yaml="{{ opts_yaml }}"
155+ when: aufs == true
156+
157 - name: set service name as a label
158 docker_opts: action=add
159 key=label val="{{ service_label }}"
160@@ -28,6 +58,7 @@
161 notify:
162 - calculate docker opts
163 - render docker defaults
164+ - restart docker
165
166 - name: Install docker compose
167 include: install-compose.yaml
168
169=== modified file 'tests/10-deploy-test'
170--- tests/10-deploy-test 2015-06-02 17:33:17 +0000
171+++ tests/10-deploy-test 2015-07-21 21:47:33 +0000
172@@ -66,9 +66,9 @@
173 def test_latest_config_option(self):
174 """ Set config option to latest and verify docker is installed """
175 self.deployment.configure('docker', {'latest': True,
176- 'version': '1.5.0'})
177+ 'version': '1.7.0'})
178 self.deployment.sentry.wait()
179- command = 'dpkg -l lxc-docker-1.5.0'
180+ command = 'dpkg -l lxc-docker-1.7.0'
181 output, code = self.docker_unit.run(command)
182 print(output)
183 if output.find('ii') == -1:
184@@ -81,5 +81,16 @@
185 message = "Leftover docker.io package found"
186 amulet.raise_status(amulet.Fail, msg=message)
187
188+ def test_latest_config_aufs_enabled(self):
189+ '''
190+ This test has a byproduct of actually checking to make sure
191+ we are cleaning up the broken devicemapper leftovers. Which
192+ is totally cool
193+ '''
194+ command = "docker info"
195+ output, code = self.docker_unit.run(command)
196+ print(output)
197+ assert "aufs" in output
198+
199 if __name__ == '__main__':
200 unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: