Merge lp:~dernils/duplicity/Dockerfile into lp:~duplicity-team/duplicity/0.8-series

Proposed by nils
Status: Merged
Merged at revision: 1226
Proposed branch: lp:~dernils/duplicity/Dockerfile
Merge into: lp:~duplicity-team/duplicity/0.8-series
Diff against target: 232 lines (+161/-7)
7 files modified
README-TESTING (+41/-3)
testing/infrastructure/build-duplicity_test.sh (+15/-0)
testing/infrastructure/duplicity_test/Dockerfile (+8/-0)
testing/infrastructure/id_rsa (+27/-0)
testing/infrastructure/id_rsa.pub (+1/-0)
testing/infrastructure/setup.sh (+6/-4)
testing/infrastructure/ssh_server/Dockerfile (+63/-0)
To merge this branch: bzr merge lp:~dernils/duplicity/Dockerfile
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+324027@code.launchpad.net

Description of the change

I added another backend to the docker test infrastructure, updated the setup for testing and updated the documentation.

To post a comment you must log in.
Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

A couple of changes we need to make:

1) Your docker image does not match the released Dockerfile. No user, and
in the wrong directory.
2) We need to have an override for the 10.10/16 subnet. It conflicts with
one of mine, so it'll probably hit someone else. A simple define at the
top of the setup would do for now.
3) Looking good! I'll see about getting a duplicity user on Docker Hub.

On Sun, May 14, 2017 at 10:35 AM, <email address hidden> wrote:

> The proposal to merge lp:~dernils/duplicity/Dockerfile into lp:duplicity
> has been updated.
>
> Status: Needs review => Merged
>
> For more details, see:
> https://code.launchpad.net/~dernils/duplicity/Dockerfile/+merge/324027
> --
> Your team duplicity-team is requested to review the proposed merge of
> lp:~dernils/duplicity/Dockerfile into lp:duplicity.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~duplicity-team
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~duplicity-team
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
nils (dernils) wrote :

inline

Kenneth Loafman <email address hidden> schrieb am Mo., 15. Mai 2017 um
01:57 Uhr:

> A couple of changes we need to make:
>
> 1) Your docker image does not match the released Dockerfile. No user, and
> in the wrong directory.
>
NT: I just did a fresh build and upload. Should be consistent now .

> 2) We need to have an override for the 10.10/16 subnet. It conflicts with
> one of mine, so it'll probably hit someone else. A simple define at the
> top of the setup would do for now.
>
NT: good point. I just introduced a the net and IP as a variable. Will
figure out a way to pass it on into the containers (most likely via an
envrionmental variable) as the next step.

> 3) Looking good! I'll see about getting a duplicity user on Docker Hub.
>
NT: That is a very good idea.

>
> On Sun, May 14, 2017 at 10:35 AM, <email address hidden> wrote:
>
> > The proposal to merge lp:~dernils/duplicity/Dockerfile into lp:duplicity
> > has been updated.
> >
> > Status: Needs review => Merged
> >
> > For more details, see:
> > https://code.launchpad.net/~dernils/duplicity/Dockerfile/+merge/324027
> > --
> > Your team duplicity-team is requested to review the proposed merge of
> > lp:~dernils/duplicity/Dockerfile into lp:duplicity.
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~duplicity-team
> > Post to : <email address hidden>
> > Unsubscribe : https://launchpad.net/~duplicity-team
> > More help : https://help.launchpad.net/ListHelp
> >
>
> --
> https://code.launchpad.net/~dernils/duplicity/Dockerfile/+merge/324027
> You are the owner of lp:~dernils/duplicity/Dockerfile.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README-TESTING'
2--- README-TESTING 2017-04-23 15:04:49 +0000
3+++ README-TESTING 2017-05-14 07:45:09 +0000
4@@ -39,7 +39,6 @@
5 code against different supported environments, including the versions of
6 dependencies used by the Launchpad build system.
7
8-
9 A tox run can be started simply by typing
10
11 ‘tox‘
12@@ -95,6 +94,45 @@
13
14 The report will be generated and stored in the folder htmlcov.
15
16-
17-
18+## The wider picture - supporting containers for testing
19+Testing duplicity invokes backends. The backends are the places where the backup data is actually stored (e.g. an ftp server). In order to have the highest degree of control over the testing process, backends that can be set up locally are also operated in separated docker containers. The whole test infrastructure is shown in the following picture.
20+
21+┌─────────────────────┐ ┌──────────────────────────────────────────┐
22+│docker image │ │docker image │
23+│dernils/duplicitytest│ │dernils/duplicity_testinfrastructure_ssh │
24+├─────────────────────┴────┐ ├──────────────────────────────────────────┴──┐
25+│ │ │ │
26+│ ┌──────────────────┐ │ │ ┌──────────────────┐ │
27+│ │ tox │ │ ┌──┼──▶│ sshd │ │
28+│ └──────────────────┘ │ │ │ └──────────────────┘ │
29+│ │ │ │ │ │
30+│ ▼ │ │ └─────────────────────────────────────────────┘
31+│ ┌──────────────────┐ │ │ ┌──────────────────────────────────────────┐
32+│ │ unittests │ │ │ │docker image │
33+│ └──────────────────┘ │ │ │dernils/duplicity_testinfrastructure_ftp │
34+│ │ │ │ ├──────────────────────────────────────────┴──┐
35+│ ▼ │ │ │ │
36+│ ┌──────────────────┐ │ │ │ ┌──────────────────┐ │
37+│ │ duplicity │◀───┼─┴──┼──▶│ pure-ftpd │ │
38+│ └──────────────────┘ │ │ └──────────────────┘ │
39+│ │ │ │ │
40+└────────────┼─────────────┘ └─────────────────────────────────────────────┘
41+ │
42+ │
43+ │
44+ └────────────┐
45+ │
46+ Internet .─────────┼─────────.
47+ _.────' │ `─────.
48+ _.─' │ `──.
49+ ,' ▼ `.
50+ ; ┌──────────────────┐ :
51+ : │ Dropbox │ ;
52+ ╲ └──────────────────┘ ╱
53+ `. ,'
54+ `──. _.─'
55+ `─────. _.────'
56+ `─────────────────'
57+
58+The docker images that contain the test infrastructure are defined in the folder /testing/infrastructure. There is a build script to compile the Dockerfile into actual images (build-duplicitiy-test.sh). However, as all images are also published on the docker hub, it is not necessary to build the images before starting testing. Testing can directly be started by using the script setup.sh. If the required docker images are not yet existing, locally, they will be downloaded by Docker.
59
60
61=== modified file 'testing/infrastructure/build-duplicity_test.sh'
62--- testing/infrastructure/build-duplicity_test.sh 2017-05-06 20:09:20 +0000
63+++ testing/infrastructure/build-duplicity_test.sh 2017-05-14 07:45:09 +0000
64@@ -2,5 +2,20 @@
65
66 cd duplicity_test
67 cp -p ../../../requirements.txt .
68+cp -p ../id_rsa .
69+cp -p ../id_rsa.pub .
70+
71 docker build --tag dernils/duplicitytest:latest .
72 rm requirements.txt
73+rm id_rsa
74+rm id_rsa.pub
75+
76+cd ..
77+cd ftp_server
78+docker build --tag dernils/duplicity_testinfrastructure_ftp:latest .
79+
80+cd ..
81+cd ssh_server
82+cp -p ../id_rsa.pub .
83+docker build --tag dernils/duplicity_testinfrastructure_ssh:latest .
84+rm id_rsa.pub
85
86=== modified file 'testing/infrastructure/duplicity_test/Dockerfile'
87--- testing/infrastructure/duplicity_test/Dockerfile 2017-05-06 19:41:30 +0000
88+++ testing/infrastructure/duplicity_test/Dockerfile 2017-05-14 07:45:09 +0000
89@@ -66,6 +66,14 @@
90 # Setting a working directory to home
91 WORKDIR /home/test
92
93+# Copy a SSH key to the users folder that is used for some test cases
94+USER root
95+COPY ./id_rsa /home/test/.ssh/
96+COPY ./id_rsa.pub /home/test/.ssh/
97+RUN chown -R test:test /home/test/.ssh
98+RUN chmod 400 /home/test/.ssh/id_rsa
99+USER test
100+
101 # Branch the duplicity repo for testing
102 RUN bzr branch lp:duplicity duplicity
103
104
105=== added file 'testing/infrastructure/id_rsa'
106--- testing/infrastructure/id_rsa 1970-01-01 00:00:00 +0000
107+++ testing/infrastructure/id_rsa 2017-05-14 07:45:09 +0000
108@@ -0,0 +1,27 @@
109+-----BEGIN RSA PRIVATE KEY-----
110+MIIEowIBAAKCAQEA4ZBvr/4i0X0HMPLcTz5F11qCn84GnymquLlR2s/5U8HDpxSK
111+2ZLiZ482yNRkxQkV6JMRIXk9EFQ5XeyAZIPildheqVy17DPhUjyiMf/0OB9OFVUj
112+dPAytTU1uicYsmJyBbel/g7wBhOEwFqUNzNZ5qDdWgVIGZVXfr6PS+1lr5oAG+Z8
113+cdOpuxJg56sCxYvh+wyBIJ70J/6S79xFRNbRUjANsSCReq8Zq5kpXbH4itZN44Zh
114+TCkqgdeYf4p7A1lmNtEfzPGi0voXORxCsTcjJERS4yg4iOA55Wi9bRuOo+ltd+lw
115+ByEEq/0f8mhvMrqGa6gfsIwXQQfC/m/n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7ac2JtkYcoOfvfZ2F+ANkQz0XUO2
132+ywaJyQKBgCe09+E3nHQkCQfhOJO4t46bEHeN2gf4OEqoajAPizK58c8rluodg7xx
133+ttBFCuMcRLLXNgo/t5SS7DAmWC5zjVsr9T1ooWzBhZiegsatsPY+f30xaAKl1/ET
134+q6Rx6FuLjSv8t98sIu3l2sWuTvSzujbtxRGjy0Z4CF/tmbrAbQRF
135+-----END RSA PRIVATE KEY-----
136
137=== added file 'testing/infrastructure/id_rsa.pub'
138--- testing/infrastructure/id_rsa.pub 1970-01-01 00:00:00 +0000
139+++ testing/infrastructure/id_rsa.pub 2017-05-14 07:45:09 +0000
140@@ -0,0 +1,1 @@
141+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhkG+v/iLRfQcw8txPPkXXWoKfzgafKaq4uVHaz/lTwcOnFIrZkuJnjzbI1GTFCRXokxEheT0QVDld7IBkg+KV2F6pXLXsM+FSPKIx//Q4H04VVSN08DK1NTW6JxiyYnIFt6X+DvAGE4TAWpQ3M1nmoN1aBUgZlVd+vo9L7WWvmgAb5nxx06m7EmDnqwLFi+H7DIEgnvQn/pLv3EVE1tFSMA2xIJF6rxmrmSldsfiK1k3jhmFMKSqB15h/insDWWY20R/M8aLS+hc5HEKxNyMkRFLjKDiI4DnlaL1tG46j6W136XAHIQSr/R/yaG8yuoZrqB+wjBdBB8L+b+fE7KBv nils@Nilss-MBP.fritz.box
142
143=== modified file 'testing/infrastructure/setup.sh'
144--- testing/infrastructure/setup.sh 2017-05-06 19:17:29 +0000
145+++ testing/infrastructure/setup.sh 2017-05-14 07:45:09 +0000
146@@ -34,10 +34,12 @@
147
148 # Remove all running instances of the test system and also remove the containers. This ensure
149 # that the test infrastructure is frehshly started.
150-docker rm $(docker stop $(docker ps -a -q --filter name=ftpd_server --format="{{.ID}}"))
151-docker rm $(docker stop $(docker ps -a -q --filter name=duplicity_test --format="{{.ID}}"))
152+docker rm -f $(docker stop $(docker ps -a -q --filter name=d70c0e18-37d5-11e7-a919-92ebcb67fe33-ftpd_server --format="{{.ID}}"))
153+docker rm -f $(docker stop $(docker ps -a -q --filter name=ee681ee4-37d5-11e7-a919-92ebcb67fe33-duplicity_ssh_server --format="{{.ID}}"))
154+docker rm -f $(docker stop $(docker ps -a -q --filter name=f3c09128-37d5-11e7-a919-92ebcb67fe33-duplicity_test --format="{{.ID}}"))
155
156
157 # Start the containers. Docker run will automatically download the image if necessary
158-docker run -d --net testnetwork --ip 10.10.10.3 --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "PUBLICHOST=localhost" dernils/duplicity_testinfrastructure_ftp
159-docker run --name duplicity_test --net testnetwork --ip 10.10.10.2 -it dernils/duplicitytest:latest
160+docker run -d --net testnetwork --ip 10.10.10.3 --name d70c0e18-37d5-11e7-a919-92ebcb67fe33-ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "PUBLICHOST=localhost" dernils/duplicity_testinfrastructure_ftp
161+docker run -d --net testnetwork --ip 10.10.10.4 --name ee681ee4-37d5-11e7-a919-92ebcb67fe33-duplicity_ssh_server -p 22:22 -e "PUBLICHOST=localhost" dernils/duplicity_testinfrastructure_ssh:latest
162+docker run --name f3c09128-37d5-11e7-a919-92ebcb67fe33-duplicity_test --net testnetwork --ip 10.10.10.2 -it dernils/duplicitytest:latest
163
164=== added directory 'testing/infrastructure/ssh_server'
165=== added file 'testing/infrastructure/ssh_server/Dockerfile'
166--- testing/infrastructure/ssh_server/Dockerfile 1970-01-01 00:00:00 +0000
167+++ testing/infrastructure/ssh_server/Dockerfile 2017-05-14 07:45:09 +0000
168@@ -0,0 +1,63 @@
169+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
170+#
171+# Copyright 2017 Nils Tekampe <nils@tekampe.org>
172+# Thanks to Aleksandar Diklic "https://github.com/rastasheep"
173+#
174+# This file is part of duplicity.
175+# It is the Dockerfile of a simple ftp server that is used for backend testing
176+#
177+# Duplicity is free software; you can redistribute it and/or modify it
178+# under the terms of the GNU General Public License as published by the
179+# Free Software Foundation; either version 2 of the License, or (at your
180+# option) any later version.
181+#
182+# Duplicity is distributed in the hope that it will be useful, but
183+# WITHOUT ANY WARRANTY; without even the implied warranty of
184+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
185+# General Public License for more details.
186+#
187+# You should have received a copy of the GNU General Public License
188+# along with duplicity; if not, write to the Free Software Foundation,
189+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
190+#
191+FROM ubuntu:16.04
192+
193+RUN apt-get update
194+
195+RUN apt-get install -y openssh-server
196+RUN mkdir /var/run/sshd
197+
198+RUN echo 'root:root' |chpasswd
199+
200+RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
201+RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
202+RUN echo "Match User userWithOnlyKeyAccess" >> /etc/ssh/sshd_config
203+RUN echo " PasswordAuthentication no" >> /etc/ssh/sshd_config
204+
205+RUN useradd -ms /bin/bash userWithKeyAccess
206+RUN useradd -ms /bin/bash userWithPasswordAccess
207+RUN useradd -ms /bin/bash userWithOnlyKeyAccess
208+
209+USER userWithKeyAccess
210+WORKDIR /home/userWithKeyAccess
211+COPY ./id_rsa.pub /home/userWithKeyAccess/.ssh/authorized_keys
212+
213+USER userWithOnlyKeyAccess
214+WORKDIR /home/userWithOnlyKeyAccess
215+COPY ./id_rsa.pub /home/userWithOnlyKeyAccess/.ssh/authorized_keys
216+
217+USER userWithPasswordAccess
218+WORKDIR /home/userWithPasswordAccess
219+
220+USER root
221+
222+RUN echo 'userWithKeyAccess:userWithKeyAccess' |chpasswd
223+RUN echo 'userWithPasswordAccess:userWithPasswordAccess' |chpasswd
224+
225+RUN chown -R userWithKeyAccess:userWithKeyAccess /home/userWithKeyAccess/.ssh
226+RUN chown -R userWithOnlyKeyAccess:userWithOnlyKeyAccess /home/userWithOnlyKeyAccess/.ssh/
227+
228+
229+EXPOSE 22
230+
231+CMD ["/usr/sbin/sshd", "-D"]
232\ No newline at end of file

Subscribers

People subscribed via source and target branches