<div dir="ltr">
<p style="margin-bottom:0in;line-height:100%">Hello Denis,</p>
<p style="margin-bottom:0in;line-height:100%">After speaking with
a colleague and some further reflection on this question I am going
to retract my earlier statement and offer a different best practice
for this situation.</p>
<p style="margin-bottom:0in;line-height:100%">The upgrade-charm
hook is best used for when the charm code changes. Such as if a new
relationship was added, or there is a new interface. Essentially use
upgrade-charm when the charm code changes, not the underlying
application code.</p><p style="margin-bottom:0in;line-height:100%">Instead consider
adding the logic to update your web application to the config-changed
hook. You could add a configuration option that is a URI to tell the
charm where to get the web application code. This configuration
option could contain a URI to a source control repository such as
Bazaar or Github, or a directory on your computer. Users could
easily change the URI when the web app is updated, and the
config-changed hook can download the code and update it.</p>
<p style="margin-bottom:0in;line-height:100%"><br>
</p>
<p style="margin-bottom:0in;line-height:100%">Here are a few
examples of how you could update the charm code using a URI:</p>
<p style="margin-bottom:0in;line-height:100%">juju set mywebapp
source=”lp:~mbruzek/java/webappname/trunk”</p>
<p style="margin-bottom:0in;line-height:100%">juju set mywebapp
source=”<a href="mailto:git@github.com" target="_blank">git@github.com</a>:marcoceppi/amulet.git”</p>
<p style="margin-bottom:0in;line-height:100%">juju set mywebapp
source=”<a href="http://website.com/mywebapp/webapp.war" target="_blank">http://website.com/mywebapp/webapp.war</a>”</p>
<p style="margin-bottom:0in;line-height:100%"><br>
</p>
<p style="margin-bottom:0in;line-height:100%">This option would
allow the web application code to be updated when ever the source
configuration option changes.</p><p style="margin-bottom:0in;line-height:100%"><br></p>I do not have a good
example of this pattern at the moment. If you have any questions
about this pattern please let me know. You can email me directly at
<a href="mailto:matthew.bruzek@canonical.com" target="_blank">matthew.bruzek@canonical.com</a>
or find me on IRC mbruzek in #juju on Freenode.net<br><br><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 1, 2014 at 9:44 PM, Denis Weerasiri <span dir="ltr"><<a href="mailto:ddweerasiri@gmail.com" target="_blank">ddweerasiri@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div>Support I have written a charm to deploy a web application on top of tomcat. And now I need to redeploy the web application when I update the source repository of the web application. What is the best practice to do this?</div>
<div>What I have in mind is to write a new version of charm and use charm-update command. So juju will re-deploy the web application.<span><font color="#888888"><br clear="all"><div><br></div>-- <br><div dir="ltr">
Thanks,<br>Denis Weerasiri<div><br>
</div><div>Sent from my iPhone</div></div>
</font></span></div></div>
<br>--<br>
Juju mailing list<br>
<a href="mailto:Juju@lists.ubuntu.com" target="_blank">Juju@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/juju" target="_blank">https://lists.ubuntu.com/mailman/listinfo/juju</a><br>
<br></blockquote></div><br></div></div>