1# juju plugin 2 3This plugin provides useful aliases and functions for [juju](https://juju.is/) (for TAB completion, 4refer to the [official repo](https://github.com/juju/juju/blob/develop/etc/bash_completion.d/juju)). 5 6To use this plugin, add `juju` to the plugins array in your zshrc file. 7 8```zsh 9plugins=(... juju) 10``` 11 12## Aliases 13 14Naming convention: 15 16- `!` suffix: `--force --no-wait -y`. 17- `ds` suffix: `--destroy-storage`. 18 19### General 20 21| Alias | Command | Description | 22|--------|---------------------------------------------|--------------------------------------------------------| 23| `jdl` | `juju debug-log --ms` | Display log, with millisecond resolution | 24| `jdlr` | `juju debug-log --ms --replay` | Replay entire log | 25| `jh` | `juju help` | Show help on a command or other topic | 26| `jssl` | `juju juju show-status-log` | Output past statuses for the specified entity | 27| `jstj` | `juju status --format=json` | Show status in json format (more detailed) | 28| `jst` | `juju status --relations --storage --color` | Show status, including relations and storage, in color | 29 30### Bootstrap 31 32| Alias | Command | Description | 33|-------|---------------------------|-------------------------------------------| 34| `jb` | `juju bootstrap` | Initializing a Juju cloud environment | 35| `jbm` | `juju bootstrap microk8s` | Initializing a MicroK8s cloud environment | 36 37### Controller 38 39| Alias | Command | Description | 40|----------|---------------------------------------------------------------------------------------|-------------------------------------------------------------------| 41| `jdc` | `juju destroy-controller --destroy-all-models` | Destroy a controller | 42| `jdc!` | `juju destroy-controller --destroy-all-models --force --no-wait -y` | Destroy a controller | 43| `jdcds` | `juju destroy-controller --destroy-all-models --destroy-storage` | Destroy a controller and associated storage | 44| `jdcds!` | `juju destroy-controller --destroy-all-models --destroy-storage --force --no-wait -y` | Destroy a controller and associated storage | 45| `jkc` | `juju kill-controller -y -t 0` | Forcibly terminate all associated resources for a Juju controller | 46| `jsw` | `juju switch` | Select or identify the current controller and model | 47 48### Model 49 50| Alias | Command | Description | 51|----------|-------------------------------------------------------------|-------------------------------------------------------| 52| `jam` | `juju add-model` | Add a hosted model | 53| `jdm` | `juju destroy-model` | Non-recoverable, complete removal of a model | 54| `jdm!` | `juju destroy-model --force --no-wait -y` | Non-recoverable, complete removal of a model | 55| `jdmds` | `juju destroy-model --destroy-storage` | Non-recoverable, complete removal of a model | 56| `jdmds!` | `juju destroy-model --destroy-storage --force --no-wait -y` | Non-recoverable, complete removal of a model | 57| `jmc` | `juju model-config` | Display or set configuration values on a model | 58| `jm` | `juju models` | List models a user can access on a controller | 59| `jshm` | `juju show-model` | Show information about the current or specified model | 60| `jsw` | `juju switch` | Select or identify the current controller and model | 61 62### Application / unit 63 64| Alias | Command | Description | 65|----------|---------------------------------------------------------------|---------------------------------------------------------------------------| 66| `jc` | `juju config` | Get, set, or reset configuration for a deployed application | 67| `jde` | `juju deploy --channel=edge` | Deploy a new application or bundle from the edge channel | 68| `jd` | `juju deploy` | Deploy a new application or bundle | 69| `jra` | `juju run-action` | Queue an action for execution | 70| `jraw` | `juju run-action --wait` | Queue an action for execution and wait for results, with optional timeout | 71| `jrm` | `juju remove-application` | Remove application | 72| `jrm!` | `juju remove-application --force --no-wait` | Remove application forcefully | 73| `jrmds` | `juju remove-application --destroy-storage` | Remove application and destroy attached storage | 74| `jrmds!` | `juju remove-application --destroy-storage --force --no-wait` | Remove application forcefully, destroying attached storage | 75| `jrp` | `juju refresh --path` | Upgrade charm from local charm file | 76| `jsa` | `juju scale-application` | Set the desired number of application units | 77| `jsh` | `juju ssh` | Initiate an SSH session or execute a command on a Juju target | 78| `jshc` | `juju ssh --container` | Initiate an SSH session or execute a command on a given container | 79| `jsu` | `juju show-unit` | Displays information about a unit | 80 81### Storage 82 83| Alias | Command | Description | 84|---------|-------------------------------|-------------------------------------------------| 85| `jrs` | `juju remove-storage` | Remove storage | 86| `jrs!` | `juju remove-storage --force` | Remove storage even if it is currently attached | 87 88### Relation 89 90| Alias | Command | Description | 91|-----------|--------------------------------|-------------------------------------------------------------------| 92| `jrel` | `juju relate` | Relate two applications | 93| `jrmrel` | `juju remove-relation` | Remove an existing relation between two applications. | 94| `jrmrel!` | `juju remove-relation --force` | Remove an existing relation between two applications, forcefully. | 95 96### Cross-model relation (CMR) 97 98| Alias | Command | Description | 99|----------|--------------------|----------------------------------------------------------------| 100| `jex` | `juju expose` | Make an application publicly available over the network | 101| `jof` | `juju offer` | Offer application endpoints for use in other models | 102| `jcon` | `juju consume` | Add a remote offer to the model | 103| `jrmsas` | `juju remove-saas` | Remove consumed applications (SAAS) from the model | 104| `junex` | `juju unexpose` | Remove public availability over the network for an application | 105 106### Bundle 107 108| Alias | Command | Description | 109|-------|----------------------|-------------------------------------------------------------| 110| `jeb` | `juju export-bundle` | Export the current model configuration as a reusable bundle | 111 112## Functions 113 114- `jaddr <app_name> [unit_num]`: display app or unit IP address. 115- `jreld <relation_name> <app_name> <unit_num>`: display app and unit relation data. 116- `wjst [interval_secs] [args_for_watch]`: watch juju status, with optional interval 117 (default: 5s); you may pass additional arguments to `watch`. 118