Merge lp:~mthaddon/mojo/charm-testing-apache2 into lp:mojo/mojo-specs

Proposed by Tom Haddon
Status: Merged
Merged at revision: 56
Proposed branch: lp:~mthaddon/mojo/charm-testing-apache2
Merge into: lp:mojo/mojo-specs
Diff against target: 101 lines (+75/-0)
5 files modified
charm-testing/apache2/collect (+5/-0)
charm-testing/apache2/deploy (+23/-0)
charm-testing/apache2/post-deploy (+29/-0)
charm-testing/apache2/templates/vhost-http.tmpl (+6/-0)
charm-testing/apache2/templates/vhost-https.tmpl (+12/-0)
To merge this branch: bzr merge lp:~mthaddon/mojo/charm-testing-apache2
Reviewer Review Type Date Requested Status
Mojo Maintainers Pending
Review via email: mp+330096@code.launchpad.net

Description of the change

Add a charm testing spec for Apache2 matching what we have for other promulgated charms

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'charm-testing/apache2'
2=== added file 'charm-testing/apache2/collect'
3--- charm-testing/apache2/collect 1970-01-01 00:00:00 +0000
4+++ charm-testing/apache2/collect 2017-09-01 16:33:37 +0000
5@@ -0,0 +1,5 @@
6+# Services, primary charms
7+apache2 cs:~apache2-charmers/apache2
8+
9+# subordinates
10+nrpe cs:nrpe
11
12=== added file 'charm-testing/apache2/deploy'
13--- charm-testing/apache2/deploy 1970-01-01 00:00:00 +0000
14+++ charm-testing/apache2/deploy 2017-09-01 16:33:37 +0000
15@@ -0,0 +1,23 @@
16+apache2:
17+ series: {{series}}
18+ services:
19+ apache2:
20+ charm: apache2
21+ expose: true
22+ options:
23+ servername: apache2.devel.canonical.com
24+ vhost_http_template: include-base64://{{spec_dir}}/{{stage}}/templates/vhost-http.tmpl
25+ vhost_https_template: include-base64://{{spec_dir}}/{{stage}}/templates/vhost-https.tmpl
26+ enable_modules: headers proxy proxy_http rewrite ssl
27+ ssl_cert: SELFSIGNED
28+ ssl_chain: ""
29+ ssl_key: ""
30+ ssl_chainlocation: ssl-cert-snakeoil.crt
31+ ssl_keylocation: ssl-cert-snakeoil.key
32+ ssl_certlocation: ssl-cert-snakeoil.crt
33+ nrpe:
34+ charm: nrpe
35+ options:
36+ swap: '-w 90% -c 75% -n OK'
37+ relations:
38+ - ["nrpe:local-monitors", "apache2:local-monitors"]
39
40=== added file 'charm-testing/apache2/post-deploy'
41--- charm-testing/apache2/post-deploy 1970-01-01 00:00:00 +0000
42+++ charm-testing/apache2/post-deploy 2017-09-01 16:33:37 +0000
43@@ -0,0 +1,29 @@
44+#!/bin/bash
45+
46+# Put some content there to check
47+juju ssh apache2/0 "sudo mkdir -p /var/www/html && echo 'Sample content' > index.html && sudo mv index.html /var/www/html"
48+
49+APACHE=$(juju status --format=yaml apache2 2>&1 | sed -nr '/^ {8}public-address/s/.*://p')
50+
51+if [ -z "${APACHE}" ]; then
52+ echo "No apache2 instances"
53+ exit 1
54+fi
55+
56+for UNIT in ${APACHE}; do
57+
58+ echo "Calling unit to ensure it returns: Sample content"
59+ echo 'curl -f -k -s -S -v https://'${UNIT}'/|grep Sample content'
60+ curl -f -k -s -S -v https://${UNIT}/|grep "Sample content"
61+ if [ $? -ne 0 ]; then
62+ echo "####################"
63+ echo "# E2E Check Failed #"
64+ echo "####################"
65+ exit 1
66+ fi
67+done
68+
69+# If we are here it means no checks failed
70+echo "####################"
71+echo "# E2E Check Passed #"
72+echo "####################"
73
74=== added directory 'charm-testing/apache2/templates'
75=== added file 'charm-testing/apache2/templates/vhost-http.tmpl'
76--- charm-testing/apache2/templates/vhost-http.tmpl 1970-01-01 00:00:00 +0000
77+++ charm-testing/apache2/templates/vhost-http.tmpl 2017-09-01 16:33:37 +0000
78@@ -0,0 +1,6 @@
79+<VirtualHost *:80>
80+ ServerName {{ servername }}
81+
82+ RedirectMatch permanent ^/(.*) https://{{ servername }}/$1
83+
84+</VirtualHost>
85
86=== added file 'charm-testing/apache2/templates/vhost-https.tmpl'
87--- charm-testing/apache2/templates/vhost-https.tmpl 1970-01-01 00:00:00 +0000
88+++ charm-testing/apache2/templates/vhost-https.tmpl 2017-09-01 16:33:37 +0000
89@@ -0,0 +1,12 @@
90+ServerName {{ servername }}
91+
92+<VirtualHost *:443>
93+ ServerName {{ servername }}
94+ DocumentRoot /var/www/html
95+
96+ SSLEngine On
97+ SSLCertificateFile /etc/ssl/certs/{{ ssl_certlocation }}
98+ SSLCertificateKeyFile /etc/ssl/private/{{ ssl_keylocation }}
99+ SSLCertificateChainFile /etc/ssl/certs/{{ ssl_chainlocation }}
100+
101+</VirtualHost>

Subscribers

People subscribed via source and target branches

to all changes: