Merge lp:~mbruzek/charms/trusty/tomcat/trunk into lp:charms/trusty/tomcat

Proposed by Matt Bruzek on 2016-01-27
Status: Merged
Merged at revision: 15
Proposed branch: lp:~mbruzek/charms/trusty/tomcat/trunk
Merge into: lp:charms/trusty/tomcat
Diff against target: 120 lines (+39/-9)
4 files modified
README.md (+17/-0)
hooks/webapp-container-relation-joined (+6/-0)
metadata.yaml (+10/-3)
tests/10-configured-deploy.py (+6/-6)
To merge this branch: bzr merge lp:~mbruzek/charms/trusty/tomcat/trunk
Reviewer Review Type Date Requested Status
Kevin W Monroe Approve on 2016-01-27
Cory Johns 2016-01-27 Approve on 2016-01-27
Review via email: mp+284189@code.launchpad.net

Description of the Change

A user suggested adding the relation type that is in the precise charm to the trusty one with a slight rename to make it more idiomatic. This involved updating the metadata.yaml and creating the relation file (which now matches precise).

I added instructions in the README.md on how to use the relation.

Also updated the tests to use our latest best practices.

To post a comment you must log in.
Cory Johns (johnsca) wrote :

LGTM

review: Approve
Kevin W Monroe (kwmonroe) wrote :

Thanks for this MP! This has been merged into trusty/tomcat and should show up in the charmstore within an hour.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2014-03-21 15:07:22 +0000
3+++ README.md 2016-01-27 22:07:58 +0000
4@@ -103,6 +103,23 @@
5 # set bio connector
6 juju set tomcat http_connector=bio
7
8+## Deploying a WebApp to Tomcat
9+
10+A webapp can be deployed with the Tomcat charm in one of two ways: it can
11+be provided by another charm, or you can manually upload it.
12+
13+For another charm to provide a webapp, it must be a subordinate charm that
14+supports the `java-webapp` relation.
15+
16+To upload a webapp to Tomcat, simply use the following:
17+
18+ juju scp webapp.war tomcat/0:
19+ juju ssh tomcat/0 'sudo mv webapp.war /var/lib/tomcat7/webapps'
20+
21+(If you changed the version of tomcat being deployed, you will need to adjust
22+the path appropriately.)
23+
24+
25 ## Java Debugger (JDB)
26
27 Remote debugging can be useful for application development and diagnosing
28
29=== added file 'hooks/webapp-container-relation-joined'
30--- hooks/webapp-container-relation-joined 1970-01-01 00:00:00 +0000
31+++ hooks/webapp-container-relation-joined 2016-01-27 22:07:58 +0000
32@@ -0,0 +1,6 @@
33+#!/bin/bash
34+
35+set -ex
36+
37+VERSION=`config-get tomcat_version`
38+relation-set webapp-path /var/lib/$VERSION/webapps
39
40=== modified file 'metadata.yaml'
41--- metadata.yaml 2014-03-21 01:33:15 +0000
42+++ metadata.yaml 2016-01-27 22:07:58 +0000
43@@ -2,14 +2,21 @@
44 summary: Apache Tomcat 6 or 7 Servlet and JSP engine
45 maintainer: Matthew Bruzek <mattew.bruzek@canonical.com>
46 description: |
47- Apache Tomcat is an open source implementation of the Java Servlet and
48- JavaServer Pages (JSP) specifications, and provides a "pure Java" HTTP
49+ Apache Tomcat is an open source implementation of the Java Servlet and
50+ JavaServer Pages (JSP) specifications, and provides a "pure Java" HTTP
51 web server environment for Java web applications to run.
52
53-categories: ["app-servers"]
54+tags:
55+ - application_development
56+ - java
57+ - webapp
58+
59 provides:
60 website:
61 interface: http
62+ webapp-container:
63+ interface: java-webapp
64+ scope: container
65 requires:
66 jndi-memcached:
67 interface: memcache
68
69=== modified file 'tests/10-configured-deploy.py'
70--- tests/10-configured-deploy.py 2014-10-10 08:56:18 +0000
71+++ tests/10-configured-deploy.py 2016-01-27 22:07:58 +0000
72@@ -55,7 +55,7 @@
73 'cluster_enabled': True
74 }
75
76-d = amulet.Deployment()
77+d = amulet.Deployment(series='trusty')
78 # Add the tomcat charm to the deployment.
79 d.add('tomcat', units=scale)
80 d.add('memcached')
81@@ -83,18 +83,18 @@
82 raise
83
84 # Get the sentry unit for tomcat0.
85-tomcat_unit = d.sentry.unit['tomcat/0']
86+tomcat_unit = d.sentry['tomcat'][0]
87 # Get the public address for tomcat0.
88 tomcat0_address = tomcat_unit.info['public-address']
89 # Get the terracotta unit.
90-terracotta_unit = d.sentry.unit['terracotta/0']
91+terracotta_unit = d.sentry['terracotta'][0]
92 # Get the relation to terracotta.
93 terracotta_relation = terracotta_unit.relation('dso', 'tomcat:jndi-terracotta')
94 # Get the private address of terracotta to ensure the relation has that data.
95 terracotta_private_address = terracotta_relation['private-address']
96 print("terracotta private address " + terracotta_private_address)
97 # Get the memcached unit.
98-memcached_unit = d.sentry.unit['memcached/0']
99+memcached_unit = d.sentry['memcached'][0]
100 # Get the relation to memcached.
101 memcached_relation = memcached_unit.relation('cache', 'tomcat:jndi-memcached')
102 # Get the private address of memcached to ensure the relation has that data.
103@@ -118,7 +118,7 @@
104 tomcat1_address = address.decode().rstrip('\n')
105
106 ###############################################################################
107-## Read the /etc/tomcatX/default file to verifiy configuration settings.
108+## Read the /etc/tomcatX/default file to verify configuration settings.
109 ###############################################################################
110 # Read in the default file from the tomcat unit.
111 default_tomcat = tomcat_unit.file_contents('/etc/default/{0}'.format(
112@@ -169,7 +169,7 @@
113 static_member = server_xml[index:].split('\n')[0]
114 print(static_member)
115 print(tomcat1_address)
116-# Search for tomcat1 address in the tomcat0 server.xml to verifiy clustered.
117+# Search for tomcat1 address in the tomcat0 server.xml to verify clustered.
118 static_member.index(tomcat1_address)
119
120 ###############################################################################

Subscribers

People subscribed via source and target branches

to all changes: