Juju Resources
A Juju resource is additional content/files that a charm can make use of or may require in order to run.
There are three ways to examine resources:
- Charm resources
- Application resources
- Unit resources
Each of these will be explained below.
Also see Developer resources in the Charm developer guide.
Charm resources
These are resources that the charm is defined with. They can be listed with the
charm-resources
command. This will query the Charm Store by examining the
metadata.yaml
file of the specified charm. The charm therefore does not need
to have been deployed in order to run the command. A controller is also not
strictly required but may be necessary in the case of private charms where
credentials need to be added for authentication.
For example, to show the resources of the postgresql charm:
juju charm-resources postgresql
Sample output:
Resource Revision
wal-e 0
Application resources
These are resources that a deployed application is currently using across all
its units and are discoverable with the resources
command. In contrast to the
charm-resources
command, this command needs a controller (that it queries) as
well as a deployed charm.
For example, to show the resources of the postgresql application:
juju resources postgresql
Sample output:
[Service]
Resource Supplied by Revision
wal-e charmstore 0
An application gains resources, typically by a charm developer, via the
attach-resource
command:
juju attach-resource postgresql wal-e=/home/ubuntu/resources/wal-e-upgrade.snap
Where the charm's metadata.yaml
file contains the following stanza:
"resources":
"wal-e":
"type": "file"
"filename": "wal-e.snap"
"description": "WAL-E Snap Package"
Unit resources
These are the resources that an individual unit (of an application) is currently using.
For example, to list the resources of unit 'postgresql/0':
juju resources postgresql/0
Sample output:
No resources to display.
Above we see the case where there is an absence of active resources at the unit level.