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
=== modified file 'Makefile'
--- Makefile 2015-07-10 20:52:16 +0000
+++ Makefile 2015-09-14 21:25:51 +0000
@@ -2,11 +2,14 @@
22
3build: tox lint test3build: tox lint test
44
5virtualenv:
6 virtualenv .venv
7
5tox:8tox:
6/usr/bin/tox:9/usr/bin/tox:
7 sudo apt-get install -y python-tox python-dev python-virtualenv10 sudo apt-get install -y python-tox python-dev python-virtualenv
811
9lint: /usr/bin/tox 12lint: /usr/bin/tox
10 tox -e lint13 tox -e lint
1114
1215
1316
=== modified file 'README.md'
--- README.md 2015-07-17 13:22:34 +0000
+++ README.md 2015-09-14 21:25:51 +0000
@@ -1,4 +1,4 @@
1# Docker ![](https://d3oypxn00j2a10.cloudfront.net/0.12.10/img/nav/docker-logo-loggedout.png)1# Docker Charm
22
3[![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)3[![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)
44
@@ -20,20 +20,20 @@
2020
21# Using the Docker Charm21# Using the Docker Charm
2222
23Step by step instructions on using the docker charm:23Step by step instructions on using the Docker charm:
2424
25 juju deploy cs:trusty/docker25 juju deploy cs:~lazypower/trusty/docker
2626
27## Scale out Usage27## Scale out Usage
2828
29Scaling out the docker service is as simple as adding additional docker units29Scaling out the Docker service is as simple as adding additional Docker units
30to expand your cluster. However, you will need an SDN solution to provide cross30to expand your cluster. However, you will need an SDN solution to provide cross
31host networking. See the Known Limitations and issues about this.31host networking. See the Known Limitations and issues about this.
3232
33# Configuration33# Configuration
3434
35- latest : By default the charm assumes installation from the ubuntu35- latest : By default the charm assumes installation from the ubuntu
36repositories. If you wish to deploy the latest upstream docker runtime enable36repositories. If you wish to deploy the latest upstream Docker runtime enable
37this option.37this option.
3838
39- version : String representation of the version you wish to deploy. This helps39- version : String representation of the version you wish to deploy. This helps
@@ -47,13 +47,22 @@
47 leverage a yaml file to spin up and manage multiple containers that47 leverage a yaml file to spin up and manage multiple containers that
48 comprise a single application stack.48 comprise a single application stack.
4949
50- aufs : **new as of v0.1.6** Defaults the backend storage driver to AUFS. The
51 older option of device mapper was horribly broken in most setups, and has
52 been completely depreciated by the Docker foundation. Disable to keep the
53 DeviceMapper backend. - Not recommended. **note** this will break existing
54 containers if you upgrade existing setups. Ensure you account for this when
55 upgrading your Docker clusters that are previously deployed with this charm.
56
57 > See blurb under Known Issues for migration instructions.
58
50## Known Limitations and Issues59## Known Limitations and Issues
5160
5261
53#### AWS t1.micro62#### AWS t1.micro
5463
55Performance will suffer on an AWS t1.micro unit - as it has such a limited amount of ram. Between64Performance will suffer on an AWS t1.micro unit - as it has such a limited amount of ram. Between
56the juju unit-agent, and the docker daemon + workloads - you will only be able to run the smallest65the juju unit-agent, and the Docker daemon + workloads - you will only be able to run the smallest
57of deployments on them. Thus it is not recommended.66of deployments on them. Thus it is not recommended.
5867
59#### Local Provider Blockers68#### Local Provider Blockers
@@ -71,7 +80,7 @@
7180
72#### Host Only Networking81#### Host Only Networking
7382
74 By default, docker deploys a host-only bridge adapter. Containers are able to communicate with one83 By default, Docker deploys a host-only bridge adapter. Containers are able to communicate with one
75 another if you forward host ports to the containers using the `-p` option. More on this in the84 another if you forward host ports to the containers using the `-p` option. More on this in the
76[Deploying Containers]({{site.url}}/user/deploying-containers.html) docpage.85[Deploying Containers]({{site.url}}/user/deploying-containers.html) docpage.
7786
@@ -81,12 +90,21 @@
8190
82#### Offline Environments91#### Offline Environments
8392
84There is no support for installation of the docker service in93There is no support for installation of the Docker service in
85[offline environments](https://jujucharms.com/docs/howto-offline-charms).94[offline environments](https://jujucharms.com/docs/howto-offline-charms).
86There is however [a bug](https://github.com/chuckbutler/docker-charm/issues/13) to track the95There is however [a bug](https://github.com/chuckbutler/docker-charm/issues/13) to track the
87progress of this feature.96progress of this feature.
8897
8998#### AUFS Upgrade Stopped my containers from working
99
100If you have older containers deployed and running, you will need to pause them
101and export. Once the tarballs of the containers have been exported - upgrade
102your cluster and reimport following the CLI instructions below as a guide
103
104 docker export <<container id>> > mycontainer-latest.tgz
105 # upgrade
106 docker import -i mycontainer-latest - mycontainer:latest
107 docker run <<options>> mycontainer:latest
90108
91109
92# Contact Information110# Contact Information
93111
=== modified file 'config.yaml'
--- config.yaml 2015-07-10 20:52:16 +0000
+++ config.yaml 2015-09-14 21:25:51 +0000
@@ -7,7 +7,7 @@
7 installs docker.io from the Ubuntu package archive."7 installs docker.io from the Ubuntu package archive."
8 version:8 version:
9 type: string9 type: string
10 default: 1.7.010 default: 1.8.1-0~trusty
11 description: |11 description: |
12 When latest = true, specify the version to install from the PPA.12 When latest = true, specify the version to install from the PPA.
13 latest = false will always assume use the current stable in distro.13 latest = false will always assume use the current stable in distro.
@@ -16,4 +16,12 @@
16 default: true16 default: true
17 description: |17 description: |
18 Install docker compose, the formation launch utility18 Install docker compose, the formation launch utility
1919 aufs:
20 type: boolean
21 default: true
22 description: |
23 Change the backend storage driver from devicemapper to AUFS.
24 The device mapper storage engine is known to be problematic, and AUFS
25 is not enabled by default in Ubuntu. This will install AUFS support and
26 swap the backend. **NOTE** It is not recommended to reconfigure this post
27 deployment. You may incur dataloss.
2028
=== modified file 'hooks/python-pkgs.txt'
--- hooks/python-pkgs.txt 2015-06-02 17:33:17 +0000
+++ hooks/python-pkgs.txt 2015-09-14 21:25:51 +0000
@@ -1,5 +1,5 @@
1-e git+https://github.com/whitmo/ansible-charm.git#egg=AnsibleCharm1-e git+https://github.com/whitmo/ansible-charm.git#egg=AnsibleCharm
2charmhelpers2charmhelpers
3ansible3ansible
4path.py4path.py <= 7.7.1
5docker-py5docker-py
66
=== removed file 'hooks/setup.py'
--- hooks/setup.py 2015-07-17 13:22:34 +0000
+++ hooks/setup.py 1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
1import subprocess
2import sys
3import os
4
5
6def pre_install():
7 """
8 Do any setup required before the install hook.
9 """
10 try:
11 import charmhelpers # noqa
12 import ansiblecharm # noqa
13 from path import path # noqa
14 except ImportError:
15 subprocess.check_call(['hooks/setup.sh'])
16 subprocess.check_call("pip install -r hooks/python-pkgs.txt",
17 shell=True)
18
19 from path import path
20
21 pth = str(path(os.environ['CHARM_DIR']) / 'src/ansiblecharm')
22 sys.path.append(pth)
230
=== removed file 'hooks/setup.sh'
--- hooks/setup.sh 2015-06-10 20:39:25 +0000
+++ hooks/setup.sh 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1#!/bin/bash
2set -e
3
4apt-get install -y \
5 python-dev \
6 python-pip \
7 git
8
9easy_install -U pip
100
=== modified file 'metadata.yaml'
--- metadata.yaml 2015-07-10 20:52:16 +0000
+++ metadata.yaml 2015-09-14 21:25:51 +0000
@@ -10,8 +10,8 @@
10provides:10provides:
11 docker-containers:11 docker-containers:
12 interface: containers12 interface: containers
13# events:13 events:
14# interface: docker-socket14 interface: docker-socket
15requires:15requires:
16 network:16 network:
17 interface: overlay-network17 interface: overlay-network
1818
=== added file 'modules/__init__.py'
=== modified file 'playbooks/config-changed.yaml'
--- playbooks/config-changed.yaml 2015-06-10 20:39:25 +0000
+++ playbooks/config-changed.yaml 2015-09-14 21:25:51 +0000
@@ -13,21 +13,61 @@
13 service_label: "service={{ service_name }}"13 service_label: "service={{ service_name }}"
14 unit_label: "unit={{ local_unit }}"14 unit_label: "unit={{ local_unit }}"
1515
16- name: grab release info
17 shell: uname -r
18 register: rel
19 when: aufs == true
20
21- set_fact:
22 thisrel: "{{ rel.stdout }}"
23 when: aufs == true
24
25- name: Install AUFS backend supporting packages
26 apt: name={{item}} state=present
27 with_items:
28 - "linux-image-extra-{{thisrel}}"
29 - aufs-tools
30 when: aufs == true
31
32- name: stop docker to remove device mapper
33 service: "name={{docker_version_name}} state=stopped"
34 when: aufs == true and latest == true
35 notify:
36 - restart docker
37
38- name: Remove Devicemapper backend if present
39 file: path=/var/lib/docker/devicemapper state=absent
40 when: aufs == true and latest == true
41
42- name: Register AUFS option
43 docker_opts: action=add
44 key="storage-driver" val="aufs"
45 yaml="{{ opts_yaml }}"
46 when: aufs == true and latest == true
47 notify:
48 - calculate docker opts
49 - render docker defaults
50 - restart docker
51
16- name: set service name as a label52- name: set service name as a label
17 docker_opts: action=add53 docker_opts: action=add
18 key=label val="{{ service_label }}"54 key=label val="{{ service_label }}"
19 yaml="{{ opts_yaml }}"55 yaml="{{ opts_yaml }}"
56 when: latest == true
20 notify:57 notify:
21 - calculate docker opts58 - calculate docker opts
22 - render docker defaults59 - render docker defaults
60 - restart docker
2361
24- name: set unit as a label62- name: set unit as a label
25 docker_opts: action=add63 docker_opts: action=add
26 key=label val="{{ unit_label }}"64 key=label val="{{ unit_label }}"
27 yaml="{{ opts_yaml }}"65 yaml="{{ opts_yaml }}"
66 when: latest == true
28 notify:67 notify:
29 - calculate docker opts68 - calculate docker opts
30 - render docker defaults69 - render docker defaults
70 - restart docker
3171
32- name: Install docker compose72- name: Install docker compose
33 include: install-compose.yaml73 include: install-compose.yaml
3474
=== modified file 'playbooks/latest-docker.yaml'
--- playbooks/latest-docker.yaml 2015-06-03 17:16:46 +0000
+++ playbooks/latest-docker.yaml 2015-09-14 21:25:51 +0000
@@ -4,15 +4,20 @@
4 when: universe_installed4 when: universe_installed
55
6- name: Add upstream apt key6- name: Add upstream apt key
7 apt_key: id=36A1D7869245C8950F966E92D8576A8BA88D21E9 keyserver=keyserver.ubuntu.com7 apt_key: id=58118E89F3A912897C070ADBF76221572C52609D keyserver=keyserver.ubuntu.com
88
9- name: Add Upstream apt repository9- name: Add Upstream apt repository
10 apt_repository: repo='deb https://get.docker.com/ubuntu docker main' state=present10 apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-trusty main' state=present
1111
12- debug: msg="Installing latest"12- debug: msg="Installing latest"
1313
14- name: Install required packages.14- name: Install required packages.
15 apt: name=lxc-docker-{{ version }} state=present update_cache=yes15 apt: name=docker-engine={{version}} state=present update_cache=yes
16 when: version != ""
17
18- name: Install docker-engine metapackage
19 apt: name=docker-engine state=present update_cache=yes
20 when: version == ""
1621
17- set_fact:22- set_fact:
18 docker_version_name: docker
19\ No newline at end of file23\ No newline at end of file
24 docker_version_name: docker
2025
=== modified file 'playbooks/network-relation-changed.yaml'
--- playbooks/network-relation-changed.yaml 2015-06-03 17:16:46 +0000
+++ playbooks/network-relation-changed.yaml 2015-09-14 21:25:51 +0000
@@ -32,6 +32,7 @@
32 notify:32 notify:
33 - calculate docker opts33 - calculate docker opts
34 - render docker defaults34 - render docker defaults
35 - restart docker
3536
36- name: set subnet daemon option37- name: set subnet daemon option
37 docker_opts: action=set key=mtu val="{{ flannel_mtu }}" yaml="{{opts_yaml}}"38 docker_opts: action=set key=mtu val="{{ flannel_mtu }}" yaml="{{opts_yaml}}"
@@ -39,6 +40,7 @@
39 notify:40 notify:
40 - calculate docker opts41 - calculate docker opts
41 - render docker defaults42 - render docker defaults
43 - restart docker
4244
43- name: Halt docker service45- name: Halt docker service
44 service: name={{docker_version_name}} state=stopped46 service: name={{docker_version_name}} state=stopped
4547
=== modified file 'playbooks/site.yaml'
--- playbooks/site.yaml 2015-06-03 17:16:46 +0000
+++ playbooks/site.yaml 2015-09-14 21:25:51 +0000
@@ -3,12 +3,12 @@
3 opts_yaml: /etc/ansible/docker-opts.yaml3 opts_yaml: /etc/ansible/docker-opts.yaml
4 docker_version_name: false4 docker_version_name: false
5 handlers:5 handlers:
6 - name: restart docker
7 service: "name={{docker_version_name}} state=restarted"
8 - name: calculate docker opts6 - name: calculate docker opts
9 docker_opts: "action=read yaml={{opts_yaml}}"7 docker_opts: "action=read yaml={{opts_yaml}}"
10 - name: render docker defaults8 - name: render docker defaults
11 template: "src=templates/docker-defaults dest=/etc/default/{{docker_version_name}}"9 template: "src=templates/docker-defaults dest=/etc/default/{{docker_version_name}}"
10 - name: restart docker
11 service: "name={{docker_version_name}} state=restarted"
12 tasks:12 tasks:
13 - name: Check Installation Status13 - name: Check Installation Status
14 include: installation-status.yaml14 include: installation-status.yaml
1515
=== modified file 'tests/10-deploy-test'
--- tests/10-deploy-test 2015-06-02 17:33:17 +0000
+++ tests/10-deploy-test 2015-09-14 21:25:51 +0000
@@ -15,7 +15,7 @@
15 """ This method is run once at class creation. """15 """ This method is run once at class creation. """
16 self.deployment = amulet.Deployment(series='trusty')16 self.deployment = amulet.Deployment(series='trusty')
1717
18 self.deployment.add('docker')18 self.deployment.add('docker', 'local:trusty/docker')
1919
20 try:20 try:
21 self.deployment.setup(timeout=seconds)21 self.deployment.setup(timeout=seconds)
@@ -66,20 +66,33 @@
66 def test_latest_config_option(self):66 def test_latest_config_option(self):
67 """ Set config option to latest and verify docker is installed """67 """ Set config option to latest and verify docker is installed """
68 self.deployment.configure('docker', {'latest': True,68 self.deployment.configure('docker', {'latest': True,
69 'version': '1.5.0'})69 'version': '1.8.1-0~trusty'})
70 self.deployment.sentry.wait()70 self.deployment.sentry.wait()
71 command = 'dpkg -l lxc-docker-1.5.0'71 import time
72 print("sleeping 15 seconds because reasons")
73 time.sleep(15)
74 command = 'dpkg -l docker-engine'
72 output, code = self.docker_unit.run(command)75 output, code = self.docker_unit.run(command)
73 print(output)
74 if output.find('ii') == -1:76 if output.find('ii') == -1:
75 message = 'Could not upgrade docker to latest!'77 message = 'Could not upgrade docker to latest!'
76 amulet.raise_status(amulet.FAIL, msg=message)78 amulet.raise_status(amulet.FAIL, msg=message)
77 command = 'dpkg -l docker.io'79 command = 'dpkg -l docker.io'
78 output, code = self.docker_unit.run(command)80 output, code = self.docker_unit.run(command)
79 print(output)
80 if output.find('ii') != -1:81 if output.find('ii') != -1:
81 message = "Leftover docker.io package found"82 message = "Leftover docker.io package found"
82 amulet.raise_status(amulet.Fail, msg=message)83 amulet.raise_status(amulet.Fail, msg=message)
8384
85 def test_latest_config_option_aufs_enabled(self):
86 '''
87 This test has a byproduct of actually checking to make sure
88 we are cleaning up the broken devicemapper leftovers. Which
89 is totally cool
90 '''
91 # Random failures that require a sleep... so remove the sleep
92 # and recycle the service a second time.
93 command = "docker info"
94 output, code = self.docker_unit.run(command)
95 assert "aufs" in output
96
84if __name__ == '__main__':97if __name__ == '__main__':
85 unittest.main()98 unittest.main()
8699
=== modified file 'tests/tests.yaml'
--- tests/tests.yaml 2015-07-10 20:52:16 +0000
+++ tests/tests.yaml 2015-09-14 21:25:51 +0000
@@ -1,4 +1,3 @@
1virtualenv: false1virtualenv: false
2makefile:2makefile:
3 - lint3 - lint
4 - unit_test

Subscribers

People subscribed via source and target branches

to all changes: