Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions docs/howto/manage-channels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,32 @@ When you register a name on Charmhub, that automatically creates 4 channels, all
track ``latest`` but with different risk levels, namely, ``edge``, ``beta``,
``candidate``, ``stable``, respectively.

See more: :ref:`register-a-name`
.. See more: :ref:`register-a-name`

Comment thread
jahn-junior marked this conversation as resolved.
Outdated
.. raw:: html
.. A charm channel consists of three pieces, in this order: <track>/<risk>/<branch>.

<!--
A charm channel consists of three pieces, in this order: <track>/<risk>/<branch>.
.. The <risk> refers to one of the following risk levels:

The <risk> refers to one of the following risk levels:
.. stable: (default) This is the latest, tested, working stable version of the charm.
.. candidate: A release candidate. There is high confidence this will work fine, but there may be minor bugs.
.. beta: A beta testing milestone release.
.. edge: The very latest version - expect bugs!

stable: (default) This is the latest, tested, working stable version of the charm.
candidate: A release candidate. There is high confidence this will work fine, but there may be minor bugs.
beta: A beta testing milestone release.
edge: The very latest version - expect bugs!

.. When you register, you get a track called `latest` with all the usual risk levels. So, you get all of:

When you register, you get a track called `latest` with all the usual risk levels. So, you get all of:
.. latest/stable
.. latest/candidate
.. latest/beta
.. latest/edge

latest/stable
latest/candidate
latest/beta
latest/edge
.. This counts as 4 separate channels. They're created implicitly. (They're only _opened_ if you release a revision to them.)

This counts as 4 separate channels. They're created implicitly. (They're only _opened_ if you release a revision to them.)
.. The track is what you request a guardrail and create a new of (not the channel).

The track is what you request a guardrail and create a new of (not the channel).

Later on, if you specify a channel, you get:
- An implicit stable risk, if you don't declare a risk.
- An implicit empty branch, if you don't declare a branch.
-->
.. Later on, if you specify a channel, you get:
.. - An implicit stable risk, if you don't declare a risk.
.. - An implicit empty branch, if you don't declare a branch.

View the available channels
---------------------------
Expand All @@ -57,6 +53,7 @@ The following output shows four channels, all of which have the same track, ``la
but different risk levels, namely, ``edge``, ``beta``, ``candidate``, and ``stable``.

.. terminal::
:output-only:

Track Channel Version Revision
latest stable - -
Expand Down
30 changes: 12 additions & 18 deletions docs/howto/manage-charmcraft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,12 @@ to `these instructions <https://brew.sh/>`_).

brew install charmcraft

.. terminal::

==> Downloading https://ghcr.io/v2/homebrew/core/charmcraft/manifests/1.3.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/charmcraft/blobs/sha256:ebe7aac3dcfa401762faaf339a28e64bb5fb277a7d96bbcfb72bdc
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:ebe7aac3dcfa401762faaf339a28e64bb5fb277a7d
######################################################################## 100.0%
==> Pouring charmcraft--1.3.2.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/charmcraft/1.3.2: 2,205 files, 17.2MB

Charmhub commands work natively:

.. code-block:: bash
.. terminal::

charmcraft whoami

name: John Doe
username: jdoe
id: xxxxxxxxxxxxxxxxxxxxxxxxx
Expand All @@ -76,12 +67,10 @@ In macOS, Charmcraft defaults to Multipass to build the charms in a container ma
the target bases. Running pack asks to setup Multipass if not already installed, and
continues with the packing process:

.. code-block:: bash

$ charmcraft pack

.. terminal::

charmcraft pack

Multipass is required, but not installed. Do you wish to install Multipass and configure it with the defaults? [y/N]: y
==> Downloading https://github.com/canonical/multipass/releases/download/v1.7.2/multipass-1.7.2+mac-Darwin.pkg
Already downloaded: /Users/jdoe/Library/Caches/Homebrew/downloads/4237fcef800faa84459a2911c3818dfa76f1532d693b151438f1c8266318715b--multipass-1.7.2+mac-Darwin.pkg
Expand Down Expand Up @@ -119,11 +108,16 @@ a fresh new VM with 4 cores, 8GB RAM and a 20GB disk and the name ‘charm-dev':

Last, open a shell in your new Ubuntu virtual machine, and install Charmcraft there:

.. code-block:: bash
.. terminal::

multipass shell charm-dev
...
ubuntu@charm-dev:~$ sudo snap install charmcraft --classic

.. terminal::
:user: ubuntu
:host: charm-dev
Comment on lines +111 to +117

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These will get merged into a single terminal session once we bump the sphinx-terminal version.


sudo snap install charmcraft --classic

charmcraft 2.2.0 from Canonical✓ installed

That's it. You can now start typing in Charmcraft commands.
Expand Down
30 changes: 8 additions & 22 deletions docs/howto/manage-charms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -544,37 +544,31 @@ is just a zip file with metadata and the operator code itself.

Pack the charm:

.. code-block:: bash
.. terminal::

charmcraft pack

.. terminal::

Created 'microsample-vm_ubuntu-22.04-amd64.charm'.
Charms packed:
microsample-vm_ubuntu-22.04-amd64.charm

Optionally, verify that this has created a .charm file in your charm's root directory:

.. code-block:: bash
.. terminal::

ls

.. terminal::

CONTRIBUTING.md charmcraft.yaml requirements.txt tox.ini
LICENSE microsample-vm_ubuntu-22.04-amd64.charm src
README.md pyproject.toml tests

Optionally, verify that the .charm file is simply a zip file that contains
everything you've packed plus any dependencies:

.. code-block:: bash
.. terminal::

unzip -l microsample-vm_ubuntu-22.04-amd64.charm | { head; tail;}

.. terminal::

Archive: microsample-vm_ubuntu-22.04-amd64.charm
Length Date Time Name
--------- ---------- ----- ----
Expand Down Expand Up @@ -653,12 +647,10 @@ Publish a charm
3. Upload the charm to Charmhub: Use the ``charmcraft upload`` command followed by the
your charm's path. E.g., if you are in the charm's root directory,

.. code-block:: bash
.. terminal::

charmcraft upload my-awesome-charm.charm

.. terminal::

Revision 1 of my-awesome-charm created

..
Expand All @@ -673,13 +665,10 @@ Publish a charm
4. If your charm has associated resources: These are not packed with the rest of the
charm project, so you must upload them explicitly to Charmhub as well. For example:

.. code-block:: bash

charmcraft upload-resource my-awesome-charm someresource
--filepath=/tmp/superdb.bin

.. terminal::

charmcraft upload-resource my-awesome-charm someresource --filepath=/tmp/superdb.bin

Revision 1 created of resource 'someresource' for charm 'my-awesome-charm'

..
Expand All @@ -695,13 +684,10 @@ Publish a charm
target release channel. For a charm that has a resource, also specify the
resource and its revision. E.g.,

.. code-block:: bash

charmcraft release my-awesome-charm --revision=1 --channel=beta
--resource someresource:1

.. terminal::

charmcraft release my-awesome-charm --revision=1 --channel=beta --resource someresource:1

Revision 1 of charm 'my-awesome-charm' released to beta (attaching resources: 'someresource' r1)

..
Expand Down
13 changes: 4 additions & 9 deletions docs/howto/manage-extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extension.
charmcraft init --profile flask-framework

.. terminal::
:output-only:
Comment thread
jahn-junior marked this conversation as resolved.
Outdated

Charmed operator package file and directory tree initialised.

Expand All @@ -57,23 +58,18 @@ extension.
src/charm.py
README.md

.. code-block:: bash
.. terminal::

ls -R

.. terminal::

.:
charmcraft.yaml requirements.txt src

./src:
charm.py

.. code-block:: bash

cat charmcraft.yaml

.. code-block:: yaml
:caption: charmcraft.yaml

name: my-flask-app-k8s

Expand Down Expand Up @@ -112,11 +108,10 @@ then run ``charmcraft expand-extensions``. For example:

.. dropdown:: Expanding an extension

.. code-block:: bash
.. terminal::

CHARMCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS=1 charmcraft expand-extensions

.. terminal::

*EXPERIMENTAL* extension 'flask-framework' enabled
name: my-flask-app-k8s
Expand Down
12 changes: 4 additions & 8 deletions docs/howto/manage-resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,17 @@ and ``--filepath=<path to file resource>`` / ``--image=<OCI image>``. For exampl
using the "short form" of the digest, the image needs to be present locally so its
proper ID (the "long form") can be retrieved.

.. code-block:: bash

charmcraft upload-resource my-super-charm someresource --filepath=/tmp/superdb.bin

.. terminal::

charmcraft upload-resource my-super-charm someresource --filepath=/tmp/superdb.bin

Revision 1 created of resource 'someresource' for charm 'my-super-charm'

.. code-block:: bash
.. terminal::

charmcraft upload-resource my-super-charm redis-image --image=sha256:64aa8983ec5cea7bc143af18829836914fa405184d56dcbdfd9df672ade85249

.. terminal::

Revision 1 created of resource 'redis-image' for charm 'my-super-charm'
Revision 1 created of resource 'redis-image' for charm 'my-super-charm'

Charmcraft will first check if that specific image is available in Canonical's Registry,
and just use it if that's the case. If not, it will try to get it from the developer's
Expand Down
5 changes: 2 additions & 3 deletions docs/howto/manage-revisions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ maintained separately from Charmcraft.
``3.6/candidate``.)

.. terminal::
:output-only:

channels: |
5/stable: 117 2023-04-20 (117) 12MB amd64 ubuntu@22.04
Expand All @@ -72,12 +73,10 @@ To :ref:`ref_commands_release` a specific charm revision to a channel, run ``cha
followed by the name of the charm and flags specifying the revision and
its target channel. For example,

.. code-block:: bash
.. terminal::

charmcraft release my-awesome-charm --revision=1 --channel=beta

.. terminal::

Revision 1 of charm 'my-awesome-charm' released to beta

This opens the channel you're releasing to. For more information on
Expand Down
6 changes: 2 additions & 4 deletions docs/howto/manage-the-current-charmhub-user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ Local environments

To log in to Charmhub, run :ref:`charmcraft login <ref_commands_login>`:

.. code-block:: bash

charmcraft login

.. terminal::

charmcraft login

Opening an authorization web page in your browser.
If it does not open, please open this URL:
...
Expand Down
17 changes: 9 additions & 8 deletions docs/howto/manage-web-app-charms/configure-web-app-charm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -417,21 +417,22 @@ simultaneous requests with curl:

.. code:: bash

curl --parallel --parallel-immediate --resolve flask-async-app:80:127.0.0.1 \
http://flask-async-app/io http://flask-async-app/io http://flask-async-app/io \
http://flask-async-app/io http://flask-async-app/io
curl --parallel --parallel-immediate --resolve flask-async-app:80:127.0.0.1 \
http://flask-async-app/io http://flask-async-app/io http://flask-async-app/io \
http://flask-async-app/io http://flask-async-app/io

and they will all return at the same time.

The results should arrive simultaneously and contain five instances of ``ok``:

.. terminal::
:output-only:
Comment thread
jahn-junior marked this conversation as resolved.
Outdated

ok
ok
ok
ok
ok
ok
ok
ok
ok
ok

It can take up to a minute for the configuration to take effect. When the
configuration changes, the charm will re-enter the active state, which you
Expand Down
1 change: 1 addition & 0 deletions docs/howto/manage-web-app-charms/use-web-app-charm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ From the list of URLs, look for the endpoint that contains a ``grafana``
suffix. This URL has the format:

.. terminal::
:output-only:

http://<IP_ADDRESS>/<JUJU_MODEL_NAME>-grafana

Expand Down
14 changes: 4 additions & 10 deletions docs/howto/pack-a-hooks-based-charm-with-charmcraft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,10 @@ If successful, the result should look like the following.
The charm file should contain all the files listed in the ``prime`` section of the
``tiny-bash`` part and the charm manifest.

.. code-block:: bash
.. terminal::

unzip -l tiny-bash_ubuntu-20.04-amd64.charm

.. terminal::

Archive: tiny-bash_ubuntu-20.04-amd64.charm
Length Date Time Name
--------- ---------- ----- ----
Expand All @@ -90,24 +88,20 @@ The charm file should contain all the files listed in the ``prime`` section of t

And you can also deploy your application with ``juju deploy``, as usual:

.. code-block:: bash

juju deploy ./tiny-bash_ubuntu-20.04-amd64.charm

.. terminal::

juju deploy ./tiny-bash_ubuntu-20.04-amd64.charm

Located local charm "tiny-bash", revision 0
Deploying "tiny-bash" from local charm "tiny-bash", revision 0

If successful, the result should look as below, i.e., with the application status
active.

.. code-block:: bash
.. terminal::

juju status

.. terminal::

Model Controller Cloud/Region Version SLA Timestamp
default localhost-localhost localhost/localhost 2.9.12 unsupported 17:23:23-03:00

Expand Down