Publish a Techdocs Site¶
Preface¶
This how-to will take you through the steps of building and publishing a techdocs site for inclusion in the developer portal catalog. In order to do this we must build the site and push it to a S3 compatible object store.
Setup & Configure Mkdocs¶
To begin, follow the getting started guide for Mkdocs. You should include techdocs-core
in plugins
list and subsequently mkdocs-techdocs-core
in your python requirements definition.
Warning
Beware, techdocs-core
overrides various mkdocs configuration options including theme
.
Example
1 2 3 4 5 6 |
|
Build Docs¶
We will use the Techdocs command line interface node package to build our docs site locally. To do this we will run:
1 |
|
At this point you should see a site
directory, the contents of which can be viewed in your browser.
Publish Docs¶
We will use the Techdocs command line interface node package to publish our docs site to the S3 bucket.
In order to do this we will require the nessacary credentials for the bucket. The nessacary credentials should be made available as the environment variables AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
. These credentials are made available in GitHub Workflows in the DiamondLightSource organisation as TECHDOCS_S3_ACCESS_KEY_ID
and TECHDOCS_S3_SECRET_ACCESS_KEY
respectively or can be attained by contacting the owner of developer-portal-techdocs-bucket
. Further to this, the AWS_REGION
environment variable should be set to an empty string.
We will now run:
1 |
|
Example GitHub Workflow
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
Example GitLab Workflow
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Annotate Entity¶
Finally, we will add the backstage.io/techdocs-ref
annotation to the metadata.annotations
field of the entity descriptor. This should point to the root directory of the documentation (i.e. the directory containing the mkdocs.yaml
file).
Example Entity Descriptor
1 2 3 4 5 6 7 8 9 10 |
|