Merge lp:~andreserl/maas/more_packaging_changes into lp:~maas-maintainers/maas/packaging

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: no longer in the source branch.
Merged at revision: 21
Proposed branch: lp:~andreserl/maas/more_packaging_changes
Merge into: lp:~maas-maintainers/maas/packaging
Diff against target: 320 lines (+136/-37)
16 files modified
debian/changelog (+18/-5)
debian/control (+1/-0)
debian/extras/maas (+2/-2)
debian/maas.install (+1/-0)
debian/maas.logrotate (+9/-0)
debian/maas.maas-pserv.upstart (+1/-1)
debian/maas.maas-txlongpoll.upstart (+14/-0)
debian/maas.postinst (+14/-5)
debian/maas.postrm (+15/-2)
debian/maas.prerm (+11/-0)
debian/maas.templates (+0/-12)
debian/patches/01-fix-database-settings.patch (+6/-6)
debian/patches/02-pserv-config.patch (+20/-4)
debian/patches/03-txlongpoll-config.patch (+19/-0)
debian/patches/series (+1/-0)
debian/rules (+4/-0)
To merge this branch: bzr merge lp:~andreserl/maas/more_packaging_changes
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) Approve
Review via email: mp+97538@code.launchpad.net

Commit message

Various packaging improvements that include:
 - txlongpoll packaging integration.
 - Fixes in postinst, postrm, prerm, including bug (LP: #955400)
 - Fixes to maas wrapper.
 - add a logrotate file.

To post a comment you must log in.
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

Hi Andres,

This is starting to look good!

I have few comments, but probably all things that can be fixed in the next
iteration.

[1]

81 === renamed file 'debian/maas.upstart' => 'debian/maas.maas-pserv.upstart'
82 --- debian/maas.upstart 2012-03-13 18:16:33 +0000
83 +++ debian/maas.maas-pserv.upstart 2012-03-14 23:33:18 +0000
84 @@ -11,4 +11,4 @@
85 respawn
86
87 # To add options to your daemon, edit the line below:
88 -exec /usr/bin/twistd -n maas-pserv --config-file=/etc/maas/pserv.yaml
89 +exec /usr/bin/twistd -n --pidfile=/run/maas-pserv.pid --logfile=/var/log/maas/maas-pserv.log maas-pserv --config-file=/etc/maas/pserv.yaml

We can configure that one like the txlongpoll one. Use --logfile=/dev/null and
set the log file in the configuration file.

We should probably not run this service as root. Daviey suggested running the
txlongpoll, pserv and maas as a maas user. (That means also going to
WSGIDaemonProcess for the apache config.)

[2]

91 === added file 'debian/maas.maas-txlongpoll.upstart'
92 --- debian/maas.maas-txlongpoll.upstart 1970-01-01 00:00:00 +0000
93 +++ debian/maas.maas-txlongpoll.upstart 2012-03-14 23:33:18 +0000
94 @@ -0,0 +1,14 @@
95 +# maas - txlongpoll service
96 +#
97 +# MaaS Provisioning Service txlongpoll
98 +
99 +description "MaaS"
100 +author "Andres Rodriguez <email address hidden>"
101 +
102 +start on filesystem and net-device-up
103 +stop on runlevel [016]
104 +
105 +respawn
106 +
107 +# To add options to your daemon, edit the line below:
108 +exec /usr/bin/twistd -n --pidfile=/run/maas-txlongpoll.pid --logfile=/dev/null txlongpoll --config-file=/etc/maas/txlongpoll.yaml

Same comment about running this as the maas user.

[3]

133 + if [ ! -f /var/log/maas/maas.log ]; then
134 + touch /var/log/maas/maas.log
135 + chown -R root:www-data /var/log/maas
136 + chmod 620 /var/log/maas/maas.log
137 + chmod -R 775 /var/log/maas/oops
138 fi

The permission and ownership on /var/log/maas/oops should probably be set
regardless of the existence of maas.log

Can't those be set by the packaging info?

[4]

We probably want logrotate configs for both the pserv and txlongpoll log
files. They do support log reopening on a USR1 signal.

Cheers

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-03-13 18:35:01 +0000
3+++ debian/changelog 2012-03-14 23:33:18 +0000
4@@ -1,8 +1,21 @@
5-maas (0.1+bzr266+dfsg-0ubuntu2) UNRELEASED; urgency=low
6-
7- * UNRELEASED
8-
9- -- Andres Rodriguez <andreserl@ubuntu.com> Tue, 13 Mar 2012 14:34:41 -0400
10+maas (0.1+bzr283+dfsg-0ubuntu1) UNRELEASED; urgency=low
11+
12+ * debian/maas.upstart: Specify pidfile and conffile.
13+ * debian/maas.postinst:
14+ - Only run syncdb if dbconfig postinst file exists.
15+ - Fix file permissions.
16+ * debian/maas.{postrm,prerm}: Add dbconfig-common support.
17+ * Add txlongpoll support for packaging:
18+ - debian/control: Depends on python-txlongpoll.
19+ - debian/maas.maas-longpoll.upstart: Added to start txlongpoll.
20+ - debian/maas.install: Install txlongpoll.yaml
21+ * debian/extras/maas: Improvements.
22+ * debian/maas.maas.upstart: Moved from debian/maas.upstart.
23+ * debian/maas.postinst: Touch logfile to set correct permissions (LP: #955400)
24+ * debian/maas.logrotate: Add.
25+ * debian/patches/03-txlongpoll-config.patch: Add default settings.
26+
27+ -- Andres Rodriguez <andreserl@ubuntu.com> Wed, 14 Mar 2012 18:27:31 -0400
28
29 maas (0.1+bzr266+dfsg-0ubuntu1) precise; urgency=low
30
31
32=== modified file 'debian/control'
33--- debian/control 2012-03-13 18:16:33 +0000
34+++ debian/control 2012-03-14 23:33:18 +0000
35@@ -40,6 +40,7 @@
36 python-sphinx,
37 python-twisted,
38 python-txamqp,
39+ python-txlongpoll,
40 python-zope.interface
41 Description: The next step in the development of Orchestra.
42 It provides an easy to use UI to provision your Ubuntu servers.
43
44=== modified file 'debian/extras/maas'
45--- debian/extras/maas 2012-03-09 22:55:04 +0000
46+++ debian/extras/maas 2012-03-14 23:33:18 +0000
47@@ -1,4 +1,4 @@
48 #!/bin/bash -eu
49-export PYTHONPATH="/usr/share/maas${PYTHONPATH:+}${PYTHONPATH:-}"
50+export PYTHONPATH="/usr/share/maas${PYTHONPATH:+:}${PYTHONPATH:-}"
51 export DJANGO_SETTINGS_MODULE="maas.settings"
52-exec /usr/bin/django-admin $@
53+exec /usr/bin/django-admin "$@"
54
55=== modified file 'debian/maas.install'
56--- debian/maas.install 2012-03-13 18:16:33 +0000
57+++ debian/maas.install 2012-03-14 23:33:18 +0000
58@@ -2,6 +2,7 @@
59 debian/tmp/usr/lib/python*/dist-packages/maas usr/share/maas
60 twisted/plugins/maasps.py usr/share/pyshared/twisted/plugins
61 etc/pserv.yaml etc/maas
62+etc/txlongpoll.yaml etc/maas
63
64 # Install static files
65 debian/tmp/usr/share/maas/web/static
66
67=== added file 'debian/maas.logrotate'
68--- debian/maas.logrotate 1970-01-01 00:00:00 +0000
69+++ debian/maas.logrotate 2012-03-14 23:33:18 +0000
70@@ -0,0 +1,9 @@
71+/var/log/maas/maas.log {
72+ rotate 5
73+ weekly
74+ compress
75+ copytruncate
76+ missingok
77+ #create 620 root www-data
78+}
79+
80
81=== renamed file 'debian/maas.upstart' => 'debian/maas.maas-pserv.upstart'
82--- debian/maas.upstart 2012-03-13 18:16:33 +0000
83+++ debian/maas.maas-pserv.upstart 2012-03-14 23:33:18 +0000
84@@ -11,4 +11,4 @@
85 respawn
86
87 # To add options to your daemon, edit the line below:
88-exec /usr/bin/twistd -n maas-pserv --config-file=/etc/maas/pserv.yaml
89+exec /usr/bin/twistd -n --pidfile=/run/maas-pserv.pid --logfile=/var/log/maas/maas-pserv.log maas-pserv --config-file=/etc/maas/pserv.yaml
90
91=== added file 'debian/maas.maas-txlongpoll.upstart'
92--- debian/maas.maas-txlongpoll.upstart 1970-01-01 00:00:00 +0000
93+++ debian/maas.maas-txlongpoll.upstart 2012-03-14 23:33:18 +0000
94@@ -0,0 +1,14 @@
95+# maas - txlongpoll service
96+#
97+# MaaS Provisioning Service txlongpoll
98+
99+description "MaaS"
100+author "Andres Rodriguez <andres.rodriguez@canonical.com>"
101+
102+start on filesystem and net-device-up
103+stop on runlevel [016]
104+
105+respawn
106+
107+# To add options to your daemon, edit the line below:
108+exec /usr/bin/twistd -n --pidfile=/run/maas-txlongpoll.pid --logfile=/dev/null txlongpoll --config-file=/etc/maas/txlongpoll.yaml
109
110=== modified file 'debian/maas.postinst'
111--- debian/maas.postinst 2012-03-13 18:16:33 +0000
112+++ debian/maas.postinst 2012-03-14 23:33:18 +0000
113@@ -3,7 +3,12 @@
114 . /usr/share/debconf/confmodule
115 db_version 2.0
116
117-. /usr/share/dbconfig-common/dpkg/postinst.pgsql
118+sync_db=true
119+if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then
120+ . /usr/share/dbconfig-common/dpkg/postinst.pgsql
121+else
122+ sync_db=false
123+fi
124
125 if ([ "$1" = "configure" ] && [ -z "$2" ]) || [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
126
127@@ -28,8 +33,11 @@
128 fi
129
130 # Give appropriate permissions
131- if [ -f /var/log/maas/maas.log ]; then
132- chown www-data:www-data /var/log/maas/maas.log
133+ if [ ! -f /var/log/maas/maas.log ]; then
134+ touch /var/log/maas/maas.log
135+ chown -R root:www-data /var/log/maas
136+ chmod 620 /var/log/maas/maas.log
137+ chmod -R 775 /var/log/maas/oops
138 fi
139
140 # Configure database
141@@ -38,8 +46,9 @@
142 sed -i "s/^\ \{1,\} 'PASSWORD': '[a-zA-Z0-9]\{0,\}',$/ 'PASSWORD': '"$dbc_dbpass"',/" \
143 /usr/share/maas/maas_local_settings.py
144 fi
145-
146- maas syncdb --noinput
147+ if $syncdb; then
148+ maas syncdb --noinput
149+ fi
150 fi
151
152 #DEBHELPER#
153
154=== modified file 'debian/maas.postrm'
155--- debian/maas.postrm 2012-03-13 18:16:33 +0000
156+++ debian/maas.postrm 2012-03-14 23:33:18 +0000
157@@ -3,8 +3,21 @@
158 set -e
159
160 . /usr/share/debconf/confmodule
161-. /usr/share/dbconfig-common/dpkg/postrm.pgsql
162-dbc_go maas $@
163+
164+if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
165+ . /usr/share/dbconfig-common/dpkg/postrm.pgsql
166+ dbc_go maas $@
167+fi
168+
169+case "$1" in
170+ purge)
171+ rm -rf /var/log/maas
172+ if [ -h /etc/apache2/conf.d/maas-http.conf ]; then
173+ rm -rf /etc/apache2/conf.d/maas-http.conf
174+ fi
175+
176+esac
177
178 #DEBHELPER#
179
180+exit 0
181
182=== added file 'debian/maas.prerm'
183--- debian/maas.prerm 1970-01-01 00:00:00 +0000
184+++ debian/maas.prerm 2012-03-14 23:33:18 +0000
185@@ -0,0 +1,11 @@
186+#!/bin/sh
187+
188+set -e
189+
190+. /usr/share/debconf/confmodule
191+. /usr/share/dbconfig-common/dpkg/prerm.pgsql
192+dbc_go maas $@
193+
194+#DEBHELPER#
195+
196+exit 0
197
198=== removed file 'debian/maas.templates'
199--- debian/maas.templates 2012-03-09 22:55:04 +0000
200+++ debian/maas.templates 1970-01-01 00:00:00 +0000
201@@ -1,12 +0,0 @@
202-Template: maas/maas_admin_user
203-Type: string
204-Default: admin
205-_Description: Create administrator username for MaaS:
206- MaaS requires to set an administrative user in order to
207- be able to gain access to the MaaS management WebUI.
208-
209-Template: maas/maas_admin_pass
210-Type: password
211-_Description: Set password for the administrator username:
212- It is highly recommendaed that you set a password for the
213- administrative user that has just been created.
214
215=== modified file 'debian/patches/01-fix-database-settings.patch'
216--- debian/patches/01-fix-database-settings.patch 2012-03-13 18:16:33 +0000
217+++ debian/patches/01-fix-database-settings.patch 2012-03-14 23:33:18 +0000
218@@ -1,9 +1,9 @@
219-Index: maas-0.1+bzr259+dfsg.orig/contrib/maas_local_settings_sample.py
220+Index: maas-0.1+bzr281+dfsg.orig/contrib/maas_local_settings_sample.py
221 ===================================================================
222---- maas-0.1+bzr259+dfsg.orig.orig/contrib/maas_local_settings_sample.py 2012-03-13 10:38:48.251620276 -0400
223-+++ maas-0.1+bzr259+dfsg.orig/contrib/maas_local_settings_sample.py 2012-03-13 10:39:05.362341275 -0400
224-@@ -2,7 +2,7 @@
225- DEBUG = False
226+--- maas-0.1+bzr281+dfsg.orig.orig/contrib/maas_local_settings_sample.py 2012-03-14 14:29:12.145287076 -0400
227++++ maas-0.1+bzr281+dfsg.orig/contrib/maas_local_settings_sample.py 2012-03-14 14:29:16.421288467 -0400
228+@@ -7,7 +7,7 @@
229+ DEFAULT_MAAS_URL = "http://maas.internal.example.com/"
230
231 # Absolute path to the directory static files should be collected to.
232 -STATIC_ROOT = '/var/lib/maas/static/'
233@@ -11,7 +11,7 @@
234
235 # Prefix to use for MaaS's urls.
236 # If FORCE_SCRIPT_NAME is None (the default), all the urls will start with
237-@@ -51,9 +51,9 @@
238+@@ -56,9 +56,9 @@
239 'default': {
240 # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' etc.
241 'ENGINE': 'django.db.backends.postgresql_psycopg2',
242
243=== modified file 'debian/patches/02-pserv-config.patch'
244--- debian/patches/02-pserv-config.patch 2012-03-13 18:16:33 +0000
245+++ debian/patches/02-pserv-config.patch 2012-03-14 23:33:18 +0000
246@@ -1,8 +1,24 @@
247-Index: maas-0.1+bzr259+dfsg.orig/etc/pserv.yaml
248+Index: maas-0.1+bzr283+dfsg.orig/etc/pserv.yaml
249 ===================================================================
250---- maas-0.1+bzr259+dfsg.orig.orig/etc/pserv.yaml 2012-03-13 00:56:24.000000000 -0400
251-+++ maas-0.1+bzr259+dfsg.orig/etc/pserv.yaml 2012-03-13 10:38:19.502618329 -0400
252-@@ -35,6 +35,6 @@
253+--- maas-0.1+bzr283+dfsg.orig.orig/etc/pserv.yaml 2012-03-14 17:20:20.000000000 -0400
254++++ maas-0.1+bzr283+dfsg.orig/etc/pserv.yaml 2012-03-14 17:32:54.883813955 -0400
255+@@ -10,13 +10,13 @@
256+ ## running server.
257+ #
258+ # logfile: "pserv.log"
259+-logfile: "logs/pserv.log"
260++logfile: "/var/log/maas/pserv.log"
261+
262+ ## OOPS configuration (optional).
263+ #
264+ oops:
265+ # directory:
266+- directory: "logs"
267++ directory: "/var/log/maas/oops"
268+ # reporter:
269+ reporter: "maas-pserv"
270+
271+@@ -38,6 +38,6 @@
272 # password: "test"
273
274 # vdenv specific; see vdenv/README.txt.
275
276=== added file 'debian/patches/03-txlongpoll-config.patch'
277--- debian/patches/03-txlongpoll-config.patch 1970-01-01 00:00:00 +0000
278+++ debian/patches/03-txlongpoll-config.patch 2012-03-14 23:33:18 +0000
279@@ -0,0 +1,19 @@
280+Index: maas-0.1+bzr283+dfsg.orig/etc/txlongpoll.yaml
281+===================================================================
282+--- maas-0.1+bzr283+dfsg.orig.orig/etc/txlongpoll.yaml 2012-03-14 17:07:57.000000000 -0400
283++++ maas-0.1+bzr283+dfsg.orig/etc/txlongpoll.yaml 2012-03-14 17:34:05.767900696 -0400
284+@@ -15,7 +15,7 @@
285+ oops:
286+ ## Directory in which to place OOPS reports.
287+ # directory: ""
288+- directory: "logs"
289++ directory: "/var/log/maas/oops"
290+ ## The reporter used when generating OOPS reports.
291+ # reporter: "LONGPOLL"
292+ reporter: "maas-txlongpoll"
293+@@ -33,4 +33,4 @@
294+ ## running server.
295+ #
296+ # logfile: "txlongpoll.log"
297+-logfile: "logs/txlongpoll.log"
298++logfile: "/var/log/maas/txlongpoll.log"
299
300=== modified file 'debian/patches/series'
301--- debian/patches/series 2012-03-13 18:16:33 +0000
302+++ debian/patches/series 2012-03-14 23:33:18 +0000
303@@ -1,2 +1,3 @@
304 01-fix-database-settings.patch
305 02-pserv-config.patch
306+03-txlongpoll-config.patch
307
308=== modified file 'debian/rules'
309--- debian/rules 2012-03-13 18:16:33 +0000
310+++ debian/rules 2012-03-14 23:33:18 +0000
311@@ -3,6 +3,10 @@
312 %:
313 dh $@ --with python2 --buildsystem=python_distutils
314
315+override_dh_installinit:
316+ dh_installinit --name maas-pserv
317+ dh_installinit --name maas-txlongpoll
318+
319 override_dh_auto_install:
320 dh_auto_install
321

Subscribers

People subscribed via source and target branches

to all changes: