Merge lp:~patrick-hetu/charms/oneiric/python-moinmoin/trunk into lp:charms/python-moinmoin

Proposed by Patrick Hetu on 2012-05-23
Status: Rejected
Rejected by: Jorge Castro on 2014-08-20
Proposed branch: lp:~patrick-hetu/charms/oneiric/python-moinmoin/trunk
Merge into: lp:charms/python-moinmoin
Diff against target: 201 lines (+35/-59)
9 files modified
hooks/config-changed (+6/-2)
hooks/install (+7/-43)
hooks/start (+0/-4)
hooks/stop (+0/-7)
hooks/upgrade-charm (+10/-0)
hooks/website-relation-joined (+0/-2)
hooks/wsgi-relation-joined (+7/-0)
metadata.yaml (+4/-0)
revision (+1/-1)
To merge this branch: bzr merge lp:~patrick-hetu/charms/oneiric/python-moinmoin/trunk
Reviewer Review Type Date Requested Status
Clint Byrum (community) 2012-05-23 Needs Fixing on 2012-05-23
Review via email: mp+107072@code.launchpad.net

Description of the change

upgrade-charm hook + maintainer field

To post a comment you must log in.
Clint Byrum (clint-fewbar) wrote :

Hi Patrick!

The boolean field requires that you use boolean values in metadata.yaml.

I'd recommend against using it until we add a new "format" key and then we'll have 'config-get --test boolean-field-name' so that you can test true/false rather than interpreting the string.

Anyway, your charm won't deploy:

2012-05-23 13:49:52,388 WARNING Charm 'python-moinmoin' has an error: ServiceConfigValueError("Invalid value for xapian_search: 'true'",) Invalid value for xapian_search: 'true'

Please change it back to string, or remove the quotes around "true" and check all usage of the config field to make sure they will operate properly by interpreting it as *json* not 'True' or 'False' literally.

review: Needs Fixing
Clint Byrum (clint-fewbar) wrote :

Also please change the merge proposal back to 'Needs Review' when you've fixed the issues.

Patrick Hetu (patrick-hetu) wrote :

I've changed back the xapian_search variable type to a string. I also added the a wsgi container interface.

23. By Patrick Hetu on 2012-06-14

Add a trigger to reload the wsgi server

24. By Patrick Hetu on 2012-07-08

remove website relation since it moves to the wsgi providers

25. By Patrick Hetu on 2012-07-08

Move the website relation back in the charm

26. By Patrick Hetu on 2012-07-08

remove unneeded start and stop hooks

27. By Patrick Hetu on 2012-07-08

be sure to use set -e and bash in all hooks

28. By Patrick Hetu on 2012-07-08

fix wsgi relation name

29. By Patrick Hetu on 2012-07-08

make install hook more idempotent

30. By Patrick Hetu on 2012-07-09

grep for the port in website relations

31. By Patrick Hetu on 2012-07-09

fix the regex and quote what we found

32. By Patrick Hetu on 2012-07-09

use the right relation name for the wsgi container

33. By Patrick Hetu on 2012-07-09

don't failed if gunicorn his not configure yet

Unmerged revisions

33. By Patrick Hetu on 2012-07-09

don't failed if gunicorn his not configure yet

32. By Patrick Hetu on 2012-07-09

use the right relation name for the wsgi container

31. By Patrick Hetu on 2012-07-09

fix the regex and quote what we found

30. By Patrick Hetu on 2012-07-09

grep for the port in website relations

29. By Patrick Hetu on 2012-07-08

make install hook more idempotent

28. By Patrick Hetu on 2012-07-08

fix wsgi relation name

27. By Patrick Hetu on 2012-07-08

be sure to use set -e and bash in all hooks

26. By Patrick Hetu on 2012-07-08

remove unneeded start and stop hooks

25. By Patrick Hetu on 2012-07-08

Move the website relation back in the charm

24. By Patrick Hetu on 2012-07-08

remove website relation since it moves to the wsgi providers

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/config-changed'
2--- hooks/config-changed 2012-03-02 01:00:47 +0000
3+++ hooks/config-changed 2012-07-09 04:27:20 +0000
4@@ -1,4 +1,5 @@
5 #!/bin/bash
6+set -e
7
8 UNIT_NAME=`echo $JUJU_UNIT_NAME | cut -d/ -f1`
9
10@@ -62,5 +63,8 @@
11 chown root:www-data /srv/${UNIT_NAME}/ -R
12 chmod g+rw /srv/${UNIT_NAME}/ -R
13
14-/etc/init.d/gunicorn start
15-/etc/init.d/gunicorn restart
16+# Trigger the server reload on the WSGI server
17+for relid in `relation-ids wsgi-file` ; do
18+ relation-set -r $relid wsgi_timestamp=`date +%s`
19+done
20+
21
22=== modified file 'hooks/install'
23--- hooks/install 2012-03-01 21:25:58 +0000
24+++ hooks/install 2012-07-09 04:27:20 +0000
25@@ -1,4 +1,5 @@
26 #!/bin/bash
27+set -e
28
29 UNIT_NAME=`echo $JUJU_UNIT_NAME | cut -d/ -f1`
30
31@@ -7,17 +8,19 @@
32
33 # --no-install-recommends and not fckeditor: because we don't want apache2 here.
34
35-apt-get install --no-install-recommends -y python-moinmoin python-flup gunicorn python-eventlet unzip python-openid python-xapian python-xappy python-docutils
36+apt-get install --no-install-recommends -y python-moinmoin unzip python-openid python-xapian python-xappy python-docutils
37
38 # MoinMoin's command line script 'moin' check there first
39 # and we don't want that
40-rm /etc/moin/farmconfig.py
41+rm /etc/moin/farmconfig.py || true
42
43 mkdir -p /srv/${UNIT_NAME}/run
44 mkdir -p /srv/${UNIT_NAME}/logs
45
46-cp -r /usr/share/moin/data /usr/share/moin/underlay /srv/${UNIT_NAME}/
47-cp -r /usr/share/moin/htdocs /srv/${UNIT_NAME}/moin_static
48+if [ ! -e /srv/${UNIT_NAME}/data ]; then
49+ cp -r /usr/share/moin/data /usr/share/moin/underlay /srv/${UNIT_NAME}/
50+ cp -r /usr/share/moin/htdocs /srv/${UNIT_NAME}/moin_static
51+fi
52
53 cat > /srv/${UNIT_NAME}/wsgi.py << EOF
54 import sys
55@@ -66,42 +69,3 @@
56 class=logging.Formatter
57 EOF
58
59-# find a free port from 80
60-# FIXME: but what about closed services?
61-
62-PORT=8080
63-quit=0
64-
65-while [ "$quit" -ne 1 ]; do
66- netstat -na | grep 'tcp' | grep 'LISTEN' | awk '{print $4}' | cut -d: -f2 | grep $PORT >> /dev/null
67- if [ $? -ne 0 ]
68- then
69- quit=1
70- else
71- PORT=`expr $PORT + 1`
72- fi
73-done
74-
75-cat > /etc/gunicorn.d/${UNIT_NAME}.conf <<EOF
76-CONFIG = {
77- 'mode': 'wsgi',
78- 'environment': {
79- 'PYTHONPATH': '/srv/${UNIT_NAME}/',
80- },
81- 'working_dir': '/srv/${UNIT_NAME}/',
82- 'user': 'www-data',
83- 'group': 'www-data',
84- 'args': (
85- '--name=${UNIT_NAME}_wiki',
86- '--worker-class=eventlet',
87- '--bind=0.0.0.0:${PORT}',
88- '--workers=2',
89- '--log-file=/srv/${UNIT_NAME}/logs/gunicorn.log',
90- '--timeout=300',
91- 'wsgi',
92- ),
93-}
94-EOF
95-
96-
97-open-port $PORT/tcp
98
99=== removed file 'hooks/start'
100--- hooks/start 2011-11-01 20:33:21 +0000
101+++ hooks/start 1970-01-01 00:00:00 +0000
102@@ -1,4 +0,0 @@
103-#!/bin/bash
104-# Here put anything that is needed to start the service.
105-# Note that currently this is run directly after install
106-# i.e. 'service apache2 start'
107
108=== removed file 'hooks/stop'
109--- hooks/stop 2011-11-01 20:33:21 +0000
110+++ hooks/stop 1970-01-01 00:00:00 +0000
111@@ -1,7 +0,0 @@
112-#!/bin/bash
113-# This will be run when the service is being torn down, allowing you to disable
114-# it in various ways..
115-# For example, if your web app uses a text file to signal to the load balancer
116-# that it is live... you could remove it and sleep for a bit to allow the load
117-# balancer to stop sending traffic.
118-# rm /srv/webroot/server-live.txt && sleep 30
119
120=== added file 'hooks/upgrade-charm'
121--- hooks/upgrade-charm 1970-01-01 00:00:00 +0000
122+++ hooks/upgrade-charm 2012-07-09 04:27:20 +0000
123@@ -0,0 +1,10 @@
124+#!/bin/bash
125+set -e
126+
127+home=`dirname $0`
128+
129+juju-log "Upgrading charm by running install hook again."
130+$home/install
131+
132+juju-log "Upgrading charm, running config-changed hook again."
133+$home/config-changed
134
135=== added symlink 'hooks/website-relation-changed'
136=== target is u'website-relation-joined'
137=== added file 'hooks/website-relation-joined'
138--- hooks/website-relation-joined 1970-01-01 00:00:00 +0000
139+++ hooks/website-relation-joined 2012-07-09 04:27:20 +0000
140@@ -0,0 +1,14 @@
141+#!/bin/bash
142+set -e
143+
144+unit_name=${JUJU_UNIT_NAME//\//-}
145+
146+if [ -e /etc/gunicorn.d/${unit_name}.conf ]; then
147+
148+ bind_line=$(grep "bind=0.0.0.0:" /etc/gunicorn.d/${unit_name}.conf)
149+ PORT=$(echo ${bind_line} | grep -o ":[0-9]*" | sed -e "s/://")
150+
151+ juju-log "PORT=${PORT}"
152+
153+ relation-set port="${PORT}" hostname=`unit-get private-address`
154+fi
155
156=== removed file 'hooks/website-relation-joined'
157--- hooks/website-relation-joined 2011-11-01 20:33:21 +0000
158+++ hooks/website-relation-joined 1970-01-01 00:00:00 +0000
159@@ -1,2 +0,0 @@
160-#!/bin/sh
161-relation-set port=80 hostname=`hostname -f`
162
163=== added symlink 'hooks/wsgi-relation-changed'
164=== target is u'wsgi-relation-joined'
165=== added file 'hooks/wsgi-relation-joined'
166--- hooks/wsgi-relation-joined 1970-01-01 00:00:00 +0000
167+++ hooks/wsgi-relation-joined 2012-07-09 04:27:20 +0000
168@@ -0,0 +1,7 @@
169+#!/bin/bash
170+set -e
171+
172+UNIT_NAME=`echo $JUJU_UNIT_NAME | cut -d/ -f1`
173+
174+relation-set working_dir="/srv/${UNIT_NAME}/"
175+relation-set wsgi_file="wsgi"
176
177=== modified file 'metadata.yaml'
178--- metadata.yaml 2011-11-01 20:33:21 +0000
179+++ metadata.yaml 2012-07-09 04:27:20 +0000
180@@ -1,10 +1,14 @@
181 name: python-moinmoin
182 summary: Python clone of WikiWiki - library
183+maintainer: Patrick Hetu <patrick.hetu@gmail.com>
184 description: |
185 A WikiWikiWeb is a collaborative hypertext environment, with an emphasis
186 on easy access to and modification of information. MoinMoin is a
187 Python WikiClone that allows you to easily set up your own wiki, only
188 requiring a Web server and a Python installation.
189 provides:
190+ wsgi:
191+ interface: wsgi
192+ scope: container
193 website:
194 interface: http
195
196=== modified file 'revision'
197--- revision 2012-03-01 17:26:32 +0000
198+++ revision 2012-07-09 04:27:20 +0000
199@@ -1,1 +1,1 @@
200-6
201+7

Subscribers

People subscribed via source and target branches

to all changes: