diff --git a/.github/uffizzi/docker-compose.uffizzi.yml b/.github/uffizzi/docker-compose.uffizzi.yml
index 76a7b4eafc..f2e9bbeee6 100644
--- a/.github/uffizzi/docker-compose.uffizzi.yml
+++ b/.github/uffizzi/docker-compose.uffizzi.yml
@@ -14,6 +14,7 @@ services:
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: kiTMoTsiEuyQ43GrL4Hv
+ REF_NAME: ${GITHUB_SHA}
NODE_ENV: production
deploy:
resources:
diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml
index 30cffa11c9..3b24c20b3d 100644
--- a/.github/uffizzi/uffizzi.production.app-config.yaml
+++ b/.github/uffizzi/uffizzi.production.app-config.yaml
@@ -28,6 +28,7 @@ backend:
credentials: true
csp:
connect-src: ["'self'", 'http:', 'https:']
+ img-src: ["'self'", 'data:', 'https://cdnjs.cloudflare.com']
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
@@ -41,15 +42,18 @@ auth:
catalog:
locations:
- type: url
- target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml
+ target: https://github.com/backstage/backstage/blob/${REF_NAME}/packages/catalog-model/examples/all.yaml
- type: url
- target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/acme-corp.yaml
+ target: https://github.com/backstage/backstage/blob/${REF_NAME}/plugins/techdocs-backend/examples/documented-component-uffizzi/catalog-info.yaml
+
+ - type: url
+ target: https://github.com/backstage/backstage/blob/${REF_NAME}/packages/catalog-model/examples/acme-corp.yaml
rules:
- allow: [User, Group]
- type: url
- target: https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend/sample-templates/all-templates.yaml
+ target: https://github.com/backstage/backstage/blob/${REF_NAME}/plugins/scaffolder-backend/sample-templates/all-templates.yaml
rules:
- allow: [Template]
@@ -124,7 +128,7 @@ proxy:
techdocs:
builder: 'local' # Alternatives - 'external'
generator:
- runIn: 'docker'
+ runIn: 'local'
# dockerImage: my-org/techdocs # use a custom docker image
# pullImage: true # or false to disable automatic pulling of image (e.g. if custom docker login is required)
publisher:
diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml
index ee629bbafe..1b031f50ad 100644
--- a/.github/workflows/uffizzi-build.yml
+++ b/.github/workflows/uffizzi-build.yml
@@ -81,7 +81,7 @@ jobs:
BACKSTAGE_IMAGE=$(echo ${{ needs.build-backstage.outputs.tags }})
export BACKSTAGE_IMAGE
# Render simple template from environment variables.
- envsubst '$BACKSTAGE_IMAGE' < .github/uffizzi/docker-compose.uffizzi.yml > docker-compose.rendered.yml
+ envsubst '$BACKSTAGE_IMAGE $GITHUB_SHA' < .github/uffizzi/docker-compose.uffizzi.yml > docker-compose.rendered.yml
cat docker-compose.rendered.yml
- name: Upload Rendered Compose File as Artifact
uses: actions/upload-artifact@v3
diff --git a/packages/backend/Dockerfile b/packages/backend/Dockerfile
index eca6ce82c2..da25f9736c 100644
--- a/packages/backend/Dockerfile
+++ b/packages/backend/Dockerfile
@@ -13,11 +13,14 @@ FROM node:16-bullseye-slim
# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
+# Additionally, we install dependencies for `techdocs.generator.runIn: local`.
+# https://backstage.io/docs/features/techdocs/getting-started#disabling-docker-in-docker-situation-optional
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
- apt-get install -y --no-install-recommends libsqlite3-dev python3 build-essential && \
- yarn config set python /usr/bin/python3
+ apt-get install -y --no-install-recommends libsqlite3-dev python3 python3-pip build-essential && \
+ yarn config set python /usr/bin/python3 && \
+ pip3 install mkdocs-techdocs-core==1.1.7
# From here on we use the least-privileged `node` user to run the backend.
WORKDIR /app
diff --git a/plugins/techdocs-backend/examples/documented-component-uffizzi/catalog-info.yaml b/plugins/techdocs-backend/examples/documented-component-uffizzi/catalog-info.yaml
new file mode 100644
index 0000000000..a4d46593d3
--- /dev/null
+++ b/plugins/techdocs-backend/examples/documented-component-uffizzi/catalog-info.yaml
@@ -0,0 +1,12 @@
+apiVersion: backstage.io/v1alpha1
+kind: Component
+metadata:
+ name: documented-component-uffizzi
+ title: Documented Component (Uffizzi)
+ description: A Service with TechDocs documentation. Excl. PlantUML extension.
+ annotations:
+ backstage.io/techdocs-ref: dir:.
+spec:
+ type: service
+ lifecycle: experimental
+ owner: user:guest
diff --git a/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/code/code-sample.md b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/code/code-sample.md
new file mode 100644
index 0000000000..f41ab1d506
--- /dev/null
+++ b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/code/code-sample.md
@@ -0,0 +1,31 @@
+# Sample Code
+
+This page provides some sample code which may be used in your example component.
+
+This code uses TypeScript, and the Markdown code fence to wrap the code.
+
+```typescript
+const serviceEntityPage = (
+
+
+
+
+
+
+
+
+
+
+
+
+);
+```
+
+Here is an example of Python code:
+
+```python
+def getUsersInGroup(targetGroup, secure=False):
+
+ if __debug__:
+ print('targetGroup=[' + targetGroup + ']')
+```
diff --git a/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/extensions.md b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/extensions.md
new file mode 100644
index 0000000000..2b101efdef
--- /dev/null
+++ b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/extensions.md
@@ -0,0 +1,99 @@
+# Plugins & Extensions
+
+Just by including the TechDocs Core Plugin to your MkDocs site included with Backstage,
+you gain the immediate use of a variety of popular plugins and extensions to MkDocs.
+
+For more information and full details of the available features, see the
+[`mkdocs-techdocs-core` repository](https://github.com/backstage/mkdocs-techdocs-core#mkdocs-plugins-and-extensions).
+
+This page provides a demonstration of some of the available features.
+
+## Admonitions
+
+Admonitions are call outs that help catch a users attention.
+
+To define an admonition simply put the following Markdown into your content:
+
+```
+!!! warn
+ Defining admonitions can be addicting.
+```
+
+And they end up looking like this:
+
+
+!!! warn
+ Defining admonitions can be addicting.
+
+
+!!! note
+ You can learn a lot about TechDocs by just visiting the Backstage web site at
+ https://backstage.io/docs.
+
+
+!!! info
+ TechDocs is the core feature that supports documentation as code in Backstage.
+
+
+!!! tip
+ Don't forget to spell check your documentation.
+
+## Pymdownx Extensions
+
+Pymdownx (Python Markdown extensions) are a variety of smaller additions.
+
+### Details
+
+
+??? note "What is the answer to life, the universe, and everything? (click me for the answer)"
+ The answer is 42.
+
+
+??? note "What is 4 plus 4?"
+ The answer is 8.
+
+
+???+ note "How do I get support?"
+ You can get support by opening an issue in this repository. This detail is open by default
+ so it's more easily visible without requiring the user to click to open it.
+
+### Task Lists
+
+Automatic rendering of Markdown task lists.
+
+- [x] Phase 1
+- [x] Phase 2
+- [ ] Phase 3
+
+### Emojis
+
+Very nice job on documentation! :thumbsup:
+
+I've read a lot of documentation, but I love :heart: this document.
+
+Weather: :sunny: :umbrella: :cloud: :snowflake:
+
+Animals: :tiger: :horse: :turtle: :wolf: :frog:
+
+### Attributes
+
+[A Download Link](./images/backstage-logo-cncf.svg){: download }
+
+{: style="width: 100px" }
+
+### MDX truly sane lists
+
+- `attributes`
+
+- `customer`
+ - `first_name`
+ - `test`
+ - `family_name`
+ - `email`
+- `person`
+ - `first_name`
+ - `family_name`
+ - `birth_date`
+- `subscription_id`
+
+- `request`
diff --git a/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/images/backstage-logo-cncf.svg b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/images/backstage-logo-cncf.svg
new file mode 100644
index 0000000000..b5ff591d1b
--- /dev/null
+++ b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/images/backstage-logo-cncf.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/index.md b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/index.md
new file mode 100644
index 0000000000..6295a69406
--- /dev/null
+++ b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/index.md
@@ -0,0 +1,55 @@
+# Welcome!
+
+This is a basic example of documentation. It is intended as a showcase of some of the
+features that TechDocs provides out of the box.
+
+You can see also:
+
+- [A sub page](sub-page.md)
+- [Inline code examples](code/code-sample.md)
+- [Plugin & Extension examples](extensions.md) - Diagrams, emojis, visual formatting.
+
+## Basic Markdown
+
+Headings:
+
+# h1
+
+## h2
+
+### h3
+
+#### h4
+
+##### h5
+
+###### h6
+
+Here is a bulleted list:
+
+- Item one
+- Item two
+- Item Three
+
+Check out the [Markdown Guide](https://www.markdownguide.org/) to learn more about how to
+simply create documentation.
+
+You can also learn more about how to configure and setup this documentation in Backstage,
+[read up on the TechDocs Overview](https://backstage.io/docs/features/techdocs/).
+
+## Image Example
+
+This documentation is powered by Backstage's TechDocs feature:
+
+
+
+## Table Example
+
+While this documentation isn't comprehensive, in the future it should cover the following
+topics outlined in this example table:
+
+| Topic | Description |
+| ------- | ------------------------------------------------------------ |
+| Topic 1 | An introductory topic to help you learn about the component. |
+| Topic 2 | A more detailed topic that explains more information. |
+| Topic 3 | A final topic that provides conclusions and lessons learned. |
diff --git a/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/sub-page.md b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/sub-page.md
new file mode 100644
index 0000000000..987f5e8a95
--- /dev/null
+++ b/plugins/techdocs-backend/examples/documented-component-uffizzi/docs/sub-page.md
@@ -0,0 +1,12 @@
+# Another page in our documentation
+
+This sub-page can be used to elaborate on a specific part of the component.
+
+## Details
+
+It is linked off the main page, and due to its inclusion in the `mkdocs.yml` file,
+becomes part of the auto-generated site navigation.
+
+## MkDocs
+
+Visit https://www.mkdocs.org for more information about the MkDocs tool.
diff --git a/plugins/techdocs-backend/examples/documented-component-uffizzi/mkdocs.yml b/plugins/techdocs-backend/examples/documented-component-uffizzi/mkdocs.yml
new file mode 100644
index 0000000000..1a159a4d12
--- /dev/null
+++ b/plugins/techdocs-backend/examples/documented-component-uffizzi/mkdocs.yml
@@ -0,0 +1,12 @@
+site_name: 'Example Documentation'
+repo_url: https://github.com/backstage/backstage
+edit_uri: edit/master/plugins/techdocs-backend/examples/documented-component/docs
+
+nav:
+ - Home: index.md
+ - Subpage: sub-page.md
+ - 'Code Sample': code/code-sample.md
+ - Extensions: extensions.md
+
+plugins:
+ - techdocs-core