Merge ~moon127/mojo/+git/mojo-specs:ps5 into ~mojo-maintainers/mojo/+git/mojo-specs:master

Proposed by Gareth Woolridge
Status: Merged
Approved by: Gareth Woolridge
Approved revision: e1f50553a3c126030c03ec3f754394a57e639e66
Merged at revision: c7e5cf7b69cd8cd171c0dd893aafe8c8dd2be329
Proposed branch: ~moon127/mojo/+git/mojo-specs:ps5
Merge into: ~mojo-maintainers/mojo/+git/mojo-specs:master
Diff against target: 375 lines (+98/-126)
12 files modified
dev/null (+0/-20)
mojo-how-to/README (+7/-13)
mojo-how-to/configs/mojo-how-to-production-vhost-https.template (+3/-5)
mojo-how-to/devel/bundle-relations (+3/-0)
mojo-how-to/devel/bundle-services (+23/-25)
mojo-how-to/devel/collect (+0/-6)
mojo-how-to/manifest (+2/-4)
mojo-how-to/manifest-production (+19/-0)
mojo-how-to/production/bundle-relations (+6/-0)
mojo-how-to/production/bundle-services (+33/-34)
mojo-how-to/production/collect (+0/-17)
mojo-how-to/production/post-deploy (+2/-2)
Reviewer Review Type Date Requested Status
Tom Haddon Approve
Review via email: mp+401306@code.launchpad.net

Commit message

mojo-how-to: migrate from deployer configs to bundle and deploy from charmstore directly where possible, for production service migration

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

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

LGTM, thx

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

Setting to WIP till we're ready to deploy in PS5, as this is a major change to a public spec, so not one to just land on a Friday afternoon.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision c7e5cf7b69cd8cd171c0dd893aafe8c8dd2be329

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/mojo-how-to/README b/mojo-how-to/README
2index 567960e..e8cd984 100644
3--- a/mojo-how-to/README
4+++ b/mojo-how-to/README
5@@ -8,19 +8,13 @@ stage *only*:
6
7 This file should contain the following:
8
9-mojo-how-to:
10- services:
11- landscape-client:
12- options:
13- registration-key: $YOUR_LANDSCAPE_REGISTRATION_KEY
14- url: "https://${LANDSCAPE_INSTANCE}/message-system"
15- ping-url: "http://${LANDSCAPE_INSTANCE}/ping"
16- account-name: "$LANDSCAPE_ACCOUNT_NAME"
17- tags: "$YOUR_CHOICE_OF_TAGS"
18- ksplice:
19- options:
20- access-key: $YOUR_KSPLICE_ACCESS_KEY
21-
22+applications:
23+ autocert-apache2:
24+ options:
25+ cert_auth_pairs: $YOUR_CERT_AUTH_PAIRS
26+ nrpe:
27+ options:
28+ nagios_master: $YOUR_NAGIOS_MASTER_HOST
29
30 If you are using the autodeploy manifests, you will also need the following in
31 a secrets file called "autodeploy-secrets":
32diff --git a/mojo-how-to/configs/mojo-how-to-production-vhost-https.template b/mojo-how-to/configs/mojo-how-to-production-vhost-https.template
33index f74157c..9ba5e08 100644
34--- a/mojo-how-to/configs/mojo-how-to-production-vhost-https.template
35+++ b/mojo-how-to/configs/mojo-how-to-production-vhost-https.template
36@@ -6,11 +6,9 @@
37 ErrorLog /var/log/apache2/{{ servername }}-error.log
38
39 SSLEngine On
40- SSLCertificateFile /etc/ssl/certs/{{ ssl_certlocation }}
41- SSLCertificateKeyFile /etc/ssl/private/{{ ssl_keylocation }}
42- {% if ssl_chainlocation %}
43- SSLCertificateChainFile /etc/ssl/certs/{{ ssl_chainlocation }}
44- {% endif %}
45+ SSLCertificateFile /etc/ssl/certs/mojo.canonical.com.crt
46+ SSLCertificateKeyFile /etc/ssl/private/mojo.canonical.com.key
47+ SSLCertificateChainFile /etc/ssl/certs/mojo.canonical.com_chain.crt
48 SSLProtocol all
49
50 <Directory /srv/mojo>
51diff --git a/mojo-how-to/devel/bundle-relations b/mojo-how-to/devel/bundle-relations
52new file mode 100644
53index 0000000..c2eaafd
54--- /dev/null
55+++ b/mojo-how-to/devel/bundle-relations
56@@ -0,0 +1,3 @@
57+relations:
58+ - ["apache2", "content-fetcher"]
59+ - ["apache2:nrpe-external-master", "nrpe:nrpe-external-master"]
60diff --git a/mojo-how-to/devel/services b/mojo-how-to/devel/bundle-services
61similarity index 76%
62rename from mojo-how-to/devel/services
63rename to mojo-how-to/devel/bundle-services
64index 7f569fc..45e45ae 100644
65--- a/mojo-how-to/devel/services
66+++ b/mojo-how-to/devel/bundle-services
67@@ -1,25 +1,23 @@
68-mojo-how-to:
69- series: {{ series }}
70- services:
71- apache2:
72- charm: apache2
73- expose: true
74- num_units: 1
75- options:
76- servername: mojo-how-to.example.com
77- enable_modules: "ssl"
78- nagios_check_http_params: "-I 127.0.0.1 -H mojo-how-to-example.com -e '200' -s 'Mojo'"
79- vhost_http_template: 'include-base64://{{spec_dir}}/{{stage}}/../configs/mojo-how-to-vhost-http.template'
80- ssl_cert: SELFSIGNED
81- content-fetcher:
82- charm: content-fetcher
83- options:
84- archive_location: file:///home/ubuntu/mojo.tar
85- dest_dir: /srv/mojo
86- nrpe:
87- charm: nrpe
88- options:
89- nagios_master: nagios1.internal
90- {% if series == "xenial" %}
91- procs: '-w 150 -c 200'
92- swap: '-w 90% -c 75% -n ok'{% endif %}
93+series: {{ series }}
94+applications:
95+ apache2:
96+ charm: cs:apache2
97+ expose: true
98+ num_units: 1
99+ options:
100+ servername: mojo-how-to.example.com
101+ enable_modules: "ssl"
102+ nagios_check_http_params: "-I 127.0.0.1 -H mojo-how-to-example.com -e '200' -s 'Mojo'"
103+ vhost_http_template: 'include-base64://{{spec_dir}}/{{stage}}/../configs/mojo-how-to-vhost-http.template'
104+ ssl_cert: SELFSIGNED
105+ content-fetcher:
106+ charm: cs:~content-fetcher-charmers/content-fetcher
107+ options:
108+ archive_location: file:///home/ubuntu/mojo.tar
109+ dest_dir: /srv/mojo
110+ nrpe:
111+ charm: cs:nrpe
112+ options:
113+ nagios_master: nagios1.internal
114+ procs: '-w 150 -c 200'
115+ swap: ''
116diff --git a/mojo-how-to/devel/collect b/mojo-how-to/devel/collect
117index 461c025..95a4363 100644
118--- a/mojo-how-to/devel/collect
119+++ b/mojo-how-to/devel/collect
120@@ -1,8 +1,2 @@
121-apache2 lp:charms/trusty/apache2
122-
123-# subordinates
124-content-fetcher lp:~mthaddon/charms/trusty/content-fetcher/trunk
125-nrpe lp:charms/trusty/nrpe
126-
127 # content to publish
128 mojo lp:mojo
129diff --git a/mojo-how-to/devel/relations b/mojo-how-to/devel/relations
130deleted file mode 100644
131index 4941d2c..0000000
132--- a/mojo-how-to/devel/relations
133+++ /dev/null
134@@ -1,12 +0,0 @@
135-mojo-how-to:
136- series: {{ series }}
137- services:
138- apache2:
139- charm: apache2
140- content-fetcher:
141- charm: content-fetcher
142- nrpe:
143- charm: nrpe
144- relations:
145- - ["apache2", "content-fetcher"]
146- - ["apache2:nrpe-external-master", "nrpe:nrpe-external-master"]
147diff --git a/mojo-how-to/manifest b/mojo-how-to/manifest
148index 46e4d05..4dd3e8f 100644
149--- a/mojo-how-to/manifest
150+++ b/mojo-how-to/manifest
151@@ -6,13 +6,11 @@ script config=build
152 # Run pre-deploy script
153 script config=pre-deploy
154 # Deploy services only
155-deploy config=services local=services-secret delay=0
156+bundle config=bundle-services local=services-secret additional-ready-states=waiting
157 # Copy our built resources to the instances
158 script config=upload-built-content
159 # And now deploy relations as well
160-deploy config=relations
161-# Configure deploy autocert managed apache2
162-script config=scripts/utils/configure-apache2-vhosts-autocert APPLICATION=apache2 HTTP_TEMPLATE=${MOJO_STAGE}/../configs//mojo-how-to-production-vhost-http.tmpl HTTPS_TEMPLATE=${MOJO_STAGE}/../configs//mojo-how-to-production-vhost-https.tmpl
163+bundle config=bundle-services,bundle-relations local=services-secret
164 # Run verify steps
165 include config=manifest-verify
166 # Run post deploy steps
167diff --git a/mojo-how-to/manifest-golive b/mojo-how-to/manifest-golive
168deleted file mode 100644
169index e46da16..0000000
170--- a/mojo-how-to/manifest-golive
171+++ /dev/null
172@@ -1,6 +0,0 @@
173-## This manifest is intended to be used only once the production environment
174-## is confirmed to be up and running and it will be kept in place. It applies
175-## landscape and ksplice relations.
176-deploy config=golive
177-sleep config=30
178-include config=manifest-verify
179diff --git a/mojo-how-to/manifest-production b/mojo-how-to/manifest-production
180new file mode 100644
181index 0000000..342574b
182--- /dev/null
183+++ b/mojo-how-to/manifest-production
184@@ -0,0 +1,19 @@
185+# Run the collect step
186+collect
187+# We need the markdown package to be able to generate the docs for Mojo
188+# Run the build step
189+script config=build
190+# Run pre-deploy script
191+script config=pre-deploy
192+# Deploy services only
193+bundle config=bundle-services local=services-secret additional-ready-states=waiting
194+# Copy our built resources to the instances
195+script config=upload-built-content
196+# And now deploy relations as well
197+bundle config=bundle-services,bundle-relations local=services-secret
198+# Configure deploy autocert managed apache2
199+script config=scripts/utils/configure-apache2-vhosts-autocert APPLICATION=apache2 HTTP_TEMPLATE=${MOJO_STAGE}/../configs/mojo-how-to-production-vhost-http.template HTTPS_TEMPLATE=${MOJO_STAGE}/../configs/mojo-how-to-production-vhost-https.template
200+# Run verify steps
201+include config=manifest-verify
202+# Run post deploy steps
203+script config=post-deploy
204diff --git a/mojo-how-to/production/bundle-relations b/mojo-how-to/production/bundle-relations
205new file mode 100644
206index 0000000..236968c
207--- /dev/null
208+++ b/mojo-how-to/production/bundle-relations
209@@ -0,0 +1,6 @@
210+series: {{ series }}
211+relations:
212+ - ["apache2", "content-fetcher"]
213+ - ["apache2:nrpe-external-master", "nrpe:nrpe-external-master"]
214+ - ['apache2', 'autocert-apache2']
215+ - ['autocert-apache2:nrpe-external-master', 'nrpe:nrpe-external-master']
216diff --git a/mojo-how-to/production/services b/mojo-how-to/production/bundle-services
217similarity index 63%
218rename from mojo-how-to/production/services
219rename to mojo-how-to/production/bundle-services
220index ddf40d7..e6d1d53 100644
221--- a/mojo-how-to/production/services
222+++ b/mojo-how-to/production/bundle-services
223@@ -1,34 +1,33 @@
224-mojo-how-to:
225- series: {{ series }}
226- services:
227- apache2:
228- charm: apache2
229- expose: true
230- num_units: 1
231- options:
232- servername: mojo.canonical.com
233- enable_modules: "ssl"
234- nagios_check_http_params: -I 127.0.0.1 -H mojo.canonical.com -S -e '200' -s 'Mojo'
235- autocert-apache2:
236- charm: autocert
237- options:
238- autocert_host: autocert.canonical.com
239- service_action: reload
240- service_name: apache2
241- service_test_cmd: /usr/sbin/apache2ctl configtest
242- content-fetcher:
243- charm: content-fetcher
244- options:
245- archive_location: file:///home/ubuntu/mojo.tar
246- dest_dir: /srv/mojo
247- landscape:
248- charm: landscape-client
249- nrpe:
250- charm: nrpe
251- options:
252- nagios_master: nagios1.internal
253- {% if series == "xenial" %}
254- procs: '-w 200 -c 250'
255- swap: '-w 90% -c 75% -n ok'{% endif %}
256- ksplice:
257- charm: ksplice
258+series: {{ series }}
259+applications:
260+ apache2:
261+ charm: cs:apache2
262+ expose: true
263+ num_units: 1
264+ constraints: cpu-cores=2 mem=4G root-disk=20G root-disk-source=volume
265+ options:
266+ servername: mojo.canonical.com
267+ enable_modules: "ssl"
268+ nagios_check_http_params: -I 127.0.0.1 -H mojo.canonical.com -S -e '200' -s 'Mojo'
269+ nagios_context: prod-mojo-how-to
270+ autocert-apache2:
271+ charm: cs:~autocert-charmers/autocert
272+ options:
273+ autocert_host: autocert.canonical.com
274+ service_action: reload
275+ service_name: apache2
276+ service_test_cmd: /usr/sbin/apache2ctl configtest
277+ nagios_servicegroups: prod-mojo-how-to
278+ content-fetcher:
279+ charm: cs:~content-fetcher-charmers/content-fetcher
280+ options:
281+ archive_location: file:///home/ubuntu/mojo.tar
282+ dest_dir: /srv/mojo
283+ nrpe:
284+ charm: cs:nrpe
285+ options:
286+ nagios_host_context: prod-mojo-how-to
287+ export_nagios_definitions: true
288+ procs: '-w 200 -c 250'
289+ swap: ''
290+ sub_postfix: ''
291diff --git a/mojo-how-to/production/collect b/mojo-how-to/production/collect
292index ad2760d..95a4363 100644
293--- a/mojo-how-to/production/collect
294+++ b/mojo-how-to/production/collect
295@@ -1,19 +1,2 @@
296-apache2 lp:charms/trusty/apache2
297-ubuntu lp:~canonical-sysadmins/charms/trusty/ubuntu/trunk
298-
299-
300-# subordinates
301-autocert cs:~autocert-charmers/autocert
302-content-fetcher lp:~mthaddon/charms/trusty/content-fetcher/trunk
303-nrpe lp:charms/trusty/nrpe
304-landscape-client cs:{{ series }}/landscape-client
305-ksplice lp:~anthony-fappiano/charms/trusty/ksplice/trunk
306-
307-# basenode
308-apache2/exec.d @
309-apache2/exec.d/basenode lp:~canonical-sysadmins/basenode/trunk
310-ubuntu/exec.d @
311-ubuntu/exec.d/basenode lp:~canonical-sysadmins/basenode/trunk
312-
313 # content to publish
314 mojo lp:mojo
315diff --git a/mojo-how-to/production/golive b/mojo-how-to/production/golive
316deleted file mode 100644
317index 4b993ca..0000000
318--- a/mojo-how-to/production/golive
319+++ /dev/null
320@@ -1,17 +0,0 @@
321-mojo-how-to:
322- series: {{ series }}
323- services:
324- apache2:
325- charm: apache2
326- content-fetcher:
327- charm: content-fetcher
328- nrpe:
329- charm: nrpe
330- landscape:
331- charm: landscape-client
332- ksplice:
333- charm: ksplice
334- relations:
335- - ["apache2", "nrpe"]
336- - ["apache2", "landscape"]
337- - ["apache2", "ksplice"]
338diff --git a/mojo-how-to/production/post-deploy b/mojo-how-to/production/post-deploy
339index 1cb8fbd..b4eee67 100755
340--- a/mojo-how-to/production/post-deploy
341+++ b/mojo-how-to/production/post-deploy
342@@ -7,5 +7,5 @@ PRODUCTION_IP_1="162.213.33.51"
343
344 SERVER_1=$(juju status --format yaml |awk '$1 == "instance-id:" {print $2}')
345
346-echo "Running nova floating-ip-associate ${SERVER_1} ${PRODUCTION_IP_1}"
347-nova floating-ip-associate ${SERVER_1} ${PRODUCTION_IP_1}
348+echo "Running openstack server add floating ip ${SERVER_1} ${PRODUCTION_IP_1}"
349+openstack server add floating ip ${SERVER_1} ${PRODUCTION_IP_1}
350diff --git a/mojo-how-to/production/relations b/mojo-how-to/production/relations
351deleted file mode 100644
352index 396073b..0000000
353--- a/mojo-how-to/production/relations
354+++ /dev/null
355@@ -1,20 +0,0 @@
356-mojo-how-to:
357- series: {{ series }}
358- services:
359- apache2:
360- charm: apache2
361- autocert-apache2:
362- charm: autocert
363- content-fetcher:
364- charm: content-fetcher
365- nrpe:
366- charm: nrpe
367- landscape:
368- charm: landscape-client
369- ksplice:
370- charm: ksplice
371- relations:
372- - ["apache2", "content-fetcher"]
373- - ["apache2:nrpe-external-master", "nrpe:nrpe-external-master"]
374- - ['apache2', 'autocert-apache2']
375- - ['autocert-apache2:nrpe-external-master', 'nrpe:nrpe-external-master']

Subscribers

People subscribed via source and target branches