-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add, refactor, and reformat discourse docs feat. charmcraft (#2010
) This PR adds all the juju.is/docs content featuring Charmcraft. The content was originally formatted for Discourse; this PR reformats it to serve the RTD project the docs are destined for. The content was also originally entangled with Ops content; this PR significantly refactors -- as well as clarifies and tries to complete -- everything to serve the stand-alone Charmcraft docs set it is destined for. Issues that should be fixed in subsequent PRs: - Everywhere: (1) (a) Links to juju.is will work, as even after moving docs out of there we'll have redirects; however, they should be updated. (b) Links to ops docs are empty -- they reference content I'm planning to move there post-refactoring; once we have them in place, which should be in the next few days and pre-official-Charmcraft-RTD-launch, we should add them in Charmcraft docs. - Tutorial: The tutorial should also be offered in the "regular" flavor, that is, for apps that are not 12-factor. That flavor should also feature the publish step. (See, e.g., our old Kubernetes tutorial, which includes https://juju.is/docs/sdk/publish-your-charm-on-charmhub . PS If the Charmcraft tutorial starts featuring this, as it should, the old Kubernetes tutorial, which will be moved to the stand-alone Ops docs, can focus on just development, which is what Ops is really all about.) - How-to guides: While this PR surfaces a lot more of Charmcraft and arguably a lot more clearly, there are still corners with cobwebs or gaps. These include: (1) Manage charms (12-factor app) -- I think this doc should be incorporated into the main Manage charms doc, which could have tabs for "regular', "django", etc. (This would align with plans for the juju.is/docs entrypoint into the "federated docs"). (2) The Manage parts doc, which is full of "TBA" -- i.e., has gaps. (3) The docs in "Misc", which are not well integrated with everything else here. (4) Maybe the Manage bundles doc, which doesn't by far tell the full story; given that we're phasing bundles out, it's also perhaps fine not to worry about this too much. (5) Commands `analyse` and `test` are not featured in any how-to guide. - Reference: (1) The autogenerated `charmcraft` CLI command reference docs should have anchors on the template `command-charmcraft-x` and titles on the template "Command `charmcraft x`. This will not better align with existing practices in the Juju world but also results in more clarity when linking to the page using `{ref}`...`` (2) The various file reference docs should be as much as possible autogenerated from source (likely the source will have to be updated first) -- at the very least, file `charmcraft.yaml`. They may also need further clean-up. (3) The part docs are a bit of a mess. We should move any relevant content to the part docs, then link up to that and only keep in Charmcraft the material specific to Charmcraft docs, and then revisit that material as well to streamline it as much as possible (e.g., currently the dump plugin is documented in 3 places). (4) Charmcraft analyzers and linters -- this gives details on pack and analyse but it's not clear in what way it's useful to the reader, so we need to rethink. - Explanation: We have nothing there. I didn't delete that section as I think there is potentially a topic we could have there -- e.g., Charmcraft in the bigger context of Starcraft (a clarification of the general design philosophy there and trends, maybe). PS Some docs may have a Contributors list on the bottom, listing the Discourse handles of the contributors to date. We'll want to rethink how we do that. --------- Co-authored-by: Erin Conley <[email protected]> Co-authored-by: Michael DuBelko <[email protected]> Co-authored-by: Alex Lowe <[email protected]> Co-authored-by: Michael DuBelko <[email protected]>
- Loading branch information
1 parent
7348ef5
commit a1a3d4b
Showing
71 changed files
with
9,776 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
.. _explanation: | ||
|
||
Explanation | ||
*********** | ||
=========== | ||
|
||
As Charmcraft is a part of the `Juju Charm SDK <https://juju.is/docs/sdk>`_, most | ||
explanation is hosted on the `Charm SDK docs <https://juju.is/docs/sdk/explanation>`_. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
/common/craft-parts/explanation/dump_plugin | ||
/common/craft-parts/explanation/filesets | ||
lifecycle | ||
|
||
|
||
`Charm SDK docs <https://juju.is/docs/sdk/explanation>`_ | ||
======================================================== | ||
.. toctree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.. _howto-build-guides: | ||
|
||
Build guides | ||
============ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
Cache intermediate build artefacts <shared-cache> | ||
Pack a hook-based charm with Charmcraft <pack-a-hooks-based-charm-with-charmcraft> | ||
Pack a reactive charm with Charmcraft <pack-a-reactive-charm-with-charmcraft> |
120 changes: 120 additions & 0 deletions
120
docs/howto/build-guides/pack-a-hooks-based-charm-with-charmcraft.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
.. _pack-a-hooks-based-charm-with-charmcraft: | ||
|
||
How to pack a hooks-based charm with Charmcraft | ||
=============================================== | ||
|
||
Introduced in Charmcraft 1.4 | ||
|
||
See first: :external+ops:ref:`turn-a-hooks-based-charm-into-an-ops-charm` | ||
|
||
Suppose you have a legacy hooks-only charm, for example, `tiny-bash | ||
<https://github.com/erik78se/tiny-bash>`_, which you can clone with: | ||
|
||
.. code-block:: bash | ||
git clone https://github.com/erik78se/tiny-bash | ||
To make it packable by Charmcraft, all you need to do is navigate inside the charm | ||
directory and create a ``charmcraft.yaml`` file with the part definition for a | ||
hooks-based charm, as shown below: | ||
|
||
.. code-block:: yaml | ||
type: charm | ||
bases: | ||
- build-on: | ||
- name: "ubuntu" | ||
channel: "20.04" | ||
run-on: | ||
- name: "ubuntu" | ||
channel: "20.04" | ||
parts: | ||
tiny-bash: | ||
plugin: dump | ||
source: . | ||
prime: | ||
- LICENSE | ||
- README.md | ||
- config.yaml | ||
- copyright | ||
- hooks | ||
- icon.svg | ||
- metadata.yaml | ||
After this, you can pack your charm with ``charmcraft pack``, as usual: | ||
|
||
.. code-block:: bash | ||
charmcraft pack | ||
If successful, the result should look like the following. | ||
|
||
.. terminal:: | ||
|
||
Charms packed: | ||
tiny-bash_ubuntu-20.04-amd64.charm | ||
|
||
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 | ||
unzip -l tiny-bash_ubuntu-20.04-amd64.charm | ||
.. terminal:: | ||
|
||
Archive: tiny-bash_ubuntu-20.04-amd64.charm | ||
Length Date Time Name | ||
--------- ---------- ----- ---- | ||
423 2021-11-12 19:37 metadata.yaml | ||
431 2021-11-12 19:37 README.md | ||
12 2021-11-12 19:37 config.yaml | ||
3693 2021-11-12 19:37 icon.svg | ||
38 2021-11-12 19:37 copyright | ||
261 2021-11-12 20:08 manifest.yaml | ||
34523 2021-11-12 19:37 LICENSE | ||
381 2021-11-12 19:37 hooks/update-status | ||
346 2021-11-12 19:37 hooks/start | ||
1294 2021-11-12 19:37 hooks/shared-fs-relation-changed | ||
563 2021-11-12 19:37 hooks/stop | ||
497 2021-11-12 19:37 hooks/leader-elected | ||
447 2021-11-12 19:37 hooks/install | ||
417 2021-11-12 19:37 hooks/leader-settings-changed | ||
811 2021-11-12 19:37 hooks/upgrade-charm | ||
625 2021-11-12 19:37 hooks/config-changed | ||
--------- ------- | ||
44762 16 files | ||
|
||
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:: | ||
|
||
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 | ||
juju status | ||
.. terminal:: | ||
|
||
Model Controller Cloud/Region Version SLA Timestamp | ||
default localhost-localhost localhost/localhost 2.9.12 unsupported 17:23:23-03:00 | ||
|
||
App Version Status Scale Charm Store Channel Rev OS Message | ||
tiny-bash active 1 tiny-bash local 0 ubuntu update-status ran: 20:22 | ||
|
||
Unit Workload Agent Machine Public address Ports Message | ||
tiny-bash/0* active idle 0 10.2.17.31 update-status ran: 20:22 | ||
|
||
Machine State DNS Inst id Series AZ Message | ||
0 started 10.2.17.31 juju-55481c-0 focal Running |
35 changes: 35 additions & 0 deletions
35
docs/howto/build-guides/pack-a-reactive-charm-with-charmcraft.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.. _pack-a-reactive-charm-with-charmcraft: | ||
|
||
How to pack a reactive charm with Charmcraft | ||
================================================== | ||
|
||
Introduced in Charmcraft 1.4. | ||
|
||
|
||
.. See also: - | ||
.. {ref}\ ``How to set up a charm project <how-to-set-up-a-charm-project>`` | ||
.. - | ||
.. {ref}\ ``How to pack your charm using Charmcraft <how-to-pack-a-charm>`` | ||
.. - {ref}\ ``About charm types, by creation type <charm-taxonomy>`` | ||
To pack a legacy reactive charm with Charmcraft, in the charm directory create a | ||
``charmcraft.yaml`` file with the part definition for a reactive-based charm: | ||
|
||
.. code-block:: yaml | ||
type: "charm" | ||
bases: | ||
- build-on: | ||
- name: "ubuntu" | ||
channel: "20.04" | ||
run-on: | ||
- name: "ubuntu" | ||
channel: "20.04" | ||
parts: | ||
charm: | ||
source: . | ||
plugin: reactive | ||
build-snaps: [charm] | ||
Done. Now you can go ahead and pack your reactive-based charm with Charmcraft | ||
in the usual way using ``charmcraft pack``. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
.. _howto: | ||
.. _how-to-guides: | ||
|
||
How-To | ||
****** | ||
How-to guides | ||
============= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
charm-to-poetry | ||
charm-to-python | ||
shared-cache | ||
set-up-charmcraft | ||
manage-charms | ||
manage-a-12-factor-app-charm | ||
manage-extensions | ||
manage-resources | ||
manage-libraries | ||
manage-parts | ||
manage-the-current-charmhub-user | ||
manage-names | ||
manage-revisions | ||
manage-channels | ||
manage-tracks | ||
manage-icons | ||
manage-bundles | ||
flask-async | ||
Migrate plugins <migrate-plugins/index> | ||
Build <build-guides/index> |
Oops, something went wrong.