Skip to content

Commit 078380d

Browse files
authored
UPD: setup techdocs and monitoring (#80)
* ADD: prod configurations * ADD: migrate scaffolder plugin for github * UPD: update database config * UPD: techdocs config * UPD: techdocs config * UPD: fix errors * UPD: fix errors
1 parent d2cdf0a commit 078380d

File tree

9 files changed

+85
-8
lines changed

9 files changed

+85
-8
lines changed

.github/workflows/cd-workflow.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ jobs:
9999
with:
100100
project_id: ${{ secrets.GCP_PROJECT_ID }}
101101

102+
102103
- name: Deploy to Cloud Run
103104
id: deploy
104105
uses: google-github-actions/deploy-cloudrun@v1
@@ -110,3 +111,8 @@ jobs:
110111
flags: >
111112
--allow-unauthenticated
112113
--port=7007
114+
--add-cloudsql-instances=${{ secrets.GCP_SQL_CONNECTION_NAME }}
115+
env_vars: |
116+
POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}
117+
POSTGRES_PORT=5432
118+
BASE_URL=https://backstage.foundations-software-engineering.com

.github/workflows/techdocs-gcs.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Publish TechDocs to GCS
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- 'mkdocs.yml'
10+
11+
jobs:
12+
publish-techdocs-site:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
node-version: ['20.x']
17+
18+
env:
19+
TECHDOCS_BUCKET_NAME: ${{ secrets.TECHDOCS_BUCKET_NAME }}
20+
TECHDOCS_GCS_CREDENTIALS: ${{ secrets.TECHDOCS_GCS_CREDENTIALS }}
21+
ENTITY_NAMESPACE: 'default'
22+
ENTITY_KIND: 'Component'
23+
ENTITY_NAME: 'code-idp-docs'
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Enable Corepack
32+
run: corepack enable
33+
34+
- name: Set Yarn Version
35+
run: corepack prepare [email protected] --activate
36+
37+
- name: Set up Node.js
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
cache: 'yarn'
42+
43+
- name: Setup Python
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: '3.9'
47+
48+
- name: Install techdocs-cli
49+
run: yarn global add @techdocs/cli
50+
51+
- name: Install mkdocs and mkdocs-plugin
52+
run: python3 -m pip install mkdocs-techdocs-core==1.*
53+
54+
- name: Generate docs site
55+
run: techdocs-cli generate --no-docker --verbose
56+
57+
- name: Publish docs site
58+
run: techdocs-cli publish --publisher-type googleGcs --storage-name $TECHDOCS_BUCKET_NAME --entity $ENTITY_NAMESPACE/$ENTITY_KIND/$ENTITY_NAME

app-config.production.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
app:
2-
baseUrl: https://backstage-deployment-1006240973223.europe-west10.run.app
2+
baseUrl: https://backstage.foundations-software-engineering.com
33

44
backend:
5-
baseUrl: https://backstage-deployment-1006240973223.europe-west10.run.app
5+
baseUrl: https://backstage.foundations-software-engineering.com
66
cors:
7-
origin: https://backstage-deployment-1006240973223.europe-west10.run.app
7+
origin: https://backstage.foundations-software-engineering.com
88
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
99
credentials: true
1010

app-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ backend:
1515
origin: http://localhost:3000
1616
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
1717
credentials: true
18+
1819
database:
1920
client: pg
2021
connection:
@@ -34,8 +35,11 @@ integrations:
3435
- host: gitlab.com
3536
token: ${GITLAB_TOKEN}
3637

38+
3739
techdocs:
38-
builder: 'external'
40+
builder: 'external'
41+
generator:
42+
runIn: 'local'
3943
publisher:
4044
type: 'googleGcs'
4145
googleGcs:

docs/CHANGELOG.md

Whitespace-only changes.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ nav:
88
- Register Your Software Component: 'how-to-register-a-component.md'
99
- Technical Documentation:
1010
- Publish Your Docs: 'how-to-publish-documentation.md'
11+
- CHANGELOG: 'CHANGELOG.md'
1112

1213
plugins:
1314
- techdocs-core

packages/backend/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
"@backstage/plugin-permission-node": "^0.8.5",
3737
"@backstage/plugin-proxy-backend": "^0.5.8",
3838
"@backstage/plugin-scaffolder-backend": "^1.27.2",
39+
"@backstage/plugin-scaffolder-backend-module-github": "^0.5.5",
40+
"@backstage/plugin-scaffolder-backend-module-gitlab": "^0.7.1",
3941
"@backstage/plugin-search-backend": "^1.7.0",
4042
"@backstage/plugin-search-backend-module-catalog": "^0.2.5",
4143
"@backstage/plugin-search-backend-module-pg": "^0.5.38",
@@ -47,7 +49,7 @@
4749
"express": "^4.17.1",
4850
"express-promise-router": "^4.1.0",
4951
"node-gyp": "^9.0.0",
50-
"pg": "^8.11.3"
52+
"pg": "^8.13.1"
5153
},
5254
"devDependencies": {
5355
"@backstage/cli": "^0.29.0",

packages/backend/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const backend = createBackend();
1111

1212
backend.add(import('@backstage/plugin-app-backend'));
1313
backend.add(import('@backstage/plugin-proxy-backend'))
14-
backend.add(import('@backstage/plugin-scaffolder-backend'));
1514
backend.add(import('@backstage/plugin-techdocs-backend'));
1615

1716
// Add the auth backend
@@ -117,6 +116,11 @@ backend.add(import('@backstage/plugin-catalog-backend'));
117116
backend.add(import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'),
118117
);
119118

119+
// scaffolder plugin
120+
backend.add(import('@backstage/plugin-scaffolder-backend'));
121+
backend.add(import('@backstage/plugin-scaffolder-backend-module-github'));
122+
backend.add(import('@backstage/plugin-scaffolder-backend-module-gitlab'));
123+
120124
backend.add(import('@backstage/plugin-permission-backend'));
121125
backend.add(
122126
import('@backstage/plugin-permission-backend-module-allow-all-policy'),

yarn.lock

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15420,6 +15420,8 @@ __metadata:
1542015420
"@backstage/plugin-permission-node": "npm:^0.8.5"
1542115421
"@backstage/plugin-proxy-backend": "npm:^0.5.8"
1542215422
"@backstage/plugin-scaffolder-backend": "npm:^1.27.2"
15423+
"@backstage/plugin-scaffolder-backend-module-github": "npm:^0.5.5"
15424+
"@backstage/plugin-scaffolder-backend-module-gitlab": "npm:^0.7.1"
1542315425
"@backstage/plugin-search-backend": "npm:^1.7.0"
1542415426
"@backstage/plugin-search-backend-module-catalog": "npm:^0.2.5"
1542515427
"@backstage/plugin-search-backend-module-pg": "npm:^0.5.38"
@@ -15436,7 +15438,7 @@ __metadata:
1543615438
express: "npm:^4.17.1"
1543715439
express-promise-router: "npm:^4.1.0"
1543815440
node-gyp: "npm:^9.0.0"
15439-
pg: "npm:^8.11.3"
15441+
pg: "npm:^8.13.1"
1544015442
languageName: unknown
1544115443
linkType: soft
1544215444

@@ -28602,7 +28604,7 @@ __metadata:
2860228604
languageName: node
2860328605
linkType: hard
2860428606

28605-
"pg@npm:^8.11.3":
28607+
"pg@npm:^8.11.3, pg@npm:^8.13.1":
2860628608
version: 8.13.1
2860728609
resolution: "pg@npm:8.13.1"
2860828610
dependencies:

0 commit comments

Comments
 (0)