This topic tells you how to generate and publish TechDocs for catalogs as part of Tanzu Developer Portal. For more information about TechDocs, see the Backstage.io documentation.
To create an Amazon S3 bucket:
- Go to Amazon S3.
- Click Create bucket.
- Give the bucket a name.
- Select the AWS region.
- Keep Block all public access checked.
- Click Create bucket.
The TechDocs are published to the S3 bucket that was recently created. You need an AWS user's access key to read from the bucket when viewing TechDocs.
To create an AWS IAM User Group:
-
Click Create Group.
-
Give the group a name.
-
Click Create Group.
-
Click the new group and navigate to Permissions.
-
Click Add permissions and click Create Inline Policy.
-
Click the JSON tab and replace contents with this JSON replacing
BUCKET-NAME
with the bucket name.{ "Version": "2012-10-17", "Statement": [ { "Sid": "ReadTechDocs", "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::BUCKET-NAME", "arn:aws:s3:::BUCKET-NAME/*" ] } ] }
-
Click Review policy.
-
Give the policy a name and click Create policy.
To create an AWS IAM User to add to this group:
- Click Add users.
- Give the user a name.
- Verify Access key - Programmatic access and click Next: Permissions.
- Verify the IAM Group to add the user to and click Next: Tags.
- Click Next: Review then click Create user.
- Record the Access key ID (
AWS_READONLY_ACCESS_KEY_ID
) and the Secret access key (AWS_READONLY_SECRET_ACCESS_KEY
) and click Close.
TechDocs are generated for catalogs that have Markdown source files for TechDocs. To find the catalog locations and their entities' namespace, kind, and name:
-
The catalogs appearing in Tanzu Developer Portal are listed in the config values under
app_config.catalog.locations
. -
For a catalog, clone the catalog's repository to the local file system.
-
Find the
mkdocs.yml
that is at the root of the catalog. There is a YAML file describing the catalog at the same level calledcatalog-info.yaml
. -
Record the values for
namespace
,kind
, andmetadata.name
, and the directory path containing the YAML file. -
Record the
spec.targets
in that file. -
Find the namespace, kind, or name for each of the targets:
- Go to the target's YAML file.
- The
namespace
value is the value ofnamespace
. If it is not specified, it has the valuedefault
. - The
kind
value is the value ofkind
. - The
name
value is the value ofmetadata.name
. - Record the directory path containing the YAML file.
VMware uses npx
to run the TechDocs CLI, which requires Node.js
and npm
.
To generate and publish TechDocs by using the TechDocs CLI:
-
Install
npx
by running:npm install -g npx
-
Generate the TechDocs for the root of the catalog by running:
npx @techdocs/cli generate --source-dir DIRECTORY-CONTAINING-THE-ROOT-YAML-FILE --output-dir ./site
Note This creates a temporary
site
directory in your current working directory that contains the generated TechDocs files. -
Review the contents of the
site
directory to verify the TechDocs were generated. -
Set environment variables for authenticating with Amazon S3 with an account that has read/write access:
export AWS_ACCESS_KEY_ID=AWS-ACCESS-KEY-ID export AWS_SECRET_ACCESS_KEY=AWS-SECRET-ACCESS-KEY export AWS_REGION=AWS-REGION
-
Publish the TechDocs for the root of the catalog to the Amazon S3 bucket you created earlier by running:
npx @techdocs/cli publish --publisher-type awsS3 --storage-name BUCKET-NAME --entity \ NAMESPACE/KIND/NAME --directory ./site
Where
NAMESPACE/KIND/NAME
are the values fornamespace
,kind
, andmetadata.name
you recorded earlier. For example,default/location/yelb-catalog-info
. -
For each of the
spec.targets
found earlier, repeat thegenerate
andpublish
commands.Note The
generate
command erases the contents of thesite
directory before creating new TechDocs files. Therefore, thepublish
command must follow thegenerate
command for each target.
Update the config values you used during installation to point to the Amazon S3 bucket that has the published TechDocs files:
-
Add or edit the
techdocs
section underapp_config
in the config values with the following YAML, replacing placeholders with the appropriate values.techdocs: builder: 'external' publisher: type: 'awsS3' awsS3: bucketName: BUCKET-NAME accountId: ACCOUNT-ID region: AWS-REGION aws: accounts: - accountId: ACCOUNT-ID accessKeyId: AWS-READONLY-ACCESS-KEY-ID secretAccessKey: AWS-READONLY-SECRET-ACCESS-KEY
For more information about authentication to an Amazon S3 bucket through an assumed role, see the Backstage documentation.
-
Update your installation from the Tanzu CLI:
Tanzu Application Platform package installation : If you installed Tanzu Developer Portal as part of the Tanzu Application Platform package (in other words, if you installed it by running
tanzu package install tap ...
) then run:tanzu package installed update tap \ --version PACKAGE-VERSION \ --values-file VALUES-FILE
Where
PACKAGE-VERSION
is your package version andVALUES-FILE
is your values fileSeparate package installation : If you installed Tanzu Developer Portal as its own package (in other words, if you installed it by running
tanzu package install tap-gui ...
) then run:tanzu package installed update tap-gui \ --version PACKAGE-VERSION \ --values-file VALUES-FILE
Where
PACKAGE-VERSION
is your package version andVALUES-FILE
is your values file -
Verify the status of the update by running:
tanzu package installed list
-
Go to the Docs section of your catalog and view the TechDocs pages to verify the content is loaded from the S3 bucket.