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 Mergebot (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 Mergebot (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
1diff --git a/config.yaml b/config.yaml
2index 582b256..b704dc4 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -271,6 +271,63 @@ options:
6 description: >
7 Local path of the key file to use when triggering downstream
8 mirrors. If empty, downstream mirrors are not triggered.
9+ mirror_extras_name:
10+ default: "extras.ubuntu.com"
11+ type: string
12+ description: "FQDN of the Ubuntu Extras mirror"
13+ mirror_extras_aliases:
14+ default: '["*.extras.ubuntu.com", "extras.ubuntulinux.org", "*.extras.ubuntulinux.org"]'
15+ type: string
16+ description: "List of Apache aliases for the Ubuntu Extras mirror"
17+ mirror_extras_path:
18+ default: "/srv/ftp.root/extras"
19+ type: string
20+ description: "Root location of mirrored files for the Ubuntu Extras mirror"
21+ mirror_extras_description:
22+ default: "Ubuntu Extras"
23+ type: string
24+ description: "A brief welcome message for the Ubuntu Extras mirror"
25+ mirror_extras_rsync_log:
26+ default: true
27+ type: boolean
28+ description: "Whether to log rsync requests for the Ubuntu Extras mirror"
29+ mirror_extras_command:
30+ default: "mirror-2stage.sh"
31+ type: string
32+ description: "The command to use to sync the Ubuntu Extras mirror"
33+ mirror_extras_source_url:
34+ default: "rsync://extras.ubuntu.com/extras"
35+ type: string
36+ description: "The URL the Ubuntu Extras mirror will be fetched from"
37+ mirror_extras_rsync_auth:
38+ default: '{}'
39+ type: string
40+ description: "Optional rsync authentication details for mirror_extras_source_url"
41+ mirror_extras_rsync_module:
42+ default: "extras"
43+ type: string
44+ description: "The name of the rsync module for this mirror role"
45+ mirror_extras_sync_time:
46+ default: "ondemand"
47+ type: string
48+ description: "When mirror updates should be run. Either a cron(5) format time specification or 'ondemand' for ssh triggering"
49+ mirror_extras_trigger:
50+ default: ""
51+ type: string
52+ description: "A base64 string containing the ssh trigger public key"
53+ mirror_extras_downstream_mirrors:
54+ default: ""
55+ type: "string"
56+ description: >
57+ A space-separated list of mirrors to trigger following a sync.
58+ Username defaults to the mirror_user config setting, and
59+ otherwise may be specified by "user@host" syntax.
60+ mirror_extras_trigger_keyfile:
61+ default: ""
62+ type: "string"
63+ description: >
64+ Local path of the key file to use when triggering downstream
65+ mirrors. If empty, downstream mirrors are not triggered.
66 mirror_simple-streams_name:
67 default: "streams.canonical.com"
68 type: string
69diff --git a/files/check-mirror.sh b/files/check-mirror.sh
70index 003b48a..7714ce4 100755
71--- a/files/check-mirror.sh
72+++ b/files/check-mirror.sh
73@@ -80,6 +80,10 @@ case ${role} in
74 unsigned=ephemeral-v3/daily/focal/amd64/
75 signed=${unsigned}.gpg # not used
76 ;;
77+ extras)
78+ unsigned=ubuntu/dists/trusty/Release
79+ signed=${unsigned}.gpg
80+ ;;
81 *)
82 echo "Unknown mirror role, ${role}"
83 exit 2
84@@ -102,6 +106,9 @@ case ${role} in
85 cloud-images)
86 keyring_file=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg
87 ;;
88+ extras)
89+ keyring_file=/usr/local/share/ubuntu-mirror-charm.gpg
90+ ;;
91 linuxcontainers)
92 keyring_file=/usr/local/share/ubuntu-mirror-charm.gpg
93 ;;
94diff --git a/files/check-updates.sh b/files/check-updates.sh
95index f1ebe86..3fb11bc 100755
96--- a/files/check-updates.sh
97+++ b/files/check-updates.sh
98@@ -35,6 +35,10 @@ function days {
99 }
100
101 case $NAME in
102+ extras.ubuntu.com)
103+ # This will never be updated again.
104+ crit_age=$(days 3650)
105+ ;;
106 images.maas.io)
107 crit_age=$(days 7)
108 ;;
109diff --git a/hooks/Config.py b/hooks/Config.py
110index 7b90858..a648bc2 100755
111--- a/hooks/Config.py
112+++ b/hooks/Config.py
113@@ -239,6 +239,7 @@ class Config:
114 return [
115 "cdimage",
116 "cloud-images",
117+ "extras",
118 "linuxcontainers",
119 "maas-images",
120 "old-releases",
121diff --git a/keys/ubuntu-extras.asc b/keys/ubuntu-extras.asc
122new file mode 100644
123index 0000000..508b9e0
124--- /dev/null
125+++ b/keys/ubuntu-extras.asc
126@@ -0,0 +1,17 @@
127+-----BEGIN PGP PUBLIC KEY BLOCK-----
128+
129+mQGiBEyXadoRBADTUoaVczNG3ras9/nqhHVduWDjxi0wbhMfRpciB2NK9T5YVVPq
130+LPDtRCpso07ackIwzDalizzvXm6bgJVWrg5//F8r7k/OowWgJ6B+SRzUzvROIR4m
131+zt/HnBhYU2otPY7QWcGMcOhjMnYCgKTn20aJfmr+8CcvM87XLhylUTwoWwCgtIQC
132+a20BjPQHrArjeu+YxnJi1vsD/A0rmQdF633pPr0cxum1CCoQn+4kpOIN7qKAppik
133+Rfn7Cl+Pk4WYABtd//W7VjDcdfLHJImRR/y5PZVjHQHpy4b2UQ+Yrb3EFZdVuQZB
134+YKwLmAEyk7i9/QmSSF+pte3srXLEbt7bBgVXwwB6om/x9JpbIcwJcixDBVMNjMOt
135+KIKJA/4uQEXws1mKjSNEopCeAhY6mTnpCh7L/eqCMhBfZrtjDlbw62+lahpgQmTI
136+x74YlB7qOAw5yHBPnOJ2hlY98GPzd0VS9xucggwb8RMBjz2ePPm/4T9Z+ScOKGxn
137+P/MQWUVoXB1drjECuKy54QRzhltZwPZJF3m5YGbvDasIBtrY37RCVWJ1bnR1IEV4
138+dHJhcyBBcmNoaXZlIEF1dG9tYXRpYyBTaWduaW5nIEtleSA8ZnRwbWFzdGVyQHVi
139+dW50dS5jb20+iGAEExECACAFAkyXadoCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
140+gAAKCRAWEm06PlwRksuCAJ9LLS1BvhqMOKfq5QWMqCeZ1R0howCdFAuj5kOgPajo
141+AcakFvDQqwgerPk=
142+=iZIY
143+-----END PGP PUBLIC KEY BLOCK-----
144diff --git a/templates/apache-extras.tmpl b/templates/apache-extras.tmpl
145new file mode 100644
146index 0000000..469452f
147--- /dev/null
148+++ b/templates/apache-extras.tmpl
149@@ -0,0 +1,44 @@
150+#for $port in $ports
151+#set $sockets = ' '.join(sorted(['{}:{}'.format(address, port) for address in $addresses]))
152+<VirtualHost ${sockets}>
153+ ServerName ${name}
154+ #for $alias in $aliases
155+ ServerAlias ${alias}
156+ #end for
157+
158+ CustomLog ${logdir}/${name}-access.log combined-port
159+ ErrorLog ${logdir}/${name}-error.log
160+ LogFormat "%h %p %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined-port
161+
162+ DocumentRoot /srv/${name}/www
163+ # Munge the Cache-Control/Expires response headers to try make
164+ # transparent proxy servers DTRT.
165+ <Files ~ "Release(\.gpg)?|InRelease|Packages\.(xz|bz2|gz)|Sources\.(xz|bz2|gz)?|Translation-.*?$">
166+ ExpiresActive On
167+ ExpiresDefault "modification plus 1800 seconds"
168+ Header append Cache-Control "proxy-revalidate"
169+ </Files>
170+ # Allow intermediate caches to cache .deb|.udeb|.ddeb files for a day.
171+ # This could be increased in the future since deb files are the perfect
172+ # case for cacheable resources (invariant, versioned URLs, and external
173+ # integrity verification)
174+ <FilesMatch ".+\.[ud]?deb$">
175+ Header append Cache-Control "max-age=86400"
176+ </FilesMatch>
177+ # Allow intermediate caches to store by-hash files for up to a day.
178+ # Again, these files are by definition invariant so they are perfectly
179+ # cacheable.
180+ <FilesMatch "\/by-hash\/">
181+ Header append Cache-Control "max-age=86400"
182+ </FilesMatch>
183+
184+ FileETag MTime Size
185+ <Directory "/srv/${name}/">
186+ Require all granted
187+ IndexOptions NameWidth=* +SuppressDescription
188+ Options +Indexes +FollowSymLinks
189+ IndexIgnore favicon.ico
190+ </Directory>
191+</VirtualHost>
192+
193+#end for
194diff --git a/tests/unit/test_templates.py b/tests/unit/test_templates.py
195index ea2366b..203a7b2 100644
196--- a/tests/unit/test_templates.py
197+++ b/tests/unit/test_templates.py
198@@ -280,3 +280,18 @@ class TestOldReleases(TemplateTestCase, unittest.TestCase):
199 _role = 'old-releases'
200 _search_list = OLD_RELEASES_SEARCH_LIST
201 _thirdparty_search_list = None # There are probably not going to be third-party mirrors of this.
202+
203+
204+EXTRAS_SEARCH_LIST = {
205+ 'addresses': ['*'],
206+ 'name': 'extras.ubuntu.com',
207+ 'aliases': ['*.extras.ubuntu.com', 'extras.ubuntulinux.org', '*.extras.ubuntulinux.org'],
208+ 'ports': [80],
209+ 'logdir': '/var/log/apache2',
210+}
211+
212+
213+class TestExtras(TemplateTestCase, unittest.TestCase):
214+ _role = 'extras'
215+ _search_list = EXTRAS_SEARCH_LIST
216+ _thirdparty_search_list = None # There are probably not going to be third-party mirrors of this.
217diff --git a/tests/unit/testdata/extras/extras.txt b/tests/unit/testdata/extras/extras.txt
218new file mode 100644
219index 0000000..88690e5
220--- /dev/null
221+++ b/tests/unit/testdata/extras/extras.txt
222@@ -0,0 +1,41 @@
223+<VirtualHost *:80>
224+ ServerName extras.ubuntu.com
225+ ServerAlias *.extras.ubuntu.com
226+ ServerAlias extras.ubuntulinux.org
227+ ServerAlias *.extras.ubuntulinux.org
228+
229+ CustomLog /var/log/apache2/extras.ubuntu.com-access.log combined-port
230+ ErrorLog /var/log/apache2/extras.ubuntu.com-error.log
231+ LogFormat "%h %p %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined-port
232+
233+ DocumentRoot /srv/extras.ubuntu.com/www
234+ # Munge the Cache-Control/Expires response headers to try make
235+ # transparent proxy servers DTRT.
236+ <Files ~ "Release(\.gpg)?|InRelease|Packages\.(xz|bz2|gz)|Sources\.(xz|bz2|gz)?|Translation-.*?$">
237+ ExpiresActive On
238+ ExpiresDefault "modification plus 1800 seconds"
239+ Header append Cache-Control "proxy-revalidate"
240+ </Files>
241+ # Allow intermediate caches to cache .deb|.udeb|.ddeb files for a day.
242+ # This could be increased in the future since deb files are the perfect
243+ # case for cacheable resources (invariant, versioned URLs, and external
244+ # integrity verification)
245+ <FilesMatch ".+\.[ud]?deb$">
246+ Header append Cache-Control "max-age=86400"
247+ </FilesMatch>
248+ # Allow intermediate caches to store by-hash files for up to a day.
249+ # Again, these files are by definition invariant so they are perfectly
250+ # cacheable.
251+ <FilesMatch "\/by-hash\/">
252+ Header append Cache-Control "max-age=86400"
253+ </FilesMatch>
254+
255+ FileETag MTime Size
256+ <Directory "/srv/extras.ubuntu.com/">
257+ Require all granted
258+ IndexOptions NameWidth=* +SuppressDescription
259+ Options +Indexes +FollowSymLinks
260+ IndexIgnore favicon.ico
261+ </Directory>
262+</VirtualHost>
263+

Subscribers

People subscribed via source and target branches