Merge lp:~mthaddon/mojo/mojo-specs into lp:mojo/mojo-specs

Proposed by Tom Haddon
Status: Merged
Approved by: Gareth Woolridge
Approved revision: 62
Merged at revision: 7
Proposed branch: lp:~mthaddon/mojo/mojo-specs
Merge into: lp:mojo/mojo-specs
Diff against target: 326 lines (+123/-41)
18 files modified
mojo-how-to/README (+4/-1)
mojo-how-to/configs/mojo-how-to-production-vhost-http.template (+0/-23)
mojo-how-to/configs/mojo-how-to-production-vhost-https.template (+22/-0)
mojo-how-to/devel/build (+3/-2)
mojo-how-to/devel/post-deploy (+4/-0)
mojo-how-to/devel/pre-deploy (+7/-0)
mojo-how-to/devel/repo (+0/-3)
mojo-how-to/devel/services (+1/-0)
mojo-how-to/devel/update-content (+12/-0)
mojo-how-to/devel/upload-built-content (+7/-1)
mojo-how-to/manifest (+5/-5)
mojo-how-to/manifest-update-content (+12/-0)
mojo-how-to/production/collect (+1/-0)
mojo-how-to/production/post-deploy (+15/-0)
mojo-how-to/production/relations (+18/-0)
mojo-how-to/production/repo (+0/-4)
mojo-how-to/production/services (+4/-0)
mojo-how-to/production/upload-built-content (+8/-2)
To merge this branch: bzr merge lp:~mthaddon/mojo/mojo-specs
Reviewer Review Type Date Requested Status
Gareth Woolridge Approve
Review via email: mp+259736@code.launchpad.net

Description of the change

Some updates to the mojo.canonical.com spec based on SREcon testing and fix the devel stage to not error out with lack of secrets directory.

To post a comment you must log in.
lp:~mthaddon/mojo/mojo-specs updated
58. By Tom Haddon

Comment about ensuring secrets dir

59. By Tom Haddon

We can't rely on permissions on the parent of the secrets directory, so just rely on that having been created (will need documenting)

60. By Tom Haddon

Remove the secrets phase to avoid it being needed in devel

61. By Tom Haddon

Explain what we're doing in creating the dummy service-secrets file

62. By Tom Haddon

Typo in the services-secret filename

Revision history for this message
Tom Haddon (mthaddon) wrote :

I've made a few more changes, but now confirmed it runs without error.

Revision history for this message
Gareth Woolridge (moon127) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mojo-how-to/README'
2--- mojo-how-to/README 2015-01-21 17:46:38 +0000
3+++ mojo-how-to/README 2015-05-21 09:55:12 +0000
4@@ -4,7 +4,7 @@
5 This service requires the following secrets file if deploying the "production"
6 stage *only*:
7
8- /srv/mojo/LOCAL/${MOJO_PROJECT}/${MOJO_STAGE}/landscape
9+ /srv/mojo/LOCAL/${MOJO_PROJECT}/${MOJO_STAGE}/services-secret
10
11 This file should contain the following:
12
13@@ -17,3 +17,6 @@
14 ping-url: "http://${LANDSCAPE_INSTANCE}/ping"
15 account-name: "$LANDSCAPE_ACCOUNT_NAME"
16 tags: "$YOUR_CHOICE_OF_TAGS"
17+ ksplice:
18+ options:
19+ access-key: $YOUR_KSPLICE_ACCESS_KEY
20
21=== modified file 'mojo-how-to/configs/mojo-how-to-production-vhost-http.template'
22--- mojo-how-to/configs/mojo-how-to-production-vhost-http.template 2015-01-21 15:47:48 +0000
23+++ mojo-how-to/configs/mojo-how-to-production-vhost-http.template 2015-05-21 09:55:12 +0000
24@@ -8,26 +8,3 @@
25 Redirect permanent / https://{{servername}}
26
27 </VirtualHost>
28-
29-<VirtualHost *:443>
30-
31- ServerName {{ servername }}
32-
33- CustomLog /var/log/apache2/{{ servername }}-access.log combined
34- ErrorLog /var/log/apache2/{{ servername }}-error.log
35-
36- SSLEngine On
37- SSLCertificateFile /etc/ssl/certs/{{ ssl_certlocation }}
38- SSLCertificateKeyFile /etc/ssl/private/{{ ssl_keylocation }}
39- {% if ssl_chainlocation %}
40- SSLCertificateChainFile /etc/ssl/certs/{{ ssl_chainlocation }}
41- {% endif %}
42- SSLProtocol all
43-
44- <Directory /srv/mojo>
45- Require all granted
46- </Directory>
47-
48- DocumentRoot /srv/mojo
49-
50-</VirtualHost>
51
52=== added file 'mojo-how-to/configs/mojo-how-to-production-vhost-https.template'
53--- mojo-how-to/configs/mojo-how-to-production-vhost-https.template 1970-01-01 00:00:00 +0000
54+++ mojo-how-to/configs/mojo-how-to-production-vhost-https.template 2015-05-21 09:55:12 +0000
55@@ -0,0 +1,22 @@
56+<VirtualHost *:443>
57+
58+ ServerName {{ servername }}
59+
60+ CustomLog /var/log/apache2/{{ servername }}-access.log combined
61+ ErrorLog /var/log/apache2/{{ servername }}-error.log
62+
63+ SSLEngine On
64+ SSLCertificateFile /etc/ssl/certs/{{ ssl_certlocation }}
65+ SSLCertificateKeyFile /etc/ssl/private/{{ ssl_keylocation }}
66+ {% if ssl_chainlocation %}
67+ SSLCertificateChainFile /etc/ssl/certs/{{ ssl_chainlocation }}
68+ {% endif %}
69+ SSLProtocol all
70+
71+ <Directory /srv/mojo>
72+ Require all granted
73+ </Directory>
74+
75+ DocumentRoot /srv/mojo
76+
77+</VirtualHost>
78
79=== modified file 'mojo-how-to/devel/build'
80--- mojo-how-to/devel/build 2015-01-26 10:31:58 +0000
81+++ mojo-how-to/devel/build 2015-05-21 09:55:12 +0000
82@@ -10,10 +10,11 @@
83 tar cvpf ${MOJO_LOCAL_DIR}/mojo.tar --directory=docs/www .
84
85 if [ ${MOJO_STAGE##*/} != "production" ]; then
86- # We don't deploy landscape in non-production environments, but we need an
87+ # We don't deploy landscape in non-production environments, but we need a
88 # dummy secrets file
89+ echo "Creating dummy services-secret file in ${MOJO_LOCAL_DIR}"
90 echo "mojo-how-to:
91 services:
92 nrpe:
93- charm: nrpe-external-master" > ${MOJO_LOCAL_DIR}/landscape
94+ charm: nrpe-external-master" > ${MOJO_LOCAL_DIR}/services-secret
95 fi
96
97=== added file 'mojo-how-to/devel/post-deploy'
98--- mojo-how-to/devel/post-deploy 1970-01-01 00:00:00 +0000
99+++ mojo-how-to/devel/post-deploy 2015-05-21 09:55:12 +0000
100@@ -0,0 +1,4 @@
101+#!/bin/sh
102+
103+# Nothing to do here
104+exit 0
105
106=== added file 'mojo-how-to/devel/pre-deploy'
107--- mojo-how-to/devel/pre-deploy 1970-01-01 00:00:00 +0000
108+++ mojo-how-to/devel/pre-deploy 2015-05-21 09:55:12 +0000
109@@ -0,0 +1,7 @@
110+#!/bin/bash
111+
112+JUJU_STATUS=$(juju status > /dev/null 2>&1)
113+if [ $? != 0 ]; then
114+ echo "Bootstrapping juju"
115+ juju bootstrap
116+fi
117
118=== removed file 'mojo-how-to/devel/repo'
119--- mojo-how-to/devel/repo 2015-01-21 11:20:06 +0000
120+++ mojo-how-to/devel/repo 1970-01-01 00:00:00 +0000
121@@ -1,3 +0,0 @@
122-apache2
123-content-fetcher
124-nrpe-external-master
125
126=== modified file 'mojo-how-to/devel/services'
127--- mojo-how-to/devel/services 2015-01-26 14:03:14 +0000
128+++ mojo-how-to/devel/services 2015-05-21 09:55:12 +0000
129@@ -10,6 +10,7 @@
130 enable_modules: "ssl"
131 nagios_check_http_params: "-I 127.0.0.1 -H mojo-how-to-example.com -e '200' -s 'Mojo'"
132 vhost_http_template: 'include-base64://{{spec_dir}}/{{stage}}/../configs/mojo-how-to-vhost-http.template'
133+ ssl_cert: SELFSIGNED
134 content-fetcher:
135 charm: content-fetcher
136 options:
137
138=== added file 'mojo-how-to/devel/update-content'
139--- mojo-how-to/devel/update-content 1970-01-01 00:00:00 +0000
140+++ mojo-how-to/devel/update-content 2015-05-21 09:55:12 +0000
141@@ -0,0 +1,12 @@
142+#!/bin/bash
143+
144+if [ "$BUILD_LABEL" = "revno" ]; then
145+ DESTINATION="mojo-$(bzr revno ${MOJO_BUILD_DIR}/mojo).tar"
146+else
147+ DESTINATION="mojo.tar"
148+fi
149+
150+set -e
151+set -u
152+
153+juju set content-fetcher archive_location="file:///home/ubuntu/${DESTINATION}"
154
155=== modified file 'mojo-how-to/devel/upload-built-content'
156--- mojo-how-to/devel/upload-built-content 2015-01-21 13:27:31 +0000
157+++ mojo-how-to/devel/upload-built-content 2015-05-21 09:55:12 +0000
158@@ -1,6 +1,12 @@
159 #!/bin/bash
160
161+if [ "$BUILD_LABEL" = "revno" ]; then
162+ DESTINATION="mojo-$(bzr revno ${MOJO_BUILD_DIR}/mojo).tar"
163+else
164+ DESTINATION="mojo.tar"
165+fi
166+
167 set -e
168 set -u
169
170-juju scp ${MOJO_LOCAL_DIR}/mojo.tar apache2/0:
171+juju scp ${MOJO_LOCAL_DIR}/mojo.tar apache2/0:${DESTINATION}
172
173=== modified file 'mojo-how-to/manifest'
174--- mojo-how-to/manifest 2015-01-26 10:44:40 +0000
175+++ mojo-how-to/manifest 2015-05-21 09:55:12 +0000
176@@ -4,15 +4,15 @@
177 collect
178 # Run the build step
179 build
180-# Create our charm repository
181-repo
182-# Pull in any secrets - this is only used in the production stage
183-secrets
184+# Run pre-deploy script
185+script config=pre-deploy
186 # Deploy services only
187-deploy config=services local=landscape
188+deploy config=services local=services-secret delay=0
189 # Copy our built resources to the instances
190 script config=upload-built-content
191 # And now deploy relations as well
192 deploy config=relations
193 # Run verify steps
194 include config=manifest-verify
195+# Run post deploy steps
196+script config=post-deploy
197
198=== added file 'mojo-how-to/manifest-update-content'
199--- mojo-how-to/manifest-update-content 1970-01-01 00:00:00 +0000
200+++ mojo-how-to/manifest-update-content 2015-05-21 09:55:12 +0000
201@@ -0,0 +1,12 @@
202+# Pull down the latest content
203+collect
204+# Run the build step
205+build
206+# Copy our built resources to the instances
207+script config=upload-built-content BUILD_LABEL=revno
208+# Update the config variable so our content is updated
209+script config=update-content BUILD_LABEL=revno
210+# Sleep to let the update be applied
211+sleep config=60
212+# Check the service again
213+include config=manifest-verify
214
215=== modified file 'mojo-how-to/production/collect'
216--- mojo-how-to/production/collect 2015-01-26 11:16:10 +0000
217+++ mojo-how-to/production/collect 2015-05-21 09:55:12 +0000
218@@ -4,6 +4,7 @@
219 content-fetcher lp:~gnuoy/charms/precise/content-fetcher/trunk
220 nrpe-external-master lp:charms/precise/nrpe-external-master
221 landscape-client lp:charms/trusty/landscape-client
222+ksplice lp:~anthony-fappiano/charms/trusty/ksplice/trunk
223
224 # basenode
225 apache2/exec.d @
226
227=== added file 'mojo-how-to/production/post-deploy'
228--- mojo-how-to/production/post-deploy 1970-01-01 00:00:00 +0000
229+++ mojo-how-to/production/post-deploy 2015-05-21 09:55:12 +0000
230@@ -0,0 +1,15 @@
231+#!/bin/bash
232+
233+set -e
234+set -u
235+
236+PRODUCTION_IP_1="162.213.32.109"
237+PRODUCTION_IP_2="162.213.32.110"
238+
239+SERVER_1=$(nova list | grep ${JUJU_ENV} | grep machine-1 | awk '{print $2}')
240+SERVER_2=$(nova list | grep ${JUJU_ENV} | grep machine-2 | awk '{print $2}')
241+
242+echo "Running nova floating-ip-associate ${SERVER_1} ${PRODUCTION_IP_1}"
243+nova floating-ip-associate ${SERVER_1} ${PRODUCTION_IP_1}
244+echo "Running nova floating-ip-associate ${SERVER_2} ${PRODUCTION_IP_2}"
245+nova floating-ip-associate ${SERVER_2} ${PRODUCTION_IP_2}
246
247=== added symlink 'mojo-how-to/production/pre-deploy'
248=== target is u'../devel/pre-deploy'
249=== modified symlink 'mojo-how-to/production/relations'
250=== target was u'../devel/relations'
251--- mojo-how-to/production/relations 1970-01-01 00:00:00 +0000
252+++ mojo-how-to/production/relations 2015-05-21 09:55:12 +0000
253@@ -0,0 +1,18 @@
254+mojo-how-to:
255+ series: {{ series }}
256+ services:
257+ apache2:
258+ charm: apache2
259+ content-fetcher:
260+ charm: content-fetcher
261+ nrpe:
262+ charm: nrpe-external-master
263+ landscape:
264+ charm: landscape-client
265+ ksplice:
266+ charm: ksplice
267+ relations:
268+ - ["apache2", "content-fetcher"]
269+ - ["apache2", "nrpe"]
270+ - ["apache2", "landscape"]
271+ - ["apache2", "ksplice"]
272
273=== removed file 'mojo-how-to/production/repo'
274--- mojo-how-to/production/repo 2015-01-21 17:46:38 +0000
275+++ mojo-how-to/production/repo 1970-01-01 00:00:00 +0000
276@@ -1,4 +0,0 @@
277-apache2
278-content-fetcher
279-landscape-client
280-nrpe-external-master
281
282=== modified file 'mojo-how-to/production/services'
283--- mojo-how-to/production/services 2015-01-21 17:46:38 +0000
284+++ mojo-how-to/production/services 2015-05-21 09:55:12 +0000
285@@ -10,11 +10,13 @@
286 enable_modules: "ssl"
287 nagios_check_http_params: -I 127.0.0.1 -H mojo.canonical.com -S -e '200' -s 'Mojo'
288 vhost_http_template: 'include-base64://{{spec_dir}}/{{stage}}/../configs/mojo-how-to-production-vhost-http.template'
289+ vhost_https_template: 'include-base64://{{spec_dir}}/{{stage}}/../configs/mojo-how-to-production-vhost-https.template'
290 ssl_key: include-base64://{{local_dir}}/mojo.canonical.com.key
291 ssl_keylocation: mojo.canonical.com.key
292 ssl_cert: include-base64://{{local_dir}}/mojo.canonical.com.crt
293 ssl_certlocation: mojo.canonical.com.crt
294 ssl_chain: include-base64://{{local_dir}}/godaddy_issuing.crt
295+ ssl_chainlocation: godaddy_issuing.crt
296 content-fetcher:
297 charm: content-fetcher
298 options:
299@@ -24,3 +26,5 @@
300 charm: landscape-client
301 nrpe:
302 charm: nrpe-external-master
303+ ksplice:
304+ charm: ksplice
305
306=== added symlink 'mojo-how-to/production/update-content'
307=== target is u'../devel/update-content'
308=== modified file 'mojo-how-to/production/upload-built-content'
309--- mojo-how-to/production/upload-built-content 2015-01-21 13:27:31 +0000
310+++ mojo-how-to/production/upload-built-content 2015-05-21 09:55:12 +0000
311@@ -1,7 +1,13 @@
312 #!/bin/bash
313
314+if [ "$BUILD_LABEL" = "revno" ]; then
315+ DESTINATION="mojo-$(bzr revno ${MOJO_BUILD_DIR}/mojo).tar"
316+else
317+ DESTINATION="mojo.tar"
318+fi
319+
320 set -e
321 set -u
322
323-juju scp ${MOJO_LOCAL_DIR}/mojo.tar apache2/0:
324-juju scp ${MOJO_LOCAL_DIR}/mojo.tar apache2/1:
325+juju scp ${MOJO_LOCAL_DIR}/mojo.tar apache2/0:${DESTINATION}
326+juju scp ${MOJO_LOCAL_DIR}/mojo.tar apache2/1:${DESTINATION}

Subscribers

People subscribed via source and target branches

to all changes: