Merge lp:~cjohnston/charms/quantal/workitems-tracker/trunk into lp:~clint-fewbar/charms/quantal/workitems-tracker/trunk

Proposed by Chris Johnston
Status: Needs review
Proposed branch: lp:~cjohnston/charms/quantal/workitems-tracker/trunk
Merge into: lp:~clint-fewbar/charms/quantal/workitems-tracker/trunk
Diff against target: 209 lines (+91/-52)
3 files modified
config.yaml (+22/-12)
hooks/config-changed (+68/-39)
hooks/install (+1/-1)
To merge this branch: bzr merge lp:~cjohnston/charms/quantal/workitems-tracker/trunk
Reviewer Review Type Date Requested Status
Clint Byrum Pending
Review via email: mp+139295@code.launchpad.net
To post a comment you must log in.
22. By Chris Johnston

work on vhost

23. By Chris Johnston

Add more vhost info

24. By Chris Johnston

Adds apache-openid required files

25. By Chris Johnston

removes hard coding

26. By Chris Johnston

Adding descriptions

27. By Chris Johnston

Fixes vhost info

28. By Chris Johnston

Remove stray get_team_content

Unmerged revisions

28. By Chris Johnston

Remove stray get_team_content

27. By Chris Johnston

Fixes vhost info

26. By Chris Johnston

Adding descriptions

25. By Chris Johnston

removes hard coding

24. By Chris Johnston

Adds apache-openid required files

23. By Chris Johnston

Add more vhost info

22. By Chris Johnston

work on vhost

21. By Chris Johnston

Removing django

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2012-11-22 01:38:55 +0000
3+++ config.yaml 2012-12-14 22:19:20 +0000
4@@ -22,27 +22,37 @@
5 type: string
6 default: http://bazaar.launchpad.net/~wi-tracker-configurators/launchpad-work-items-tracker/ubuntu-config
7 description: Pull configs from this branch.
8- team-content-bzr-branch:
9- type: string
10- default: http://bazaar.launchpad.net/~clint-fewbar/+junk/team-content
11- description: Where to pull the team-content django app for keeping content private.
12- team-content-admin-user:
13- type: string
14- default: admin
15- description: User to create as a super user for setting up groups in team-content.
16- team-content-admin-email:
17- type: string
18- default: nowhere@devnull.foo
19- description: email to attach to the admin user.
20 config-relative-path:
21 type: string
22 default: config/ubuntu-_devfocus_.cfg
23+ config-file-name:
24+ type: string
25+ default: ubuntu-_devfocus_
26+ description: |
27+ The name of the config file, which will also turn into the end of the URL to access the site, without the
28+ filename extension.
29+ private-team:
30+ type: string
31+ default: ''
32+ description: |
33+ Team(s) that will be authorized to login to the private instance.
34+ sso-provider:
35+ type: string
36+ default: Ubuntu=login.ubuntu.com
37+ description: |
38+ This is the SSO provider that will be used for authentication when
39+ private is set to true.
40 project:
41 type: string
42 default: ubuntu
43 description: |
44 Project/Distro to use to determine _devfocus_. Ignored if
45 _devfocus_ is not in use.
46+ base-url:
47+ type: string
48+ default: status.ubuntu.com/
49+ description: |
50+ The base URL of the site with the "http://" or the trailing "/".
51 minute-interval:
52 type: string
53 default: '0'
54
55=== modified file 'hooks/config-changed'
56--- hooks/config-changed 2012-11-30 00:05:02 +0000
57+++ hooks/config-changed 2012-12-14 22:19:20 +0000
58@@ -6,18 +6,37 @@
59
60 setup_apache() {
61 local private=$(config-get private --format=json)
62+ local private_team=$(config-get private-team)
63+ local base_url=$(config-get base-url)
64+ local file_name=$(config-get config-file-name)
65 local port=""
66+ local sso=$(config-get sso-provider)
67 a2dissite default
68 if [ "$private" = "false" ] ; then
69 a2dissite default-ssl
70 a2dismod ssl
71 cat > /etc/apache2/sites-available/witrack <<EOF
72 <VirtualHost *:80>
73- DocumentRoot $DOCROOT
74+ ServerName ${base_url}
75+ ServerAdmin admins@admin.canonical.com
76+
77+ DocumentRoot ${RUNAS_HOME}
78+ RedirectMatch ^/$ http://${base_url}${file_name}/
79+ <Directory />
80+ Options FollowSymLinks
81+ AllowOverride None
82+ </Directory>
83+ <Directory ${RUNAS_HOME}>
84+ Options Indexes FollowSymLinks MultiViews
85+ AllowOverride None
86+ Order allow,deny
87+ allow from all
88+ </Directory>
89+ LogLevel warn
90+ CustomLog /var/log/apache2/${base_url}access.log combined
91+ ErrorLog /var/log/apache2/${base_url}-error.log
92+
93 </VirtualHost>
94-<Directory $DOCROOT>
95- Options +Indexes
96-</Directory>
97 EOF
98 port=80
99 close_port=443
100@@ -25,15 +44,51 @@
101 a2ensite default-ssl
102 a2enmod ssl
103 cat > /etc/apache2/sites-available/witrack <<EOF
104-Alias /static/ "${RUNAS_HOME}/static/"
105-<Directory "${RUNAS_HOME}/static">
106-Order allow,deny
107-Options Indexes
108-Allow from all
109-IndexOptions FancyIndexing
110-</Directory>
111-
112-WSGIScriptAlias / $RUNAS_HOME/team_content/team_content.wsgi
113+<VirtualHost *:443>
114+ ServerName ${base_url}
115+ ServerAdmin admins@admin.canonical.com
116+
117+ DocumentRoot ${RUNAS_HOME}
118+ RedirectMatch ^/$ https://${base_url}${file_name}/
119+ <Location "/">
120+ PythonAccessHandler apache_openid::protect
121+ PythonOption handler openidteams
122+ PythonOption authorized-teams-list-url "file:///etc/apache2/security/canonical.txt"
123+ PythonOption action-path "/openid/" ###NOT SURE WHAT THIS IS
124+ </Location>
125+
126+ <Location "/openid/">
127+ Allow from All
128+ SetHandler mod_python
129+ PythonOption handler openidteams
130+ PythonOption store-type file
131+ PythonOption store-directory /var/cache/apache2/openid/
132+ PythonOption allowed-op-list-url "file:///etc/apache2/security/allowed-ops.txt" ###NEED A FILE
133+ PythonOption authorized-teams-list-url "file:///etc/apache2/security/canonical.txt" ###NEED A FILE
134+ PythonOption action-path "/openid/"
135+ </Location>
136+
137+ <Directory />
138+ Options FollowSymLinks
139+ AllowOverride None
140+ </Directory>
141+ <Directory ${RUNAS_HOME}>
142+ Options Indexes FollowSymLinks MultiViews
143+ AllowOverride None
144+ Order allow,deny
145+ allow from all
146+ </Directory>
147+
148+ LogLevel warn
149+ CustomLog /var/log/apache2/${base_url}access.log combined
150+ ErrorLog /var/log/apache2/${base_url}-error.log
151+</VirtualHost>
152+EOF
153+ cat > /etc/apache2/security/canonical.txt <<EOF
154+${private_team}
155+EOF
156+ cat > /etc/apache2/security/allowed-ops.txt <<EOF
157+${sso}
158 EOF
159 port=443
160 close_port=80
161@@ -112,31 +167,6 @@
162 get_branch $config_bzr_branch configs
163 }
164
165-get_team_content() {
166- local tc_bzr_branch=$(config-get team-content-bzr-branch)
167- local admin_user=$(config-get team-content-admin-user)
168- local admin_email=$(config-get team-content-admin-email)
169- get_branch $tc_bzr_branch team_content
170- pushd team_content
171- # Generate a production settings from the dev ones
172- sed -i -e "s,protected_content,$RUNAS_HOME/public_html,g" team_content/settings.py
173- sed -i -e 's,DEBUG =.*,DEBUG = False,g' team_content/settings.py
174- sed -i -e "s,STATIC_ROOT =.*,STATIC_ROOT = '${RUNAS_HOME}/static',g" team_content/settings.py
175- mkdir -p $RUNAS_HOME/static
176- chgrp www-data $RUNAS_HOME/static
177- export DJANGO_SETTINGS_MODULE=team_content.settings
178- ./manage.py syncdb --noinput
179- ./manage.py collectstatic --noinput
180- # This feels a bit hacky but umask failed
181- chmod 0660 ../db/team_content.sqlite3
182- # XXX Should probably do more to see if the user exists, but
183- # for now, || : works too.
184- ./manage.py createsuperuser --username=$admin_user \
185- --email=$admin_email \
186- --noinput || :
187- popd
188-}
189-
190 # Uses a hash of the url to avoid re-pulling
191 get_branch() {
192 local bzr_loc=$1
193@@ -163,7 +193,6 @@
194
195 get_witrack
196 get_configs
197-get_team_content
198
199 set_project_config() {
200 local cfg_rpath=$(config-get config-relative-path)
201
202=== modified file 'hooks/install'
203--- hooks/install 2012-11-22 01:38:55 +0000
204+++ hooks/install 2012-12-14 22:19:20 +0000
205@@ -1,3 +1,3 @@
206 #!/bin/bash
207
208-exec apt-get install --no-install-recommends -y bzr uuid apache2-mpm-event apache2 sqlite3 python-simplejson python-launchpadlib python-pychart python-testtools python-storm python-mako postfix bsd-mailx libapache2-mod-wsgi python-django python-django-openid-auth
209+exec apt-get install --no-install-recommends -y bzr uuid apache2-mpm-event apache2 sqlite3 python-simplejson python-launchpadlib python-pychart python-testtools python-storm python-mako postfix bsd-mailx apache-openid

Subscribers

People subscribed via source and target branches

to all changes: