Merge ~pjdc/ubuntu-mirror-charm/+git/ubuntu-mirror-charm:add-extras into ubuntu-mirror-charm:master

Proposed by Paul Collins
Status: Merged
Approved by: Haw Loeung
Approved revision: d15609d3742b09392a1d4400be97530de9527435
Merged at revision: f32f68414d12ccf92341c00762a5bf03243468bd
Proposed branch: ~pjdc/ubuntu-mirror-charm/+git/ubuntu-mirror-charm:add-extras
Merge into: ubuntu-mirror-charm:master
Diff against target: 263 lines (+186/-0)
8 files modified
config.yaml (+57/-0)
files/check-mirror.sh (+7/-0)
files/check-updates.sh (+4/-0)
hooks/Config.py (+1/-0)
keys/ubuntu-extras.asc (+17/-0)
templates/apache-extras.tmpl (+44/-0)
tests/unit/test_templates.py (+15/-0)
tests/unit/testdata/extras/extras.txt (+41/-0)
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
Canonical IS Reviewers Pending
Review via email: mp+411569@code.launchpad.net

Commit message

add support for hosting extras.ubuntu.com

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM

review: Approve (+1)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision f32f68414d12ccf92341c00762a5bf03243468bd

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/config.yaml b/config.yaml
index 582b256..b704dc4 100644
--- a/config.yaml
+++ b/config.yaml
@@ -271,6 +271,63 @@ options:
271 description: >271 description: >
272 Local path of the key file to use when triggering downstream272 Local path of the key file to use when triggering downstream
273 mirrors. If empty, downstream mirrors are not triggered.273 mirrors. If empty, downstream mirrors are not triggered.
274 mirror_extras_name:
275 default: "extras.ubuntu.com"
276 type: string
277 description: "FQDN of the Ubuntu Extras mirror"
278 mirror_extras_aliases:
279 default: '["*.extras.ubuntu.com", "extras.ubuntulinux.org", "*.extras.ubuntulinux.org"]'
280 type: string
281 description: "List of Apache aliases for the Ubuntu Extras mirror"
282 mirror_extras_path:
283 default: "/srv/ftp.root/extras"
284 type: string
285 description: "Root location of mirrored files for the Ubuntu Extras mirror"
286 mirror_extras_description:
287 default: "Ubuntu Extras"
288 type: string
289 description: "A brief welcome message for the Ubuntu Extras mirror"
290 mirror_extras_rsync_log:
291 default: true
292 type: boolean
293 description: "Whether to log rsync requests for the Ubuntu Extras mirror"
294 mirror_extras_command:
295 default: "mirror-2stage.sh"
296 type: string
297 description: "The command to use to sync the Ubuntu Extras mirror"
298 mirror_extras_source_url:
299 default: "rsync://extras.ubuntu.com/extras"
300 type: string
301 description: "The URL the Ubuntu Extras mirror will be fetched from"
302 mirror_extras_rsync_auth:
303 default: '{}'
304 type: string
305 description: "Optional rsync authentication details for mirror_extras_source_url"
306 mirror_extras_rsync_module:
307 default: "extras"
308 type: string
309 description: "The name of the rsync module for this mirror role"
310 mirror_extras_sync_time:
311 default: "ondemand"
312 type: string
313 description: "When mirror updates should be run. Either a cron(5) format time specification or 'ondemand' for ssh triggering"
314 mirror_extras_trigger:
315 default: ""
316 type: string
317 description: "A base64 string containing the ssh trigger public key"
318 mirror_extras_downstream_mirrors:
319 default: ""
320 type: "string"
321 description: >
322 A space-separated list of mirrors to trigger following a sync.
323 Username defaults to the mirror_user config setting, and
324 otherwise may be specified by "user@host" syntax.
325 mirror_extras_trigger_keyfile:
326 default: ""
327 type: "string"
328 description: >
329 Local path of the key file to use when triggering downstream
330 mirrors. If empty, downstream mirrors are not triggered.
274 mirror_simple-streams_name:331 mirror_simple-streams_name:
275 default: "streams.canonical.com"332 default: "streams.canonical.com"
276 type: string333 type: string
diff --git a/files/check-mirror.sh b/files/check-mirror.sh
index 003b48a..7714ce4 100755
--- a/files/check-mirror.sh
+++ b/files/check-mirror.sh
@@ -80,6 +80,10 @@ case ${role} in
80 unsigned=ephemeral-v3/daily/focal/amd64/80 unsigned=ephemeral-v3/daily/focal/amd64/
81 signed=${unsigned}.gpg # not used81 signed=${unsigned}.gpg # not used
82 ;;82 ;;
83 extras)
84 unsigned=ubuntu/dists/trusty/Release
85 signed=${unsigned}.gpg
86 ;;
83 *)87 *)
84 echo "Unknown mirror role, ${role}"88 echo "Unknown mirror role, ${role}"
85 exit 289 exit 2
@@ -102,6 +106,9 @@ case ${role} in
102 cloud-images)106 cloud-images)
103 keyring_file=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg107 keyring_file=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg
104 ;;108 ;;
109 extras)
110 keyring_file=/usr/local/share/ubuntu-mirror-charm.gpg
111 ;;
105 linuxcontainers)112 linuxcontainers)
106 keyring_file=/usr/local/share/ubuntu-mirror-charm.gpg113 keyring_file=/usr/local/share/ubuntu-mirror-charm.gpg
107 ;;114 ;;
diff --git a/files/check-updates.sh b/files/check-updates.sh
index f1ebe86..3fb11bc 100755
--- a/files/check-updates.sh
+++ b/files/check-updates.sh
@@ -35,6 +35,10 @@ function days {
35}35}
3636
37case $NAME in37case $NAME in
38 extras.ubuntu.com)
39 # This will never be updated again.
40 crit_age=$(days 3650)
41 ;;
38 images.maas.io)42 images.maas.io)
39 crit_age=$(days 7)43 crit_age=$(days 7)
40 ;;44 ;;
diff --git a/hooks/Config.py b/hooks/Config.py
index 7b90858..a648bc2 100755
--- a/hooks/Config.py
+++ b/hooks/Config.py
@@ -239,6 +239,7 @@ class Config:
239 return [239 return [
240 "cdimage",240 "cdimage",
241 "cloud-images",241 "cloud-images",
242 "extras",
242 "linuxcontainers",243 "linuxcontainers",
243 "maas-images",244 "maas-images",
244 "old-releases",245 "old-releases",
diff --git a/keys/ubuntu-extras.asc b/keys/ubuntu-extras.asc
245new file mode 100644246new file mode 100644
index 0000000..508b9e0
--- /dev/null
+++ b/keys/ubuntu-extras.asc
@@ -0,0 +1,17 @@
1-----BEGIN PGP PUBLIC KEY BLOCK-----
2
3mQGiBEyXadoRBADTUoaVczNG3ras9/nqhHVduWDjxi0wbhMfRpciB2NK9T5YVVPq
4LPDtRCpso07ackIwzDalizzvXm6bgJVWrg5//F8r7k/OowWgJ6B+SRzUzvROIR4m
5zt/HnBhYU2otPY7QWcGMcOhjMnYCgKTn20aJfmr+8CcvM87XLhylUTwoWwCgtIQC
6a20BjPQHrArjeu+YxnJi1vsD/A0rmQdF633pPr0cxum1CCoQn+4kpOIN7qKAppik
7Rfn7Cl+Pk4WYABtd//W7VjDcdfLHJImRR/y5PZVjHQHpy4b2UQ+Yrb3EFZdVuQZB
8YKwLmAEyk7i9/QmSSF+pte3srXLEbt7bBgVXwwB6om/x9JpbIcwJcixDBVMNjMOt
9KIKJA/4uQEXws1mKjSNEopCeAhY6mTnpCh7L/eqCMhBfZrtjDlbw62+lahpgQmTI
10x74YlB7qOAw5yHBPnOJ2hlY98GPzd0VS9xucggwb8RMBjz2ePPm/4T9Z+ScOKGxn
11P/MQWUVoXB1drjECuKy54QRzhltZwPZJF3m5YGbvDasIBtrY37RCVWJ1bnR1IEV4
12dHJhcyBBcmNoaXZlIEF1dG9tYXRpYyBTaWduaW5nIEtleSA8ZnRwbWFzdGVyQHVi
13dW50dS5jb20+iGAEExECACAFAkyXadoCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
14gAAKCRAWEm06PlwRksuCAJ9LLS1BvhqMOKfq5QWMqCeZ1R0howCdFAuj5kOgPajo
15AcakFvDQqwgerPk=
16=iZIY
17-----END PGP PUBLIC KEY BLOCK-----
diff --git a/templates/apache-extras.tmpl b/templates/apache-extras.tmpl
0new file mode 10064418new file mode 100644
index 0000000..469452f
--- /dev/null
+++ b/templates/apache-extras.tmpl
@@ -0,0 +1,44 @@
1#for $port in $ports
2#set $sockets = ' '.join(sorted(['{}:{}'.format(address, port) for address in $addresses]))
3<VirtualHost ${sockets}>
4 ServerName ${name}
5 #for $alias in $aliases
6 ServerAlias ${alias}
7 #end for
8
9 CustomLog ${logdir}/${name}-access.log combined-port
10 ErrorLog ${logdir}/${name}-error.log
11 LogFormat "%h %p %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined-port
12
13 DocumentRoot /srv/${name}/www
14 # Munge the Cache-Control/Expires response headers to try make
15 # transparent proxy servers DTRT.
16 <Files ~ "Release(\.gpg)?|InRelease|Packages\.(xz|bz2|gz)|Sources\.(xz|bz2|gz)?|Translation-.*?$">
17 ExpiresActive On
18 ExpiresDefault "modification plus 1800 seconds"
19 Header append Cache-Control "proxy-revalidate"
20 </Files>
21 # Allow intermediate caches to cache .deb|.udeb|.ddeb files for a day.
22 # This could be increased in the future since deb files are the perfect
23 # case for cacheable resources (invariant, versioned URLs, and external
24 # integrity verification)
25 <FilesMatch ".+\.[ud]?deb$">
26 Header append Cache-Control "max-age=86400"
27 </FilesMatch>
28 # Allow intermediate caches to store by-hash files for up to a day.
29 # Again, these files are by definition invariant so they are perfectly
30 # cacheable.
31 <FilesMatch "\/by-hash\/">
32 Header append Cache-Control "max-age=86400"
33 </FilesMatch>
34
35 FileETag MTime Size
36 <Directory "/srv/${name}/">
37 Require all granted
38 IndexOptions NameWidth=* +SuppressDescription
39 Options +Indexes +FollowSymLinks
40 IndexIgnore favicon.ico
41 </Directory>
42</VirtualHost>
43
44#end for
diff --git a/tests/unit/test_templates.py b/tests/unit/test_templates.py
index ea2366b..203a7b2 100644
--- a/tests/unit/test_templates.py
+++ b/tests/unit/test_templates.py
@@ -280,3 +280,18 @@ class TestOldReleases(TemplateTestCase, unittest.TestCase):
280 _role = 'old-releases'280 _role = 'old-releases'
281 _search_list = OLD_RELEASES_SEARCH_LIST281 _search_list = OLD_RELEASES_SEARCH_LIST
282 _thirdparty_search_list = None # There are probably not going to be third-party mirrors of this.282 _thirdparty_search_list = None # There are probably not going to be third-party mirrors of this.
283
284
285EXTRAS_SEARCH_LIST = {
286 'addresses': ['*'],
287 'name': 'extras.ubuntu.com',
288 'aliases': ['*.extras.ubuntu.com', 'extras.ubuntulinux.org', '*.extras.ubuntulinux.org'],
289 'ports': [80],
290 'logdir': '/var/log/apache2',
291}
292
293
294class TestExtras(TemplateTestCase, unittest.TestCase):
295 _role = 'extras'
296 _search_list = EXTRAS_SEARCH_LIST
297 _thirdparty_search_list = None # There are probably not going to be third-party mirrors of this.
diff --git a/tests/unit/testdata/extras/extras.txt b/tests/unit/testdata/extras/extras.txt
283new file mode 100644298new file mode 100644
index 0000000..88690e5
--- /dev/null
+++ b/tests/unit/testdata/extras/extras.txt
@@ -0,0 +1,41 @@
1<VirtualHost *:80>
2 ServerName extras.ubuntu.com
3 ServerAlias *.extras.ubuntu.com
4 ServerAlias extras.ubuntulinux.org
5 ServerAlias *.extras.ubuntulinux.org
6
7 CustomLog /var/log/apache2/extras.ubuntu.com-access.log combined-port
8 ErrorLog /var/log/apache2/extras.ubuntu.com-error.log
9 LogFormat "%h %p %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined-port
10
11 DocumentRoot /srv/extras.ubuntu.com/www
12 # Munge the Cache-Control/Expires response headers to try make
13 # transparent proxy servers DTRT.
14 <Files ~ "Release(\.gpg)?|InRelease|Packages\.(xz|bz2|gz)|Sources\.(xz|bz2|gz)?|Translation-.*?$">
15 ExpiresActive On
16 ExpiresDefault "modification plus 1800 seconds"
17 Header append Cache-Control "proxy-revalidate"
18 </Files>
19 # Allow intermediate caches to cache .deb|.udeb|.ddeb files for a day.
20 # This could be increased in the future since deb files are the perfect
21 # case for cacheable resources (invariant, versioned URLs, and external
22 # integrity verification)
23 <FilesMatch ".+\.[ud]?deb$">
24 Header append Cache-Control "max-age=86400"
25 </FilesMatch>
26 # Allow intermediate caches to store by-hash files for up to a day.
27 # Again, these files are by definition invariant so they are perfectly
28 # cacheable.
29 <FilesMatch "\/by-hash\/">
30 Header append Cache-Control "max-age=86400"
31 </FilesMatch>
32
33 FileETag MTime Size
34 <Directory "/srv/extras.ubuntu.com/">
35 Require all granted
36 IndexOptions NameWidth=* +SuppressDescription
37 Options +Indexes +FollowSymLinks
38 IndexIgnore favicon.ico
39 </Directory>
40</VirtualHost>
41

Subscribers

People subscribed via source and target branches