Merge lp:~mwhudson/launchpad/vostok-add-layer into lp:launchpad

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 11299
Proposed branch: lp:~mwhudson/launchpad/vostok-add-layer
Merge into: lp:launchpad
Diff against target: 277 lines (+163/-2)
12 files modified
Makefile (+3/-0)
configs/development/launchpad-lazr.conf (+3/-0)
configs/development/local-vostok-apache (+52/-0)
lib/canonical/config/schema-lazr.conf (+2/-0)
lib/canonical/launchpad/configure.zcml (+1/-0)
lib/lp/code/xmlrpc/tests/test_codehosting.py (+2/-2)
lib/lp/vostok/__init__.py (+4/-0)
lib/lp/vostok/configure.zcml (+14/-0)
lib/lp/vostok/publisher.py (+37/-0)
lib/lp/vostok/tests/__init__.py (+4/-0)
lib/lp/vostok/tests/test_publisher.py (+33/-0)
utilities/rocketfuel-setup (+8/-0)
To merge this branch: bzr merge lp:~mwhudson/launchpad/vostok-add-layer
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+31238@code.launchpad.net

Description of the change

Hi,

This branch is mostly unavoidable and boring stuff to add a new vhost
('vostok') and accompanying layer/skin.

The change to lib/lp/code/xmlrpc/tests/test_codehosting.py is just to remove a
meaningless hit when grepping launchpad for 'vostok'

Cheers,
mwh

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Looks fine. As mentioned on IRC I was wondering whether or not we should add the path
/var/tmp/vostok-archive somewhere into the makefile as it is used by the vostok apache config.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2010-06-25 15:03:10 +0000
3+++ Makefile 2010-07-30 03:26:45 +0000
4@@ -200,6 +200,7 @@
5 configuration:instance_name=${LPCONFIG} -c $(BUILDOUT_CFG)
6
7 compile: $(PY) $(BZR_VERSION_INFO)
8+ mkdir -p /var/tmp/vostok-archive
9 ${SHHH} $(MAKE) -C sourcecode build PYTHON=${PYTHON} \
10 LPCONFIG=${LPCONFIG}
11 ${SHHH} LPCONFIG=${LPCONFIG} ${PY} -t buildmailman.py
12@@ -398,11 +399,13 @@
13 # We insert the absolute path to the branch-rewrite script
14 # into the Apache config as we copy the file into position.
15 sed -e 's,%BRANCH_REWRITE%,$(shell pwd)/scripts/branch-rewrite.py,' configs/development/local-launchpad-apache > /etc/apache2/sites-available/local-launchpad
16+ cp configs/development/local-vostok-apache /etc/apache2/sites-available/local-vosok
17 touch /var/tmp/bazaar.launchpad.dev/rewrite.log
18 chown $(SUDO_UID):$(SUDO_GID) /var/tmp/bazaar.launchpad.dev/rewrite.log
19
20 enable-apache-launchpad: copy-apache-config copy-certificates
21 a2ensite local-launchpad
22+ a2ensite local-vostok
23
24 reload-apache: enable-apache-launchpad
25 /etc/init.d/apache2 restart
26
27=== modified file 'configs/development/launchpad-lazr.conf'
28--- configs/development/launchpad-lazr.conf 2010-07-25 05:16:58 +0000
29+++ configs/development/launchpad-lazr.conf 2010-07-30 03:26:45 +0000
30@@ -330,6 +330,9 @@
31 [vhost.feeds]
32 hostname: feeds.launchpad.dev
33
34+[vhost.vostok]
35+hostname: vostok.dev
36+
37 [zopeless]
38 # XXX sinzui 2008-03-26:
39 # A development box should never send email to the outer world,
40
41=== added file 'configs/development/local-vostok-apache'
42--- configs/development/local-vostok-apache 1970-01-01 00:00:00 +0000
43+++ configs/development/local-vostok-apache 2010-07-30 03:26:45 +0000
44@@ -0,0 +1,52 @@
45+NameVirtualHost 127.0.0.77:80
46+
47+RewriteLock /var/tmp/vostok-rewrite-lock
48+
49+<VirtualHost 127.0.0.77:80>
50+ ServerName archive.vostok.dev
51+ LogLevel debug
52+
53+ DocumentRoot /var/tmp/vostok-archive
54+ <Directory /var/tmp/vostok-archive/>
55+ Order Deny,Allow
56+ Deny from all
57+ Allow from 127.0.0.0/255.0.0.0
58+ Options Indexes
59+ </Directory>
60+</VirtualHost>
61+
62+<VirtualHost 127.0.0.77:443>
63+ ServerName vostok.dev
64+ ServerAlias *.vostok.dev
65+ <Proxy *>
66+ Order deny,allow
67+ Allow from 127.0.0.0/255.0.0.0
68+ </Proxy>
69+ SSLEngine On
70+ SSLCertificateFile /etc/apache2/ssl/launchpad.crt
71+ SSLCertificateKeyFile /etc/apache2/ssl/launchpad.key
72+
73+ ProxyPreserveHost on
74+ ProxyPass / http://localhost:8086/ retry=1
75+
76+ <Location />
77+ # Insert filter
78+ SetOutputFilter DEFLATE
79+
80+ # Don't compress images
81+ SetEnvIfNoCase Request_URI \
82+ \.(?:gif|jpe?g|png)$ no-gzip dont-vary
83+
84+ # Don't gzip anything that starts /@@/ and doesn't end .js (ie images)
85+ SetEnvIfNoCase Request_URI ^/@@/ no-gzip dont-vary
86+ SetEnvIfNoCase Request_URI ^/@@/.*\.js$ !no-gzip !dont-vary
87+ </Location>
88+
89+</VirtualHost>
90+
91+<VirtualHost 127.0.0.77:80>
92+ ServerName vostok.dev
93+ ServerAlias *.vostok.dev
94+ RewriteEngine On
95+ RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
96+</VirtualHost>
97
98=== modified file 'lib/canonical/config/schema-lazr.conf'
99--- lib/canonical/config/schema-lazr.conf 2010-07-26 09:23:26 +0000
100+++ lib/canonical/config/schema-lazr.conf 2010-07-30 03:26:45 +0000
101@@ -2000,6 +2000,8 @@
102
103 [vhost.feeds]
104
105+[vhost.vostok]
106+
107
108 [windmill]
109 # The location of the windmill server debug logs. This will be written to
110
111=== modified file 'lib/canonical/launchpad/configure.zcml'
112--- lib/canonical/launchpad/configure.zcml 2010-06-04 20:59:50 +0000
113+++ lib/canonical/launchpad/configure.zcml 2010-07-30 03:26:45 +0000
114@@ -32,6 +32,7 @@
115 <include package="lp.testopenid" />
116 <include package="lp.blueprints" />
117 <include package="lp.services.comments" />
118+ <include package="lp.vostok" />
119
120 <browser:url
121 for="canonical.launchpad.interfaces.IPersonSet"
122
123=== modified file 'lib/lp/code/xmlrpc/tests/test_codehosting.py'
124--- lib/lp/code/xmlrpc/tests/test_codehosting.py 2010-07-28 04:18:53 +0000
125+++ lib/lp/code/xmlrpc/tests/test_codehosting.py 2010-07-30 03:26:45 +0000
126@@ -206,11 +206,11 @@
127 started_tuple = tuple(started.utctimetuple())
128 completed_tuple = tuple(completed.utctimetuple())
129 success = self.codehosting_api.recordSuccess(
130- 'test-recordsuccess', 'vostok', started_tuple, completed_tuple)
131+ 'test-recordsuccess', 'server-name', started_tuple, completed_tuple)
132 self.assertEqual(True, success)
133
134 activity = self.getLastActivity('test-recordsuccess')
135- self.assertEqual('vostok', activity.hostname)
136+ self.assertEqual('server-name', activity.hostname)
137 self.assertEqual(started, activity.date_started)
138 self.assertEqual(completed, activity.date_completed)
139
140
141=== added directory 'lib/lp/vostok'
142=== added file 'lib/lp/vostok/__init__.py'
143--- lib/lp/vostok/__init__.py 1970-01-01 00:00:00 +0000
144+++ lib/lp/vostok/__init__.py 2010-07-30 03:26:45 +0000
145@@ -0,0 +1,4 @@
146+# Copyright 2010 Canonical Ltd. This software is licensed under the
147+# GNU Affero General Public License version 3 (see the file LICENSE).
148+
149+"""The Linaro archive management skin."""
150
151=== added file 'lib/lp/vostok/configure.zcml'
152--- lib/lp/vostok/configure.zcml 1970-01-01 00:00:00 +0000
153+++ lib/lp/vostok/configure.zcml 2010-07-30 03:26:45 +0000
154@@ -0,0 +1,14 @@
155+<configure
156+ xmlns="http://namespaces.zope.org/zope"
157+ xmlns:browser="http://namespaces.zope.org/browser"
158+ xmlns:i18n="http://namespaces.zope.org/i18n"
159+ xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
160+ i18n_domain="launchpad">
161+
162+ <publisher
163+ name="vostok"
164+ factory="lp.vostok.publisher.vostok_request_publication_factory"
165+ methods="*"
166+ mimetypes="*" />
167+
168+</configure>
169
170=== added file 'lib/lp/vostok/publisher.py'
171--- lib/lp/vostok/publisher.py 1970-01-01 00:00:00 +0000
172+++ lib/lp/vostok/publisher.py 2010-07-30 03:26:45 +0000
173@@ -0,0 +1,37 @@
174+# Copyright 2010 Canonical Ltd. This software is licensed under the
175+# GNU Affero General Public License version 3 (see the file LICENSE).
176+
177+"""Vostok's custom publication."""
178+
179+__metaclass__ = type
180+__all__ = [
181+ 'VostokBrowserRequest',
182+ 'VostokLayer',
183+ 'vostok_request_publication_factory',
184+ ]
185+
186+
187+from zope.interface import implements
188+from zope.publisher.interfaces.browser import (
189+ IBrowserRequest, IDefaultBrowserLayer)
190+
191+from canonical.launchpad.webapp.publication import LaunchpadBrowserPublication
192+from canonical.launchpad.webapp.servers import (
193+ LaunchpadBrowserRequest, VirtualHostRequestPublicationFactory)
194+
195+
196+class VostokLayer(IBrowserRequest, IDefaultBrowserLayer):
197+ """The Vostok layer."""
198+
199+
200+class VostokBrowserRequest(LaunchpadBrowserRequest):
201+ implements(VostokLayer)
202+
203+
204+# We *might* end up customizing the root object and so need our own
205+# LaunchpadBrowserPublication subclass. Not yet though.
206+
207+
208+def vostok_request_publication_factory():
209+ return VirtualHostRequestPublicationFactory(
210+ 'vostok', VostokBrowserRequest, LaunchpadBrowserPublication)
211
212=== added directory 'lib/lp/vostok/tests'
213=== added file 'lib/lp/vostok/tests/__init__.py'
214--- lib/lp/vostok/tests/__init__.py 1970-01-01 00:00:00 +0000
215+++ lib/lp/vostok/tests/__init__.py 2010-07-30 03:26:45 +0000
216@@ -0,0 +1,4 @@
217+# Copyright 2010 Canonical Ltd. This software is licensed under the
218+# GNU Affero General Public License version 3 (see the file LICENSE).
219+
220+"""Tests for the Linaro archive management skin."""
221
222=== added file 'lib/lp/vostok/tests/test_publisher.py'
223--- lib/lp/vostok/tests/test_publisher.py 1970-01-01 00:00:00 +0000
224+++ lib/lp/vostok/tests/test_publisher.py 2010-07-30 03:26:45 +0000
225@@ -0,0 +1,33 @@
226+# Copyright 2010 Canonical Ltd. This software is licensed under the
227+# GNU Affero General Public License version 3 (see the file LICENSE).
228+
229+"""Tests for vostok's custom publications."""
230+
231+__metaclass__ = type
232+
233+import unittest
234+
235+from canonical.config import config
236+from canonical.testing.layers import FunctionalLayer
237+
238+from lp.testing import TestCase
239+from lp.testing.publication import get_request_and_publication
240+
241+from lp.vostok.publisher import VostokLayer
242+
243+
244+class TestRegistration(TestCase):
245+ """Vostok's publication customizations are installed correctly."""
246+
247+ layer = FunctionalLayer
248+
249+ def test_vostok_request_provides_vostok_layer(self):
250+ # The request constructed for requests to the vostok hostname provides
251+ # VostokLayer.
252+ request, publication = get_request_and_publication(
253+ host=config.vhost.vostok.hostname)
254+ self.assertProvides(request, VostokLayer)
255+
256+
257+def test_suite():
258+ return unittest.TestLoader().loadTestsFromName(__name__)
259
260=== modified file 'utilities/rocketfuel-setup'
261--- utilities/rocketfuel-setup 2010-02-12 15:34:28 +0000
262+++ utilities/rocketfuel-setup 2010-07-30 03:26:45 +0000
263@@ -155,6 +155,14 @@
264 echo "bazaar.launchpad.dev added to /etc/hosts"
265 fi
266
267+grep -q "^127.0.0.77" /etc/hosts
268+if [ $? -ne 0 ]; then
269+ echo "
270+127.0.0.77 vostok.dev archive.vostok.dev
271+" | sudo tee -a /etc/hosts > /dev/null
272+ echo "vostok.dev added to /etc/hosts"
273+fi
274+
275 # Enable relevant Ubuntu package repositories
276 grep -q "^deb http:.* ${DISTRIB_CODENAME} .*universe" /etc/apt/sources.list
277 if [ $? -ne 0 ]; then