Merge lp:~lazypower/charms/trusty/docker/trunk into lp:charms/trusty/docker

Proposed by Charles Butler
Status: Merged
Merged at revision: 7
Proposed branch: lp:~lazypower/charms/trusty/docker/trunk
Merge into: lp:charms/trusty/docker
Diff against target: 401 lines (+115/-58)
13 files modified
Makefile (+4/-1)
README.md (+27/-9)
config.yaml (+10/-2)
hooks/python-pkgs.txt (+1/-1)
hooks/setup.py (+0/-22)
hooks/setup.sh (+0/-9)
metadata.yaml (+2/-2)
playbooks/config-changed.yaml (+40/-0)
playbooks/latest-docker.yaml (+9/-4)
playbooks/network-relation-changed.yaml (+2/-0)
playbooks/site.yaml (+2/-2)
tests/10-deploy-test (+18/-5)
tests/tests.yaml (+0/-1)
To merge this branch: bzr merge lp:~lazypower/charms/trusty/docker/trunk
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Approve
charmers Pending
Review via email: mp+265205@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.
Revision history for this message
Matt Bruzek (mbruzek) wrote :

Hey Chuck,

Thanks for this update to the docker charm. As we discussed over IRC this branch does not merge cleanly with the trusty/docker that is in the store.

Please fix the branch and resubmit. Thank you.

review: Needs Fixing
Revision history for this message
Charles Butler (lazypower) wrote :

I've cleaned up the tree, refactored the tests and I'm getting greens in charmbox. I think we're ready for another round of reviews on this branch.

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

Nice work here Chuck. I was able to deploy and pull an image. Passes bundletester PASS: 4 Total: 4 (711.994322 sec). I know this aufs change fixes storage problems in the charm.

+1 LGTM

review: Approve
7. By Matt Bruzek

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

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-09-14 21:25:51 +0000
4@@ -2,11 +2,14 @@
5
6 build: tox lint test
7
8+virtualenv:
9+ virtualenv .venv
10+
11 tox:
12 /usr/bin/tox:
13 sudo apt-get install -y python-tox python-dev python-virtualenv
14
15-lint: /usr/bin/tox
16+lint: /usr/bin/tox
17 tox -e lint
18
19
20
21=== modified file 'README.md'
22--- README.md 2015-07-17 13:22:34 +0000
23+++ README.md 2015-09-14 21:25:51 +0000
24@@ -1,4 +1,4 @@
25-# Docker ![](https://d3oypxn00j2a10.cloudfront.net/0.12.10/img/nav/docker-logo-loggedout.png)
26+# Docker Charm
27
28 [![Build Status](http://drone.dasroot.net/api/badge/github.com/chuckbutler/docker-charm/status.svg?branch=master)](http://drone.dasroot.net/github.com/chuckbutler/docker-charm)
29
30@@ -20,20 +20,20 @@
31
32 # Using the Docker Charm
33
34-Step by step instructions on using the docker charm:
35+Step by step instructions on using the Docker charm:
36
37- juju deploy cs:trusty/docker
38+ juju deploy cs:~lazypower/trusty/docker
39
40 ## Scale out Usage
41
42-Scaling out the docker service is as simple as adding additional docker units
43+Scaling out the Docker service is as simple as adding additional Docker units
44 to expand your cluster. However, you will need an SDN solution to provide cross
45 host networking. See the Known Limitations and issues about this.
46
47 # Configuration
48
49 - latest : By default the charm assumes installation from the ubuntu
50-repositories. If you wish to deploy the latest upstream docker runtime enable
51+repositories. If you wish to deploy the latest upstream Docker runtime enable
52 this option.
53
54 - version : String representation of the version you wish to deploy. This helps
55@@ -47,13 +47,22 @@
56 leverage a yaml file to spin up and manage multiple containers that
57 comprise a single application stack.
58
59+- aufs : **new as of v0.1.6** Defaults the backend storage driver to AUFS. The
60+ older option of device mapper was horribly broken in most setups, and has
61+ been completely depreciated by the Docker foundation. Disable to keep the
62+ DeviceMapper backend. - Not recommended. **note** this will break existing
63+ containers if you upgrade existing setups. Ensure you account for this when
64+ upgrading your Docker clusters that are previously deployed with this charm.
65+
66+ > See blurb under Known Issues for migration instructions.
67+
68 ## Known Limitations and Issues
69
70
71 #### AWS t1.micro
72
73 Performance will suffer on an AWS t1.micro unit - as it has such a limited amount of ram. Between
74-the juju unit-agent, and the docker daemon + workloads - you will only be able to run the smallest
75+the juju unit-agent, and the Docker daemon + workloads - you will only be able to run the smallest
76 of deployments on them. Thus it is not recommended.
77
78 #### Local Provider Blockers
79@@ -71,7 +80,7 @@
80
81 #### Host Only Networking
82
83- By default, docker deploys a host-only bridge adapter. Containers are able to communicate with one
84+ By default, Docker deploys a host-only bridge adapter. Containers are able to communicate with one
85 another if you forward host ports to the containers using the `-p` option. More on this in the
86 [Deploying Containers]({{site.url}}/user/deploying-containers.html) docpage.
87
88@@ -81,12 +90,21 @@
89
90 #### Offline Environments
91
92-There is no support for installation of the docker service in
93+There is no support for installation of the Docker service in
94 [offline environments](https://jujucharms.com/docs/howto-offline-charms).
95 There is however [a bug](https://github.com/chuckbutler/docker-charm/issues/13) to track the
96 progress of this feature.
97
98-
99+#### AUFS Upgrade Stopped my containers from working
100+
101+If you have older containers deployed and running, you will need to pause them
102+and export. Once the tarballs of the containers have been exported - upgrade
103+your cluster and reimport following the CLI instructions below as a guide
104+
105+ docker export <<container id>> > mycontainer-latest.tgz
106+ # upgrade
107+ docker import -i mycontainer-latest - mycontainer:latest
108+ docker run <<options>> mycontainer:latest
109
110
111 # Contact Information
112
113=== modified file 'config.yaml'
114--- config.yaml 2015-07-10 20:52:16 +0000
115+++ config.yaml 2015-09-14 21:25:51 +0000
116@@ -7,7 +7,7 @@
117 installs docker.io from the Ubuntu package archive."
118 version:
119 type: string
120- default: 1.7.0
121+ default: 1.8.1-0~trusty
122 description: |
123 When latest = true, specify the version to install from the PPA.
124 latest = false will always assume use the current stable in distro.
125@@ -16,4 +16,12 @@
126 default: true
127 description: |
128 Install docker compose, the formation launch utility
129-
130+ aufs:
131+ type: boolean
132+ default: true
133+ description: |
134+ Change the backend storage driver from devicemapper to AUFS.
135+ The device mapper storage engine is known to be problematic, and AUFS
136+ is not enabled by default in Ubuntu. This will install AUFS support and
137+ swap the backend. **NOTE** It is not recommended to reconfigure this post
138+ deployment. You may incur dataloss.
139
140=== modified file 'hooks/python-pkgs.txt'
141--- hooks/python-pkgs.txt 2015-06-02 17:33:17 +0000
142+++ hooks/python-pkgs.txt 2015-09-14 21:25:51 +0000
143@@ -1,5 +1,5 @@
144 -e git+https://github.com/whitmo/ansible-charm.git#egg=AnsibleCharm
145 charmhelpers
146 ansible
147-path.py
148+path.py <= 7.7.1
149 docker-py
150
151=== removed file 'hooks/setup.py'
152--- hooks/setup.py 2015-07-17 13:22:34 +0000
153+++ hooks/setup.py 1970-01-01 00:00:00 +0000
154@@ -1,22 +0,0 @@
155-import subprocess
156-import sys
157-import os
158-
159-
160-def pre_install():
161- """
162- Do any setup required before the install hook.
163- """
164- try:
165- import charmhelpers # noqa
166- import ansiblecharm # noqa
167- from path import path # noqa
168- except ImportError:
169- subprocess.check_call(['hooks/setup.sh'])
170- subprocess.check_call("pip install -r hooks/python-pkgs.txt",
171- shell=True)
172-
173- from path import path
174-
175- pth = str(path(os.environ['CHARM_DIR']) / 'src/ansiblecharm')
176- sys.path.append(pth)
177
178=== removed file 'hooks/setup.sh'
179--- hooks/setup.sh 2015-06-10 20:39:25 +0000
180+++ hooks/setup.sh 1970-01-01 00:00:00 +0000
181@@ -1,9 +0,0 @@
182-#!/bin/bash
183-set -e
184-
185-apt-get install -y \
186- python-dev \
187- python-pip \
188- git
189-
190-easy_install -U pip
191
192=== modified file 'metadata.yaml'
193--- metadata.yaml 2015-07-10 20:52:16 +0000
194+++ metadata.yaml 2015-09-14 21:25:51 +0000
195@@ -10,8 +10,8 @@
196 provides:
197 docker-containers:
198 interface: containers
199-# events:
200-# interface: docker-socket
201+ events:
202+ interface: docker-socket
203 requires:
204 network:
205 interface: overlay-network
206
207=== added file 'modules/__init__.py'
208=== modified file 'playbooks/config-changed.yaml'
209--- playbooks/config-changed.yaml 2015-06-10 20:39:25 +0000
210+++ playbooks/config-changed.yaml 2015-09-14 21:25:51 +0000
211@@ -13,21 +13,61 @@
212 service_label: "service={{ service_name }}"
213 unit_label: "unit={{ local_unit }}"
214
215+- name: grab release info
216+ shell: uname -r
217+ register: rel
218+ when: aufs == true
219+
220+- set_fact:
221+ thisrel: "{{ rel.stdout }}"
222+ when: aufs == true
223+
224+- name: Install AUFS backend supporting packages
225+ apt: name={{item}} state=present
226+ with_items:
227+ - "linux-image-extra-{{thisrel}}"
228+ - aufs-tools
229+ when: aufs == true
230+
231+- name: stop docker to remove device mapper
232+ service: "name={{docker_version_name}} state=stopped"
233+ when: aufs == true and latest == true
234+ notify:
235+ - restart docker
236+
237+- name: Remove Devicemapper backend if present
238+ file: path=/var/lib/docker/devicemapper state=absent
239+ when: aufs == true and latest == true
240+
241+- name: Register AUFS option
242+ docker_opts: action=add
243+ key="storage-driver" val="aufs"
244+ yaml="{{ opts_yaml }}"
245+ when: aufs == true and latest == true
246+ notify:
247+ - calculate docker opts
248+ - render docker defaults
249+ - restart docker
250+
251 - name: set service name as a label
252 docker_opts: action=add
253 key=label val="{{ service_label }}"
254 yaml="{{ opts_yaml }}"
255+ when: latest == true
256 notify:
257 - calculate docker opts
258 - render docker defaults
259+ - restart docker
260
261 - name: set unit as a label
262 docker_opts: action=add
263 key=label val="{{ unit_label }}"
264 yaml="{{ opts_yaml }}"
265+ when: latest == true
266 notify:
267 - calculate docker opts
268 - render docker defaults
269+ - restart docker
270
271 - name: Install docker compose
272 include: install-compose.yaml
273
274=== modified file 'playbooks/latest-docker.yaml'
275--- playbooks/latest-docker.yaml 2015-06-03 17:16:46 +0000
276+++ playbooks/latest-docker.yaml 2015-09-14 21:25:51 +0000
277@@ -4,15 +4,20 @@
278 when: universe_installed
279
280 - name: Add upstream apt key
281- apt_key: id=36A1D7869245C8950F966E92D8576A8BA88D21E9 keyserver=keyserver.ubuntu.com
282+ apt_key: id=58118E89F3A912897C070ADBF76221572C52609D keyserver=keyserver.ubuntu.com
283
284 - name: Add Upstream apt repository
285- apt_repository: repo='deb https://get.docker.com/ubuntu docker main' state=present
286+ apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-trusty main' state=present
287
288 - debug: msg="Installing latest"
289
290 - name: Install required packages.
291- apt: name=lxc-docker-{{ version }} state=present update_cache=yes
292+ apt: name=docker-engine={{version}} state=present update_cache=yes
293+ when: version != ""
294+
295+- name: Install docker-engine metapackage
296+ apt: name=docker-engine state=present update_cache=yes
297+ when: version == ""
298
299 - set_fact:
300- docker_version_name: docker
301\ No newline at end of file
302+ docker_version_name: docker
303
304=== modified file 'playbooks/network-relation-changed.yaml'
305--- playbooks/network-relation-changed.yaml 2015-06-03 17:16:46 +0000
306+++ playbooks/network-relation-changed.yaml 2015-09-14 21:25:51 +0000
307@@ -32,6 +32,7 @@
308 notify:
309 - calculate docker opts
310 - render docker defaults
311+ - restart docker
312
313 - name: set subnet daemon option
314 docker_opts: action=set key=mtu val="{{ flannel_mtu }}" yaml="{{opts_yaml}}"
315@@ -39,6 +40,7 @@
316 notify:
317 - calculate docker opts
318 - render docker defaults
319+ - restart docker
320
321 - name: Halt docker service
322 service: name={{docker_version_name}} state=stopped
323
324=== modified file 'playbooks/site.yaml'
325--- playbooks/site.yaml 2015-06-03 17:16:46 +0000
326+++ playbooks/site.yaml 2015-09-14 21:25:51 +0000
327@@ -3,12 +3,12 @@
328 opts_yaml: /etc/ansible/docker-opts.yaml
329 docker_version_name: false
330 handlers:
331- - name: restart docker
332- service: "name={{docker_version_name}} state=restarted"
333 - name: calculate docker opts
334 docker_opts: "action=read yaml={{opts_yaml}}"
335 - name: render docker defaults
336 template: "src=templates/docker-defaults dest=/etc/default/{{docker_version_name}}"
337+ - name: restart docker
338+ service: "name={{docker_version_name}} state=restarted"
339 tasks:
340 - name: Check Installation Status
341 include: installation-status.yaml
342
343=== modified file 'tests/10-deploy-test'
344--- tests/10-deploy-test 2015-06-02 17:33:17 +0000
345+++ tests/10-deploy-test 2015-09-14 21:25:51 +0000
346@@ -15,7 +15,7 @@
347 """ This method is run once at class creation. """
348 self.deployment = amulet.Deployment(series='trusty')
349
350- self.deployment.add('docker')
351+ self.deployment.add('docker', 'local:trusty/docker')
352
353 try:
354 self.deployment.setup(timeout=seconds)
355@@ -66,20 +66,33 @@
356 def test_latest_config_option(self):
357 """ Set config option to latest and verify docker is installed """
358 self.deployment.configure('docker', {'latest': True,
359- 'version': '1.5.0'})
360+ 'version': '1.8.1-0~trusty'})
361 self.deployment.sentry.wait()
362- command = 'dpkg -l lxc-docker-1.5.0'
363+ import time
364+ print("sleeping 15 seconds because reasons")
365+ time.sleep(15)
366+ command = 'dpkg -l docker-engine'
367 output, code = self.docker_unit.run(command)
368- print(output)
369 if output.find('ii') == -1:
370 message = 'Could not upgrade docker to latest!'
371 amulet.raise_status(amulet.FAIL, msg=message)
372 command = 'dpkg -l docker.io'
373 output, code = self.docker_unit.run(command)
374- print(output)
375 if output.find('ii') != -1:
376 message = "Leftover docker.io package found"
377 amulet.raise_status(amulet.Fail, msg=message)
378
379+ def test_latest_config_option_aufs_enabled(self):
380+ '''
381+ This test has a byproduct of actually checking to make sure
382+ we are cleaning up the broken devicemapper leftovers. Which
383+ is totally cool
384+ '''
385+ # Random failures that require a sleep... so remove the sleep
386+ # and recycle the service a second time.
387+ command = "docker info"
388+ output, code = self.docker_unit.run(command)
389+ assert "aufs" in output
390+
391 if __name__ == '__main__':
392 unittest.main()
393
394=== modified file 'tests/tests.yaml'
395--- tests/tests.yaml 2015-07-10 20:52:16 +0000
396+++ tests/tests.yaml 2015-09-14 21:25:51 +0000
397@@ -1,4 +1,3 @@
398 virtualenv: false
399 makefile:
400 - lint
401- - unit_test

Subscribers

People subscribed via source and target branches

to all changes: