Merge ~woutervb/snap-store-proxy-charm:SN-486 into snap-store-proxy-charm:master

Proposed by Wouter van Bommel
Status: Merged
Approved by: Wouter van Bommel
Approved revision: a595b28351bd2be2dd9607cf389e4ecd3c5eba42
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~woutervb/snap-store-proxy-charm:SN-486
Merge into: snap-store-proxy-charm:master
Diff against target: 199 lines (+146/-0)
7 files modified
Makefile (+2/-0)
README.md (+6/-0)
docs/contributing.md (+26/-0)
docs/install.md (+68/-0)
docs/snap-store-proxy-charm docs - index.md (+29/-0)
docs/upgrading.md (+14/-0)
requirements-dev.txt (+1/-0)
Reviewer Review Type Date Requested Status
Przemysław Suliga Approve
Review via email: mp+416142@code.launchpad.net

Commit message

Initial start of documentation

The idea is to have the charm documentation (that is published via discourse) as part of the code repository, so that it can grow with the evolution of the charm.

As far as currently known, there is now way to automate the publishing.

Description of the change

This documentation refers to a snap called `store-admin` which is currently under development as it is an evolution of the current snap-store-client snap. So documentation should not be made life before this snap is available, but that allows proofreading / fine tuning of what we actually publish.

To post a comment you must log in.
Revision history for this message
Wouter van Bommel (woutervb) wrote :

Added a comment for reviewers

Revision history for this message
Przemysław Suliga (suligap) wrote :

lgtm with some typos / small fixes.

review: Approve
Revision history for this message
Wouter van Bommel (woutervb) wrote :

> lgtm with some typos / small fixes.

Thanks fixed all but one PostgreSQL vs PostgresSQL, did a lookup of the first one

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index c09cee6..cea8799 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -60,6 +60,8 @@ lint: $(ENV)
6 @$(ENV)/bin/black --check src tests
7 @echo Running isort
8 @$(ENV)/bin/isort --profile black --check src tests
9+ @echo Running documentation lint
10+ @$(ENV)/bin/pymarkdown -d MD041,MD025 scan docs
11
12 .PHONY: clean
13 clean: $(CHARMCRAFT)
14diff --git a/README.md b/README.md
15index 2a76997..0c0b870 100644
16--- a/README.md
17+++ b/README.md
18@@ -79,3 +79,9 @@ An example bundle to do such a deployment will look like the following.
19 - snap-store-proxy:db-admin
20
21 With the above example it is assumed that both the `core20.snap` and the `snap-store-proxy.snap` are available in the current directory. The snaps can be downloaded using the `snap download core20` and `snap download snap-store-proxy` resp.
22+
23+# Documentation
24+
25+Documentation of the charm will be published on discourse, following the guide https://juju.is/tutorials/add-docs-to-your-charmhub-page#1-overview. Since there is no version history or any form of checking for correctness on discourse. The pages published there, will be a mirror of what is actually present in the `docs/` directory.
26+
27+As the markup used on discourse is commonmark, the lint make target has been adapted to validate all the files in the docs directory.
28\ No newline at end of file
29diff --git a/docs/contributing.md b/docs/contributing.md
30new file mode 100644
31index 0000000..0958697
32--- /dev/null
33+++ b/docs/contributing.md
34@@ -0,0 +1,26 @@
35+For any problems with this charm, please [report here](https://bugs.launchpad.net/snap-store-proxy-charm/+filebug)
36+
37+Development takes place on `Ubuntu Focal` (20.04-lts) which is also the target Ubuntu
38+release for the charm. The only supported architecture for now is `AMD64`.
39+
40+To obtain the code use the following command:
41+
42+ git clone https://git.launchpad.net/snap-store-proxy-charm
43+
44+Tests can be run via `make test` from within the code directory.
45+
46+# Local deployment
47+
48+To deploy locally, juju and lxd are required, and tje charm and postgresql will
49+be deployed to the same model.
50+
51+ sudo apt install make
52+ sudo snap install lxd
53+ sudo snap install juju --classic
54+ # Be sure to disable ipv6 for now, as juju doesn't support it
55+ sudo lxd init
56+ juju bootstrap localhost
57+
58+ # Use the deploy target defined in the Makefile
59+ make deploy
60+ # and follow any instruction given
61diff --git a/docs/install.md b/docs/install.md
62new file mode 100644
63index 0000000..3f6ba93
64--- /dev/null
65+++ b/docs/install.md
66@@ -0,0 +1,68 @@
67+This charm will install a snap-store-proxy on local premises. In order to do
68+this, a registration bundle is required. This registration bundle can be
69+obtained via the snap `store-admin`.
70+
71+The charm can be installed in two ways. The preferred way is to use the
72+snap-store itself, which means that the machine instances on which the
73+`snap-store-proxy-charm` is installed, needs to be to connect to the store.
74+
75+The other way is, to download the `snap-store-proxy*.snap` and the
76+`core20-*.snap` and attach these as resources to the `snap-store-proxy-charm`
77+during installation. After installation a resource can be updates via juju,
78+by attaching a newer resource. This will be the only way to update the charm.
79+
80+It is not possible to switch between these 2 modes of installation.
81+
82+# Basic install
83+
84+An example juju-bundle, that can be used for installation:
85+
86+ applications:
87+ postgresql:
88+ charm: ch:postgresql
89+ channel: stable
90+ num_units: 1
91+ snap-store-proxy:
92+ charm: ch:snap-store-proxy-charm
93+ num_units: 1
94+
95+ relations:
96+ - - postgresql:db-admin
97+ - snap-store-proxy:db-admin
98+
99+# Resource based install
100+
101+When using a resource based install the core20 an snap-store-proxy snap's can
102+be downloaded via the command: `snap download core20` and
103+`snap download snap-store-proxy`. Once this is done the following juju bundle
104+can be used for installation.
105+
106+ applications:
107+ postgresql:
108+ charm: ch:postgresql
109+ channel: stable
110+ num_units: 1
111+ snap-store-proxy:
112+ num_units: 1
113+ resources:
114+ snap-store-proxy: snap-store-proxy_<number>.snap
115+ core: core20_<number>.snap
116+
117+ relations:
118+ - - postgresql:db-admin
119+ - snap-store-proxy:db-admin
120+
121+# Configuration
122+
123+In both the installation examples above, the charm still needs to be
124+registered. This registration has to be done via the snap `store-admin` and
125+will produce a registration file. This registration file needs to be added,
126+encoded using base64, to the charm option called `registration_bundle`.
127+
128+I this file is called `register.json` the following command can be used:
129+
130+ juju config snap-store-proxy \
131+ registration_bundle=$(cat register.json | base64 -w 0)
132+
133+Obviously this can also be added to the juju deployment bundle, both methods,
134+registering during installation, or after installation, are supported.
135diff --git a/docs/snap-store-proxy-charm docs - index.md b/docs/snap-store-proxy-charm docs - index.md
136new file mode 100644
137index 0000000..ff47ce5
138--- /dev/null
139+++ b/docs/snap-store-proxy-charm docs - index.md
140@@ -0,0 +1,29 @@
141+A charm that install the snap-store-proxy snap
142+
143+To get started, deploy the charm in a test environment as follows:
144+
145+ juju deploy postgresql
146+ juju deploy snap-store-proxy-charm
147+ juju relate postgresql:db-admin snap-store-proxy-charm:db-admin
148+ juju config snap-store-proxy-charm registration_bundle=\
149+ $(cat <registration bundle> | base64)
150+
151+For more information on how to obtain a registration bundle [see here](https://snapcraft.io/store-admin).
152+
153+For more information about PostgreSQL and the relation [see this section](https://discourse.charmhub.io/t/mattermost-documentation-database-relations/3759).
154+
155+# Navigation
156+
157+| Level | Path | Navlink |
158+| -- | -- | -- |
159+| 1 | | [Overview](/t/topic-title/<ID>) |
160+| 1 | install | [install](/t/topic-title/<ID>) |
161+| 1 | contributing | [Contributing](/t/topic-title/<ID>) |
162+| 1 | upgrading | [Upgrading](/t/topic-title/<ID>) |
163+
164+# Redirects
165+
166+[details=Mapping table]
167+| Path | Location |
168+| -- | -- |
169+[/details]
170diff --git a/docs/upgrading.md b/docs/upgrading.md
171new file mode 100644
172index 0000000..f1ddcce
173--- /dev/null
174+++ b/docs/upgrading.md
175@@ -0,0 +1,14 @@
176+There are 2 parts of the charm can can be upgraded. The charm itself, and the
177+`snap-store-proxy.snap` that is manged by the charm.
178+
179+If the snap is installed from the snapstore, and the instance on which it is
180+installed, can reach the snapstore, it will update itself automatically.
181+
182+If the snap is installed as a resource, then upgrading means attaching the newer
183+version of the snap as a resource. In this case, also the core20.snap needs to be
184+updated manually.
185+
186+Upgrading the charm is done via juju, it is simply a matter of running the
187+[juju command to upgrade applications](https://juju.is/docs/upgrading-applications)
188+
189+ juju refresh snap-store-proxy-charm
190diff --git a/requirements-dev.txt b/requirements-dev.txt
191index 0948d86..cdd103c 100644
192--- a/requirements-dev.txt
193+++ b/requirements-dev.txt
194@@ -12,3 +12,4 @@ pytest-xdist
195 pytest-sugar
196 pytest-cov
197 pytest-isort
198+pymarkdownlnt
199\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: