I am trying to understand the hooks for a juju charm, some of them are rather obvious and easy to understand (start
, stop
, install
,etc), others not really.
How many hooks are there, when are they called, for what function?
I am looking for a good list of hooks and their descriptions.
The documentation for all available hooks is available here:
The basic lifecycle (install, start, stop) and relation hooks are documented under charms. Relation hooks are defined for every relation a charm defines in its metadata.
Beyond those there are two other hooks of interest, the 'upgrade-charm' hook, which is called when a service's charm is upgraded for each of its service units.
The other is the 'config-changed' hook, called when a charm which defines a service configuration schema has its configuration changed, since services can be deployed with configuration data, the config-changed hook is also invoked upon the initial deploy of a unit prior to starting it.
all hooks are optional.