Skip to content

Commit 4f0ee81

Browse files
committed
fixes for docs generation - missing links fixed with redirects
1 parent d8df00a commit 4f0ee81

File tree

10 files changed

+342
-49
lines changed

10 files changed

+342
-49
lines changed

.bumpversion.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ replace = 'version': '{new_version}'
4444
parse = 'releaseTime': '(?P<releaseTime>.*)'
4545
serialize = {releaseTime}
4646
replace = {utcnow:%Y-%m-%dT%H:%M:%SZ}
47+
48+
[bumpversion:file:docs/conf.py]
49+
search = '{current_version}'
50+
replace = '{new_version}'

CHANGES.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
The fix is to force `requests` to use the OS copy of the root cert bundle.
108108

109109
Fix for this error:
110-
```
110+
```console
111111
$ docker exec proxy python -c "import requests; requests.request('GET', 'https://lvupavicsmaster.ouranos.ca/geoserver')"
112112
Traceback (most recent call last):
113113
File "<string>", line 1, in <module>
@@ -123,13 +123,13 @@
123123
```
124124

125125
Default SSL root cert bundle of `requests`:
126-
```
126+
```console
127127
$ docker exec proxy python -c "import requests; print requests.certs.where()"
128128
/usr/local/lib/python2.7/dist-packages/requests/cacert.pem
129129
```
130130

131131
Confirm the fix works:
132-
```
132+
```console
133133
$ docker exec -it proxy bash
134134
root@37ed3a2a03ae:/opt/local/src/CanarieAPI/canarieapi# REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt python -c "import requests; requests.request('GET', 'https://lvupavicsmaster.ouranos.ca/geoserver')"
135135
root@37ed3a2a03ae:/opt/local/src/CanarieAPI/canarieapi#
@@ -714,7 +714,7 @@
714714
We have 4 Java component but only 1 is vulnerable: Thredds:
715715

716716
**After fix**:
717-
```
717+
```console
718718
$ docker run -it --rm unidata/thredds-docker:4.6.18 bash
719719
root@f65aadd2955c:/usr/local/tomcat# find -iname '**log4j**'
720720
./webapps/thredds/WEB-INF/classes/log4j2.xml
@@ -725,7 +725,7 @@
725725
```
726726

727727
**Before fix (unidata/thredds-docker:4.6.15)**:
728-
```
728+
```console
729729
$ docker exec -it thredds find / -iname '**log4j**'
730730
find: ‘/proc/1/map_files’: Operation not permitted
731731
find: ‘/proc/12/map_files’: Operation not permitted
@@ -740,7 +740,7 @@
740740
**Other components (ncwms2, geoserver, solr) have log4j older than version 2.0
741741
so supposedly not affected**:
742742

743-
```
743+
```console
744744
$ docker exec -it ncwms2 find / -iname '**log4j**'
745745
/opt/conda/envs/birdhouse/opt/apache-tomcat/webapps/ncWMS2/WEB-INF/classes/log4j.properties
746746
/opt/conda/envs/birdhouse/opt/apache-tomcat/webapps/ncWMS2/WEB-INF/lib/log4j-1.2.17.jar
@@ -1327,7 +1327,7 @@ Deployed to https://medus.ouranos.ca/jupyter/ for acceptance testing.
13271327
database updates if such users exist on your server instance. To look for possible duplicates, the following command
13281328
can be used. Duplicate entries must be updated or removed such that only unique emails are present.
13291329

1330-
```shell
1330+
```console
13311331
echo "select email,user_name from users" | \
13321332
docker exec -i postgres-magpie psql -U $POSTGRES_MAGPIE_USERNAME magpiedb | \
13331333
sort > /tmp/magpie_users.txt

Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,69 @@ bump-check: ## Verifies that required bumpversion files are found
159159
version: ## Display project version
160160
@-$(MSG_I) "$(APP_NAME) version: $(APP_VERSION)"
161161

162+
## --- Documentation targets --- ##
163+
164+
define BROWSER_PYSCRIPT
165+
import os, webbrowser, sys
166+
try:
167+
from urllib import pathname2url
168+
except:
169+
from urllib.request import pathname2url
170+
171+
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
172+
endef
173+
export BROWSER_PYSCRIPT
174+
override BROWSER_DISPLAY := python -c "$$BROWSER_PYSCRIPT"
175+
176+
override DOC_ROOT := docs
177+
override DOC_INDEX := $(DOC_ROOT)/_build/html/index.html
178+
override DOC_XARGS ?= ## additional arguments for Sphinx build
179+
override DOC_XARGS := $(call clean_opt,$(DOC_XARGS))
180+
override DOC_DEBUG ?= ## set debug logging for Sphinx build
181+
override DOC_DEBUG := $(call clean_opt,$(DOC_DEBUG))
182+
ifneq ($(DOC_DEBUG),)
183+
override DOC_XARGS := $(DOC_XARGS) -vv
184+
endif
185+
186+
$(DOC_INDEX):
187+
@-$(MSG_I) "Building docs..."
188+
@$(SHELL) -c '$(CONDA_CMD) "$(MAKE)" -C "$(DOC_ROOT)" SPHINXOPTS="$(DOC_XARGS)" html;'
189+
@-$(MSG_I) "Documentation available: [file://$(DOC_INDEX)]"
190+
191+
.PHONY: _force_docs
192+
_force_docs:
193+
@-rm -f "$(DOC_INDEX)"
194+
195+
# rm without quotes important below to allow regex
196+
.PHONY: docs-clean
197+
docs-clean: ## remove doc artifacts
198+
@-$(MSG_I) "Cleaning doc artifacts..."
199+
@-find "$(DOC_ROOT)/" -type f -name "$(APP_NAME)*.rst" -delete
200+
@-rm -f "$(DOC_ROOT)/modules.rst"
201+
@-rm -rf "$(DOC_ROOT)/_build"
202+
203+
.PHONY: docs-linkcheck
204+
docs-linkcheck: docs ## run check of external links in documentation for integrity
205+
@-$(MSG_I) "Running link checks on docs..."
206+
@$(SHELL) -c '$(CONDA_CMD) $(MAKE) -C "$(DOC_ROOT)" SPHINXOPTS="$(DOC_XARGS)" linkcheck'
207+
208+
.PHONY: docs-install
209+
docs-install: ## install package requirements for documentation generation
210+
@$(SHELL) -c '$(CONDA_CMD) pip install $(PIP_XARGS) -r "$(DOC_ROOT)/requirements.txt"'
211+
@-$(MSG_I) "Successfully installed docs requirements."
212+
213+
.PHONY: docs-only
214+
docs-only: _force_docs $(DOC_INDEX) ## generate documentation without requirements installation or cleanup
215+
216+
# NOTE: we need almost all base dependencies because magpie package needs to be parsed to generate OpenAPI
217+
.PHONY: docs
218+
docs: docs-install docs-clean docs-only ## generate Sphinx HTML documentation
219+
220+
.PHONY: docs-show
221+
docs-show: $(DOC_INDEX) ## display HTML webpage of generated documentation (build docs if missing)
222+
@-test -f "$(DOC_INDEX)" || $(MAKE) -C "$(APP_ROOT)" $(DOC_ROOT)
223+
$(BROWSER_DISPLAY) "$(DOC_INDEX)"
224+
162225
### Execution Targets ###
163226

164227
SCRIPT ?= birdhouse/pavics-compose.sh ## Script to run the stack

README.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ Power Analytics and Visualization for Climate Science - Powered by Birdhouse and
3636

3737
For GitHub navigation, see the following README pages:
3838

39-
* `README for general deployment <birdhouse/README.rst>`_
40-
* `README for extra core components <birdhouse/components/README.rst>`_
41-
* `README for optional components <birdhouse/optional-components/README.rst>`_
39+
* |readme_general|_
40+
* |readme_components|_
41+
* |readme_optional_components|_
42+
43+
.. |readme_general| replace:: README for general deployment
44+
.. _readme_general: birdhouse/README.rst
45+
.. |readme_components| replace:: README for extra core components
46+
.. _readme_components: birdhouse/components/README.rst
47+
.. |readme_optional_components| replace:: README for optional components
48+
.. _readme_optional_components: birdhouse/optional-components/README.rst

birdhouse/README.rst

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,29 @@ Requirements:
1717
* Install latest docker-ce and docker-compose for the chosen distro (not the
1818
version from the distro).
1919

20-
To run ``docker-compose`` for PAVICS, the `pavics-compose.sh <pavics-compose.sh>`_ (:download:`download </birdhouse/pavics-compose.sh>`) wrapper script must be used.
21-
This script will source the ``env.local`` file, apply the appropriate variable substitutions on all the configuration files
22-
".template", and run ``docker-compose`` with all the command line arguments given to `pavics-compose.sh <pavics-compose.sh>`_ (:download:`download </birdhouse/pavics-compose.sh>`).
23-
See `env.local.example <env.local.example>`_ (:download:`download </birdhouse/env.local.example>`) for more details on what can go into the ``env.local`` file.
20+
To run ``docker-compose`` for PAVICS, the `pavics-compose.sh <pavics-compose.sh>`_
21+
(:download:`download </birdhouse/pavics-compose.sh>`) wrapper script must be used.
22+
This script will source the ``env.local`` file, apply the appropriate variable substitutions
23+
on all the configuration files ".template", and run ``docker-compose`` with all the command
24+
line arguments given to `pavics-compose.sh <pavics-compose.sh>`_ (:download:`download </birdhouse/pavics-compose.sh>`).
25+
See `env.local.example <env.local.example>`_ (:download:`download </birdhouse/env.local.example>`) for more details on
26+
what can go into the ``env.local`` file.
2427

25-
If the file `env.local` is somewhere else, symlink it here, next to `docker-compose.yml <docker-compose.yml>`_ (:download:`download </birdhouse/docker-compose.yml>`) because many scripts assume this location.
28+
If the file `env.local` is somewhere else, symlink it here, next to `docker-compose.yml <docker-compose.yml>`_
29+
(:download:`download </birdhouse/docker-compose.yml>`) because many scripts assume this location.
2630

2731
To follow infrastructure-as-code, it is encouraged to source control the above
2832
`env.local` file and any override needed to customized this PAVICS deployment
29-
for your organization. For an example of possible override, see how the `emu service <optional-components/emu/docker-compose-extra.yml>`_ (:download:`download </birdhouse/optional-components/emu/docker-compose-extra.yml>`)
30-
(`README <optional-components/README.rst#emu-wps-service-for-testing>`_) can be optionally added to the deployment via the `override mechanism <https://docs.docker.com/compose/extends/>`_.
31-
Ouranos specific override can be found in this `birdhouse-deploy-ouranos <https://github.com/bird-house/birdhouse-deploy-ouranos>`_ repo.
33+
for your organization. For an example of possible override,
34+
see how the `emu service <optional-components/emu/docker-compose-extra.yml>`_
35+
(:download:`download </birdhouse/optional-components/emu/docker-compose-extra.yml>`)
36+
(`README <birdhouse/optional-components/README.rst#emu-wps-service-for-testing>`_) can be optionally added to the
37+
deployment via the `override mechanism <https://docs.docker.com/compose/extends/>`_. Ouranos specific override
38+
can be found in this `birdhouse-deploy-ouranos <https://github.com/bird-house/birdhouse-deploy-ouranos>`_ repo.
3239

3340
Suggested deployment layout:
3441

35-
.. code-block::
42+
.. code-block:: text
3643
3744
├── birdhouse-deploy/ # this repo
3845
│   ├── birdhouse/
@@ -47,7 +54,8 @@ Suggested deployment layout:
4754
The automatic deployment is able to handle multiple repos, so will trigger if
4855
this repo or your private-personalized-config repo changes, giving you
4956
automated continuous deployment. See the continuous deployment setup section
50-
below and the variable ``AUTODEPLOY_EXTRA_REPOS`` in `env.local.example <env.local.example>`_ (:download:`download </birdhouse/env.local.example>`).
57+
below and the variable ``AUTODEPLOY_EXTRA_REPOS`` in `env.local.example <env.local.example>`_
58+
(:download:`download </birdhouse/env.local.example>`).
5159

5260
The automatic deployment of the PAVICS platform, of the Jupyter tutorial
5361
notebooks and of the automatic deployment mechanism itself can all be
@@ -62,15 +70,17 @@ To launch all the containers, use the following command:
6270
6371
./pavics-compose.sh up -d
6472
65-
If you get a ``'No applicable error code, please check error log'`` error from the WPS processes, please make sure that the WPS databases exists in the
66-
postgres instance. See `create-wps-pgsql-databases.sh <scripts/create-wps-pgsql-databases.sh>`_ (:download:`download </birdhouse/scripts/create-wps-pgsql-databases.sh>`).
73+
If you get a ``'No applicable error code, please check error log'`` error from the WPS processes, please
74+
make sure that the WPS databases exists in the postgres instance.
75+
See `create-wps-pgsql-databases.sh <scripts/create-wps-pgsql-databases.sh>`_
76+
(:download:`download </birdhouse/scripts/create-wps-pgsql-databases.sh>`).
6777

6878

6979
Note
7080
----
7181

7282
* All WPS requests should be completed within ``proxy_read_timeout`` of the
73-
Nginx proxy, see `nginx.conf`_ (:download:`download <birdhouse/config/proxy/nginx.conf>`).
83+
Nginx proxy, see `nginx.conf`_ (:download:`download <birdhouse/config/proxy/nginx.conf.template>`).
7484
Any WPS requests that will take longer should use the async mode.
7585

7686
Default value ``PROXY_READ_TIMEOUT_VALUE`` in `default.env`_ (:download:`download <birdhouse/default.env>`).
@@ -84,12 +94,12 @@ Manual steps post deployment
8494
Create public demo user in Magpie for JupyterHub login
8595
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8696

87-
Use `create-magpie-users <scripts/create-magpie-users>`_ (:download:`download </birdhouse/scripts/create-magpie-users>`) or follow manual
88-
instructions below.
97+
Use `create-magpie-users <scripts/create-magpie-users>`_
98+
(:download:`download </birdhouse/scripts/create-magpie-users>`) or follow manual instructions below.
8999

90100
``config.yml`` file if using ``create-magpie-users``:
91101

92-
.. code-block::
102+
.. code-block:: yaml
93103
94104
users:
95105
- username: < value of JUPYTER_DEMO_USER in `env.local` >
@@ -121,7 +131,8 @@ https://github.com/Ouranosinc/PAVICS-e2e-workflow-tests with pre-configured
121131
Jenkins at https://github.com/Ouranosinc/jenkins-config.
122132

123133
For that test suite to pass, run the script
124-
`scripts/bootstrap-instance-for-testsuite <scripts/bootstrap-instance-for-testsuite>`_ (:download:`download </birdhouse/scripts/bootstrap-instance-for-testsuite>`)
134+
`scripts/bootstrap-instance-for-testsuite <scripts/bootstrap-instance-for-testsuite>`_
135+
(:download:`download </birdhouse/scripts/bootstrap-instance-for-testsuite>`)
125136
to prepare your new instance. Further documentation inside the script.
126137

127138
Optional components
@@ -148,10 +159,12 @@ environment for testing or to have multiple flavors of PAVICS with slightly
148159
different combinations of the parts all running simultaneously in their
149160
respective VM, allowing us to see the differences in behavior.
150161

151-
See `vagrant_variables.yml.example </vagrant_variables.yml.example>`_ (:download:`download </vagrant_variables.yml.example>`) for what's
162+
See `vagrant_variables.yml.example </vagrant_variables.yml.example>`_
163+
(:download:`download </vagrant_variables.yml.example>`) for what's
152164
configurable with Vagrant.
153165

154-
If using Centos box, follow `disk-resize <vagrant-utils/disk-resize>`_ (:download:`download </birdhouse/vagrant-utils/disk-resize>`) after
166+
If using Centos box, follow `disk-resize <vagrant-utils/disk-resize>`_
167+
(:download:`download </birdhouse/vagrant-utils/disk-resize>`) after
155168
first ``vagrant up`` failure due to disk full. Then ``vagrant reload && vagrant
156169
provision`` to continue. If using Ubuntu box, no manual steps required,
157170
everything just works.
@@ -161,7 +174,7 @@ platform and the extension pack, and `Vagrant <https://www.vagrantup.com/downloa
161174

162175
One time setup:
163176

164-
.. code-block::
177+
.. code-block:: shell
165178
166179
# Clone this repo and checkout the desired branch.
167180
@@ -171,7 +184,7 @@ One time setup:
171184
172185
Starting and managing the lifecycle of the VM:
173186

174-
.. code-block::
187+
.. code-block:: shell
175188
176189
# start everything, this is the only command needed to bring up the entire
177190
# PAVICS platform
@@ -310,7 +323,7 @@ Release Procedure
310323
* Run ``git push --tags`` to upload the new version.
311324

312325

313-
.. _nginx.conf: ./config/proxy/nginx.conf
314-
.. _default.env: ./default.env
326+
.. _nginx.conf: ../birdhouse/config/proxy/nginx.conf.template
327+
.. _default.env: ../birdhouse/default.env
315328
.. _`.bumpversion.cfg`: ../.bumpversion.cfg
316329
.. _CHANGES.md: ../CHANGES.md

0 commit comments

Comments
 (0)