How to upgrade an application

See also: Upgrading things, Application

Application upgrades affect the version of an already deployed charm.

An application represents a deployed charm within a given model. Depending on the source of the application deployment dictates how an upgrade can be run.

Bundles are not upgrade-able themselves, as they are a collection of applications, that are not modelled by Juju itself.

To find out the source of the application deployment, you can utilise juju status via the ‘Store’ column.

Model    Controller  Cloud/Region  Version  SLA          Timestamp
default  test        lxd/default   2.9.4    unsupported  14:45:09+01:00

App           Version  Status   Scale  Charm         Store       Channel  Rev  OS      Message
juju-test              idle         0  juju-test     local                  0  ubuntu
ubuntu                 idle       0/1  ubuntu        charmhub    stable    18  ubuntu
ubuntu-cs              idle       0/1  ubuntu        charmstore  stable    18  ubuntu

Applications deployed via Charmhub

Refreshing Charmhub deployed application charms are done via channels (work to provide upgrades via revisions is ongoing). Conjoined with juju info <charm> it’s possible to inspect the current channels and revisions in each channel.

juju info ubuntu
name: ubuntu
charm-id: DksXQKAQTZfsUmBAGanZAhpoS4dpmXel
summary: A pristine Ubuntu Server
publisher: charmers
supports: focal, bionic, xenial, groovy
subordinate: false
description: |
  This simply deploys the Ubuntu Cloud/Server image
channels: |
  latest/stable:     19  2021-06-07  (19)  828kB
  latest/candidate:  19  2021-06-07  (19)  828kB
  latest/beta:       19  2021-06-07  (19)  828kB
  latest/edge:       19  2021-06-07  (19)  828kB

From there it’s possible to use juju refresh ubuntu to upgrade the charm from revision 18 (that we can see in the above juju status output, to 19).

Moving between channels juju refresh ubuntu --channel="latest/edge" is also possible if the revision is a different value.

Applications deployed via charm-store charms

Charm-store charms are deployed from the older now deprecated charm store.

Refreshing charm-store charms can be done via channels or revisions, channels aren’t as expressive as those in charmhub charms, but can be used in a similar guise. Additionally juju info doesn’t support charm-store charms either, so looking up supported revisions and channels requires looking up the charm at or you can query for charm information, such as channels and revisions, with the charm utility, which is available via the Charm Tools software. See the Charm Tools page for guidance.

juju refresh cs:ubuntu-19

Applications deployed via local charm

Refreshing an existing local deployed application charm, requires the --path argument to the new charm.

juju refresh juju-test --path ./path/to/juju-test

As revision files are optional, it’s possible to refresh multiple times and a new revision is assigned to the upgrade each time.

Crossgrading (switch) an application

Crossgrading an application refers to upgrading an application by switching out the current charm and replacing it with a new local charm. This is accomplished by way of the --switch option. This differs from upgrading an existing charm locally (with the --path option) due to the charm being considered entirely new.

This type of upgrade should be a considered operation since Juju has only limited information with which to determine compatibility. The operation will succeed so long as the following conditions are met:

  • The new charm must support all relations that the application is currently participating in.

The new charm may add new relations and configuration settings.

Upgrade mechanics

Additional information of the low-level details can be found in the Charm developer guide.

Last updated 2 months ago.