Hello Denis,

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.

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.

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.


 Here are a few examples of how you could update the charm code using a URI:

juju set mywebapp source=”lp:~mbruzek/java/webappname/trunk”

juju set mywebapp source=”[email protected]:marcoceppi/amulet.git”

juju set mywebapp source=”http://website.com/mywebapp/webapp.war”


 This option would allow the web application code to be updated when ever
the source configuration option changes.


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 [email protected] or find me on IRC mbruzek in #juju on
Freenode.net



On Tue, Jul 1, 2014 at 9:44 PM, Denis Weerasiri <[email protected]>
wrote:

> Hi,
> 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?
> 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.
>
> --
> Thanks,
> Denis Weerasiri
>
> Sent from my iPhone
>
> --
> Juju mailing list
> [email protected]
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
>
-- 
Juju mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju

Reply via email to