How to migrate from TechDocs Basic to Recommended deployment approach?
The main difference between TechDocs Basic and Recommended deployment approach is where the docs are generated and stored. In Basic or the out-of-the-box setup, docs are generated and stored at the server running your Backstage instance. But the recommended setup is to generate docs on CI/CD and store the generated sites to an external storage (e.g. AWS S3 or GCS). TechDocs in your Backstage instance should turn into read-only mode. Read more details and the benefits in the TechDocs Architecture.
Here are the steps needed to switch from the Basic to Recommended setup -
1. Prepare a cloud storage
Choose a cloud storage provider like AWS, Google Cloud or Microsoft Azure. Follow the detailed instructions for using cloud storage in TechDocs.
2. Publish to storage from CI/CD
Start publishing your TechDocs sites from the CI/CD workflow of each repository containing the source markdown files. Read the detailed instructions for configuring CI/CD.
3. Switch TechDocs to read-only mode
In your Backstage instance's
'external'. By doing this, TechDocs will not try to generate
docs. Look at TechDocs configuration for reference.
How to use URL Reader in TechDocs Prepare step?
If TechDocs is configured to generate docs, it will first download the
repository associated with the
backstage.io/techdocs-ref annotation defined in
catalog-info.yaml file. This is also called the
There are two kinds of preparers or two ways of downloading these source files
- Preparer 1: Doing a
git cloneof the repository (also known as Common Git Preparer)
- Preparer 2: Downloading an archive.zip or equivalent of the repository (also known as URL Reader)
backstage.io/techdocs-ref is equal to any of these -
Then Common Git Preparer will be used i.e. a
git clone. But the URL Reader is
a much faster way to do this step. Convert the
values to the following -
Note that you can also provide a path to a non-root directory inside the
repository which contains the
Why is URL Reader faster than a git clone?
URL Reader uses the source code hosting provider to download a zip or tarball of the repository. The archive does not have any git history attached to it. Also it is a compressed file. Hence the file size is significantly smaller than how much data git clone has to transfer.
Caveat: Currently TechDocs sites built using URL Reader will be cached for 30 minutes which means they will not be re-built if new changes are made within 30 minutes. This cache invalidation will be replaced by commit timestamp based implementation very soon.