How to deploy a charm

You’ve packed your charm. This document shows you how you can now deploy your charm to a cloud of your choosing. This can be easily done with the Juju OLM, assuming you’ve already set it up with the cloud and added a model.

Before we do start deploying, let’s first configure the Juju model to display DEBUG level log messages and watch the output. Open a terminal and run the following:

# Set the default log level to DEBUG
$ juju model-config logging-config="<root>=WARNING;unit=DEBUG"
# Tail the Juju log
$ juju debug-log

Now, going back to the terminal where you packed your charm, run:

$ juju deploy ./my-new-charm.charm 
# Watch the Juju status to see the Charm's progress
$ watch -c juju status --color

The deployment will take about 30 seconds, and you should see the various operator events being triggered in the juju debug-log output. If all goes well, you should see output similar to the following from watch -c juju status --color:

Model        Controller  Cloud/Region        Version  SLA          Timestamp
development  micro       microk8s/localhost  2.9.0    unsupported  10:25:35+01:00

App             Version  Status  Scale  Charm           Store  Channel  Rev  OS          Address  Message
my-new-charm          active      1  my-new-charm  local             0  kubernetes           

Unit               Workload  Agent  Address       Ports  Message
hello-operator/0*  active    idle                

Note that you can inspect the content of your charm easily—the bundle is just a zip file! Go ahead and open up my-new-charm.charm in your native archive viewer to see how the charm gets packaged up.