From 9513a6fff9b0be6fd387380ba76f0d1fcaa13424 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 10:10:15 +0100 Subject: [PATCH 01/29] chore: add the examples to the dockerfile Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 163531a755..5d66d4b610 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -55,6 +55,11 @@ jobs: images: registry.uffizzi.com/${{ env.UUID_TAG_APP }} tags: type=raw,value=60d + - name: Add examples directory to Dockerfile + run: | + echo "COPY examples /app/examples" >> ./example-app/packages/backend/Dockerfile + cat ./example-app/packages/backend/Dockerfile + - name: Build Image uses: docker/build-push-action@v2 with: From 8e964492b0c35aa9f9f59d16a319e50a39e336b8 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 10:30:06 +0100 Subject: [PATCH 02/29] chore: fix Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 5d66d4b610..9e5c0e61df 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -57,7 +57,7 @@ jobs: - name: Add examples directory to Dockerfile run: | - echo "COPY examples /app/examples" >> ./example-app/packages/backend/Dockerfile + echo "COPY examples /examples" >> ./example-app/packages/backend/Dockerfile cat ./example-app/packages/backend/Dockerfile - name: Build Image From bf9d3fc29a47c1016a8f4cc6bbc7531b7c4abcff Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 10:42:15 +0100 Subject: [PATCH 03/29] chore: fixing addition of the examples Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 9e5c0e61df..55d0c63145 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -58,7 +58,6 @@ jobs: - name: Add examples directory to Dockerfile run: | echo "COPY examples /examples" >> ./example-app/packages/backend/Dockerfile - cat ./example-app/packages/backend/Dockerfile - name: Build Image uses: docker/build-push-action@v2 From 78b593f9ad10e630b66f229c195640a1b21b3b05 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 11:04:21 +0100 Subject: [PATCH 04/29] chore: use the e2e test method for building uffizi containers Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 2 +- packages/e2e-test/src/commands/index.ts | 3 ++- packages/e2e-test/src/commands/run.ts | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 55d0c63145..5a68ad9568 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -28,7 +28,7 @@ jobs: - name: backstage create-app | delete if already exists run: | rm -rf ./example-app - npx @backstage/create-app + node ./packages/e2e-test/.bin/e2e-test create -o ./example-app env: BACKSTAGE_APP_NAME: example-app diff --git a/packages/e2e-test/src/commands/index.ts b/packages/e2e-test/src/commands/index.ts index 95d311427c..db9ea225a3 100644 --- a/packages/e2e-test/src/commands/index.ts +++ b/packages/e2e-test/src/commands/index.ts @@ -15,8 +15,9 @@ */ import { Command } from 'commander'; -import { run } from './run'; +import { run, create } from './run'; export function registerCommands(program: Command) { program.command('run').description('Run e2e tests').action(run); + program.command('create').option('-o, --output ').action(create); } diff --git a/packages/e2e-test/src/commands/run.ts b/packages/e2e-test/src/commands/run.ts index 3eedb90b21..b022862c8c 100644 --- a/packages/e2e-test/src/commands/run.ts +++ b/packages/e2e-test/src/commands/run.ts @@ -43,6 +43,24 @@ const templatePackagePaths = [ 'packages/create-app/templates/default-app/packages/backend/package.json.hbs', ]; +export async function create({ output }: { output: string }) { + const outputDir = resolvePath(process.cwd(), output); + + const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-')); + print(`CLI E2E test root: ${rootDir}\n`); + + print('Building dist workspace'); + const workspaceDir = await buildDistWorkspace('workspace', rootDir); + + // // Otherwise yarn will refuse to install with CI=true + process.env.YARN_ENABLE_IMMUTABLE_INSTALLS = 'false'; + + print('Creating a Backstage App'); + const appDir = await createApp('test-app', workspaceDir, rootDir); + + await fs.move(appDir, outputDir, { overwrite: true }); +} + export async function run() { const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-')); print(`CLI E2E test root: ${rootDir}\n`); From 3357d8bc895a797dc18189e0e589644d8ed42f40 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 11:09:59 +0100 Subject: [PATCH 05/29] chore: revert e2e changes Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 22 +++++++--------------- packages/e2e-test/src/commands/index.ts | 1 - packages/e2e-test/src/commands/run.ts | 18 ------------------ 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 5a68ad9568..025b604c1a 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -25,21 +25,17 @@ jobs: node-version: 16.x registry-url: https://registry.npmjs.org/ - - name: backstage create-app | delete if already exists + - name: yarn install run: | - rm -rf ./example-app - node ./packages/e2e-test/.bin/e2e-test create -o ./example-app - env: - BACKSTAGE_APP_NAME: example-app + yarn install + + - name: Use Uffizzi's backstage app config + run: | + cp -f ./backstage/.github/uffizzi/uffizzi.production.app-config.yaml ./app-config.production.yaml; - name: yarn build run: | yarn build:all - working-directory: ./example-app - - - name: Use Uffizzi's backstage app config - run: | - cp ./backstage/.github/uffizzi/uffizzi.production.app-config.yaml ./example-app/app-config.production.yaml; - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -55,15 +51,11 @@ jobs: images: registry.uffizzi.com/${{ env.UUID_TAG_APP }} tags: type=raw,value=60d - - name: Add examples directory to Dockerfile - run: | - echo "COPY examples /examples" >> ./example-app/packages/backend/Dockerfile - - name: Build Image uses: docker/build-push-action@v2 with: context: example-app - file: example-app/packages/backend/Dockerfile + file: packages/backend/Dockerfile tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} push: true diff --git a/packages/e2e-test/src/commands/index.ts b/packages/e2e-test/src/commands/index.ts index db9ea225a3..4a7cb7272b 100644 --- a/packages/e2e-test/src/commands/index.ts +++ b/packages/e2e-test/src/commands/index.ts @@ -19,5 +19,4 @@ import { run, create } from './run'; export function registerCommands(program: Command) { program.command('run').description('Run e2e tests').action(run); - program.command('create').option('-o, --output ').action(create); } diff --git a/packages/e2e-test/src/commands/run.ts b/packages/e2e-test/src/commands/run.ts index b022862c8c..3eedb90b21 100644 --- a/packages/e2e-test/src/commands/run.ts +++ b/packages/e2e-test/src/commands/run.ts @@ -43,24 +43,6 @@ const templatePackagePaths = [ 'packages/create-app/templates/default-app/packages/backend/package.json.hbs', ]; -export async function create({ output }: { output: string }) { - const outputDir = resolvePath(process.cwd(), output); - - const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-')); - print(`CLI E2E test root: ${rootDir}\n`); - - print('Building dist workspace'); - const workspaceDir = await buildDistWorkspace('workspace', rootDir); - - // // Otherwise yarn will refuse to install with CI=true - process.env.YARN_ENABLE_IMMUTABLE_INSTALLS = 'false'; - - print('Creating a Backstage App'); - const appDir = await createApp('test-app', workspaceDir, rootDir); - - await fs.move(appDir, outputDir, { overwrite: true }); -} - export async function run() { const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-')); print(`CLI E2E test root: ${rootDir}\n`); From df53479f34c5bae30f2235c7e68fba8bdd65ce01 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 11:10:57 +0100 Subject: [PATCH 06/29] chore: revert Signed-off-by: blam Signed-off-by: blam --- packages/e2e-test/src/commands/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-test/src/commands/index.ts b/packages/e2e-test/src/commands/index.ts index 4a7cb7272b..95d311427c 100644 --- a/packages/e2e-test/src/commands/index.ts +++ b/packages/e2e-test/src/commands/index.ts @@ -15,7 +15,7 @@ */ import { Command } from 'commander'; -import { run, create } from './run'; +import { run } from './run'; export function registerCommands(program: Command) { program.command('run').description('Run e2e tests').action(run); From 90666d48d7e0fbcd0c7d26daa5425831dfdc2410 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 11:13:33 +0100 Subject: [PATCH 07/29] chore: fix checkout path Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 025b604c1a..afeecd2347 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -16,8 +16,6 @@ jobs: steps: - name: checkout uses: actions/checkout@v3 - with: - path: backstage - name: setup-node uses: actions/setup-node@v3 @@ -31,7 +29,7 @@ jobs: - name: Use Uffizzi's backstage app config run: | - cp -f ./backstage/.github/uffizzi/uffizzi.production.app-config.yaml ./app-config.production.yaml; + cp -f ./.github/uffizzi/uffizzi.production.app-config.yaml ./app-config.production.yaml; - name: yarn build run: | From c2bcf2c720856cf7e67d43b0fb41876a18ca54d1 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 11:15:44 +0100 Subject: [PATCH 08/29] chore: install cache prefix Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index afeecd2347..7e50d2ce7b 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -24,8 +24,9 @@ jobs: registry-url: https://registry.npmjs.org/ - name: yarn install - run: | - yarn install + uses: backstage/actions/yarn-install@v0.5.12 + with: + cache-prefix: linux-v16 - name: Use Uffizzi's backstage app config run: | From 47f71e29184b62420607d945d52de20403fb09e8 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 11:36:48 +0100 Subject: [PATCH 09/29] chore: need to run typescript Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 7e50d2ce7b..ffa3f43b43 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -32,6 +32,10 @@ jobs: run: | cp -f ./.github/uffizzi/uffizzi.production.app-config.yaml ./app-config.production.yaml; + - name: yarn build + run: | + yarn tsc:full + - name: yarn build run: | yarn build:all From 49308859dcf49f1bf12908fbaa5557907942a40c Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 11:45:23 +0100 Subject: [PATCH 10/29] chore: fixing max old space Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index ffa3f43b43..dde9739aba 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -8,6 +8,8 @@ on: jobs: build-backstage: + env: + NODE_OPTIONS: --max-old-space-size=4096 name: Build PR image runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }} From 77fa4d45d5cc465830a8a360541db3b070129d21 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 11:55:58 +0100 Subject: [PATCH 11/29] chore: fix naming and remove example-app prefix Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index dde9739aba..adee4473f0 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -34,11 +34,11 @@ jobs: run: | cp -f ./.github/uffizzi/uffizzi.production.app-config.yaml ./app-config.production.yaml; - - name: yarn build + - name: typescript build run: | yarn tsc:full - - name: yarn build + - name: backstage build run: | yarn build:all @@ -59,7 +59,7 @@ jobs: - name: Build Image uses: docker/build-push-action@v2 with: - context: example-app + context: . file: packages/backend/Dockerfile tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 164d5640d83d787140d6becd8ca501e5df1d4b9c Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 12:46:57 +0100 Subject: [PATCH 12/29] husky is not installed inside the docker container when running with --production installs Signed-off-by: blam --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6e99f4f176..f276d42416 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "techdocs-cli": "node scripts/techdocs-cli.js", "techdocs-cli:dev": "cross-env TECHDOCS_CLI_DEV_MODE=true node scripts/techdocs-cli.js", "prepare": "husky install", - "postinstall": "husky install" + "postinstall": "husky install || true" }, "workspaces": { "packages": [ From 23037b25fc9691a8a8f2db245b879fb2f242c013 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 13:24:28 +0100 Subject: [PATCH 13/29] chore: fixing app config Signed-off-by: blam --- .github/uffizzi/uffizzi.production.app-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index d6df12a6af..0d33ec5c38 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -8,3 +8,7 @@ backend: origin: ${UFFIZZI_URL} methods: [GET, POST, PUT, DELETE] credentials: true + auth: + keys: + # random mock key for uffizi deployments + - secret: 5TXvdjVZFxF7qf9K5RAYRDoGrLzJooqa From e37884e87f95101193074491e99c20a8c5cf35ab Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 13:25:01 +0100 Subject: [PATCH 14/29] chore; fixing dockerfile to include the production cofnig Signed-off-by: blam --- packages/backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/Dockerfile b/packages/backend/Dockerfile index eca6ce82c2..7dc11e2e12 100644 --- a/packages/backend/Dockerfile +++ b/packages/backend/Dockerfile @@ -46,4 +46,4 @@ RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,sharing=locked,uid=10 COPY --chown=node:node packages/backend/dist/bundle.tar.gz app-config*.yaml ./ RUN tar xzf bundle.tar.gz && rm bundle.tar.gz -CMD ["node", "packages/backend", "--config", "app-config.yaml"] +CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"] From e64ffefc5329f97cf1b18ea0aa81236387adb881 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:01:06 +0100 Subject: [PATCH 15/29] chore: more config Signed-off-by: blam --- .github/uffizzi/uffizzi.production.app-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index 0d33ec5c38..6e62fa2e38 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -12,3 +12,11 @@ backend: keys: # random mock key for uffizi deployments - secret: 5TXvdjVZFxF7qf9K5RAYRDoGrLzJooqa +auth: + environment: production + providers: {} + +catalog: + locations: + - type: url + target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml From 02c1dee6a0df4f172bbb572a65281c0641cfdcce Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:20:37 +0100 Subject: [PATCH 16/29] chore: merging the config is bad Signed-off-by: blam --- .../uffizzi.production.app-config.yaml | 147 +++++++++++++++++- .github/workflows/uffizzi-build.yml | 2 +- packages/backend/Dockerfile | 2 +- 3 files changed, 144 insertions(+), 7 deletions(-) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index 6e62fa2e38..1a48a38eb1 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -4,19 +4,156 @@ app: backend: baseUrl: ${UFFIZZI_URL} - cors: - origin: ${UFFIZZI_URL} - methods: [GET, POST, PUT, DELETE] - credentials: true auth: keys: # random mock key for uffizi deployments - secret: 5TXvdjVZFxF7qf9K5RAYRDoGrLzJooqa + listen: + port: 7007 + database: + client: pg + connection: + host: ${POSTGRES_HOST} + user: ${POSTGRES_USER} + password: ${POSTGRES_PASSWORD} + port: 5432 + cache: + store: memory + cors: + origin: http://localhost:3000 + methods: [GET, HEAD, PATCH, POST, PUT, DELETE] + credentials: true + csp: + connect-src: ["'self'", 'http:', 'https:'] + auth: environment: production - providers: {} + providers: + myproxy: + production: {} catalog: locations: - type: url target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml + +techdocs: + builder: 'local' # Alternatives - 'external' + generator: + runIn: 'docker' + # 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: + type: 'local' # Alternatives - 'googleGcs' or 'awsS3' or 'azureBlobStorage' or 'openStackSwift'. Read documentation for using alternatives. + +dynatrace: + baseUrl: https://your.dynatrace.instance.com + +# Score-cards sample configuration. +scorecards: + jsonDataUrl: https://raw.githubusercontent.com/Oriflame/backstage-plugins/main/plugins/score-card/sample-data/ + wikiLinkTemplate: https://link-to-wiki/{id} + +sentry: + organization: my-company + +rollbar: + organization: my-company + # NOTE: The rollbar-backend & accountToken key may be deprecated in the future (replaced by a proxy config) + accountToken: my-rollbar-account-token + +lighthouse: + baseUrl: http://localhost:3003 + +kubernetes: + serviceLocatorMethod: + type: 'multiTenant' + clusterLocatorMethods: + - type: 'config' + clusters: [] +kafka: + clientId: backstage + clusters: + - name: cluster + dashboardUrl: https://akhq.io/ + brokers: + - localhost:9092 +allure: + baseUrl: http://localhost:5050/allure-docker-service +integrations: + github: + - host: github.com + token: ${GITHUB_TOKEN} +scaffolder: {} +costInsights: + engineerCost: 200000 + engineerThreshold: 0.5 + products: + computeEngine: + name: Compute Engine + icon: compute + cloudDataflow: + name: Cloud Dataflow + icon: data + cloudStorage: + name: Cloud Storage + icon: storage + bigQuery: + name: BigQuery + icon: search + events: + name: Events + icon: data + metrics: + DAU: + name: Daily Active Users + default: true + MSC: + name: Monthly Subscribers + currencies: + engineers: + label: 'Engineers 🛠' + unit: 'engineer' + usd: + label: 'US Dollars 💵' + kind: 'USD' + unit: 'dollar' + prefix: '$' + rate: 1 + carbonOffsetTons: + label: 'Carbon Offset Tons ♻️⚖️s' + kind: 'CARBON_OFFSET_TONS' + unit: 'carbon offset ton' + rate: 3.5 + beers: + label: 'Beers 🍺' + kind: 'BEERS' + unit: 'beer' + rate: 4.5 + pintsIceCream: + label: 'Pints of Ice Cream 🍦' + kind: 'PINTS_OF_ICE_CREAM' + unit: 'ice cream pint' + rate: 5.5 +pagerduty: + eventsBaseUrl: 'https://events.pagerduty.com/v2' +jenkins: + instances: + - name: default + baseUrl: https://jenkins.example.com + username: backstage-bot + apiKey: 123456789abcdef0123456789abcedf012 + +azureDevOps: + host: dev.azure.com + token: my-token + organization: my-company + +apacheAirflow: + baseUrl: https://your.airflow.instance.com + +gocd: + baseUrl: https://your.gocd.instance.com + +permission: + enabled: true diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index adee4473f0..54f100229a 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -32,7 +32,7 @@ jobs: - name: Use Uffizzi's backstage app config run: | - cp -f ./.github/uffizzi/uffizzi.production.app-config.yaml ./app-config.production.yaml; + cp -f ./.github/uffizzi/uffizzi.production.app-config.yaml ./app-config.yaml - name: typescript build run: | diff --git a/packages/backend/Dockerfile b/packages/backend/Dockerfile index 7dc11e2e12..eca6ce82c2 100644 --- a/packages/backend/Dockerfile +++ b/packages/backend/Dockerfile @@ -46,4 +46,4 @@ RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,sharing=locked,uid=10 COPY --chown=node:node packages/backend/dist/bundle.tar.gz app-config*.yaml ./ RUN tar xzf bundle.tar.gz && rm bundle.tar.gz -CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.production.yaml"] +CMD ["node", "packages/backend", "--config", "app-config.yaml"] From 745868199eeb75d4a513a36b827c5bb1837c5b91 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:24:50 +0100 Subject: [PATCH 17/29] chore: fix uffizzi link Signed-off-by: blam --- .github/uffizzi/docker-compose.uffizzi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/uffizzi/docker-compose.uffizzi.yml b/.github/uffizzi/docker-compose.uffizzi.yml index f505205505..d19979c8bb 100644 --- a/.github/uffizzi/docker-compose.uffizzi.yml +++ b/.github/uffizzi/docker-compose.uffizzi.yml @@ -21,7 +21,7 @@ services: entrypoint: '/bin/sh' command: - '-c' - - "APP_CONFIG_app_baseUrl=$$UFFIZZI_URL APP_CONFIG_backend_baseUrl=$$UFFIZZI_URL APP_CONFIG_auth_environment='production' node packages/backend --config app-config.yaml --config app-config.production.yaml" + - "APP_CONFIG_app_baseUrl=$$UFFIZZI_URL APP_CONFIG_backend_baseUrl=$$UFFIZZI_URL APP_CONFIG_auth_environment='production' node packages/backend --config app-config.yaml" db: image: postgres From b781c9458428538ef01acde248daf756f6718542 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:27:12 +0100 Subject: [PATCH 18/29] chore: mock Signed-off-by: blam Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 54f100229a..25306e0f57 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -10,6 +10,7 @@ jobs: build-backstage: env: NODE_OPTIONS: --max-old-space-size=4096 + UFFIZZI_URL: https://uffizzi.com name: Build PR image runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }} From 033384c3b54f37cc5b41cd7bcb46031ec6a1dd28 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:41:21 +0100 Subject: [PATCH 19/29] chore: fixing compose file for uffizi and postgres Signed-off-by: blam --- .github/uffizzi/docker-compose.uffizzi.yml | 2 ++ .github/uffizzi/uffizzi.production.app-config.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/uffizzi/docker-compose.uffizzi.yml b/.github/uffizzi/docker-compose.uffizzi.yml index d19979c8bb..8ac3bb7ab8 100644 --- a/.github/uffizzi/docker-compose.uffizzi.yml +++ b/.github/uffizzi/docker-compose.uffizzi.yml @@ -8,6 +8,8 @@ x-uffizzi: services: backstage: image: '${BACKSTAGE_IMAGE}' + depends_on: + - db environment: POSTGRES_HOST: localhost POSTGRES_USER: postgres diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index 1a48a38eb1..a962060fc8 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -13,7 +13,7 @@ backend: database: client: pg connection: - host: ${POSTGRES_HOST} + host: db user: ${POSTGRES_USER} password: ${POSTGRES_PASSWORD} port: 5432 From 570d2be33119c06ecc83ed672326ed1c4683744f Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:44:22 +0100 Subject: [PATCH 20/29] chore: remove permissions enabled Signed-off-by: blam --- .github/uffizzi/uffizzi.production.app-config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index a962060fc8..faf78e7239 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -154,6 +154,3 @@ apacheAirflow: gocd: baseUrl: https://your.gocd.instance.com - -permission: - enabled: true From 7cef9c36232233e19de39d2faf4c47b252de4fef Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:46:04 +0100 Subject: [PATCH 21/29] chore: fixing reading allowlist Signed-off-by: blam --- .github/uffizzi/uffizzi.production.app-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index faf78e7239..a7880ad4a3 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -25,6 +25,10 @@ backend: credentials: true csp: connect-src: ["'self'", 'http:', 'https:'] + reading: + allow: + - host: github.com + - host: raw.githubusercontent.com auth: environment: production From 4c2b469e8e276c0e0272f32a9b9b41a3b3dd070c Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:46:48 +0100 Subject: [PATCH 22/29] chore: remove github token Signed-off-by: blam --- .github/uffizzi/docker-compose.uffizzi.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/uffizzi/docker-compose.uffizzi.yml b/.github/uffizzi/docker-compose.uffizzi.yml index 8ac3bb7ab8..53f3c13a2e 100644 --- a/.github/uffizzi/docker-compose.uffizzi.yml +++ b/.github/uffizzi/docker-compose.uffizzi.yml @@ -14,7 +14,6 @@ services: POSTGRES_HOST: localhost POSTGRES_USER: postgres POSTGRES_PASSWORD: example - GITHUB_TOKEN: abc NODE_ENV: production deploy: resources: From c6778236e575ca2607834be788f0489c8367a3ee Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 14:55:09 +0100 Subject: [PATCH 23/29] chore: fixing config Signed-off-by: blam --- .github/uffizzi/uffizzi.production.app-config.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index a7880ad4a3..c65bc51786 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -25,16 +25,9 @@ backend: credentials: true csp: connect-src: ["'self'", 'http:', 'https:'] - reading: - allow: - - host: github.com - - host: raw.githubusercontent.com - auth: environment: production - providers: - myproxy: - production: {} + providers: {} catalog: locations: From 06c6bc786d6a3f2695d09f88b3497d21bbdd9592 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 15:30:35 +0100 Subject: [PATCH 24/29] chore: remove depends_on Signed-off-by: blam --- .github/uffizzi/docker-compose.uffizzi.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/uffizzi/docker-compose.uffizzi.yml b/.github/uffizzi/docker-compose.uffizzi.yml index 53f3c13a2e..74477e06aa 100644 --- a/.github/uffizzi/docker-compose.uffizzi.yml +++ b/.github/uffizzi/docker-compose.uffizzi.yml @@ -8,8 +8,7 @@ x-uffizzi: services: backstage: image: '${BACKSTAGE_IMAGE}' - depends_on: - - db + environment: POSTGRES_HOST: localhost POSTGRES_USER: postgres From 5e7cc957e9cd546e48d7c41a27037bbd1628ad62 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 21 Dec 2022 15:31:03 +0100 Subject: [PATCH 25/29] chore: host is db Signed-off-by: blam --- .github/uffizzi/docker-compose.uffizzi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/uffizzi/docker-compose.uffizzi.yml b/.github/uffizzi/docker-compose.uffizzi.yml index 74477e06aa..49039cad2a 100644 --- a/.github/uffizzi/docker-compose.uffizzi.yml +++ b/.github/uffizzi/docker-compose.uffizzi.yml @@ -10,7 +10,7 @@ services: image: '${BACKSTAGE_IMAGE}' environment: - POSTGRES_HOST: localhost + POSTGRES_HOST: db POSTGRES_USER: postgres POSTGRES_PASSWORD: example NODE_ENV: production From ade5b9ca4acedc6c24b0afa51bdd7a211b9185bb Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 22 Dec 2022 11:18:53 +0100 Subject: [PATCH 26/29] chore: updating app-config.yaml for uffizzi Signed-off-by: blam --- .../uffizzi.production.app-config.yaml | 122 ++++++++++++++++-- 1 file changed, 114 insertions(+), 8 deletions(-) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index c65bc51786..56055c8342 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -2,6 +2,9 @@ app: title: Backstage Uffizzi Environment baseUrl: ${UFFIZZI_URL} +organization: + name: My Company + backend: baseUrl: ${UFFIZZI_URL} auth: @@ -11,20 +14,19 @@ backend: listen: port: 7007 database: - client: pg - connection: - host: db - user: ${POSTGRES_USER} - password: ${POSTGRES_PASSWORD} - port: 5432 + client: better-sqlite3 + connection: ':memory:' cache: store: memory cors: - origin: http://localhost:3000 + origin: ${UFFIZZI_URL} methods: [GET, HEAD, PATCH, POST, PUT, DELETE] credentials: true csp: connect-src: ["'self'", 'http:', 'https:'] + # 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 + auth: environment: production providers: {} @@ -34,6 +36,74 @@ catalog: - type: url target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml +proxy: + '/circleci/api': + target: https://circleci.com/api/v1.1 + headers: + Circle-Token: ${CIRCLECI_AUTH_TOKEN} + + '/jenkins/api': + target: http://localhost:8080 + headers: + Authorization: ${JENKINS_BASIC_AUTH_HEADER} + + '/travisci/api': + target: https://api.travis-ci.com + changeOrigin: true + headers: + Authorization: ${TRAVISCI_AUTH_TOKEN} + travis-api-version: '3' + + '/newrelic/apm/api': + target: https://api.newrelic.com/v2 + headers: + X-Api-Key: ${NEW_RELIC_REST_API_KEY} + + '/newrelic/api': + target: https://api.newrelic.com + headers: + X-Api-Key: ${NEW_RELIC_USER_KEY} + + '/pagerduty': + target: https://api.pagerduty.com + headers: + Authorization: Token token=${PAGERDUTY_TOKEN} + + '/buildkite/api': + target: https://api.buildkite.com/v2/ + headers: + Authorization: ${BUILDKITE_TOKEN} + + '/sentry/api': + target: https://sentry.io/api/ + allowedMethods: ['GET'] + headers: + Authorization: ${SENTRY_TOKEN} + + '/ilert': + target: https://api.ilert.com + allowedMethods: ['GET', 'POST', 'PUT'] + allowedHeaders: ['Authorization'] + headers: + Authorization: ${ILERT_AUTH_HEADER} + + '/airflow': + target: https://your.airflow.instance.com/api/v1 + headers: + Authorization: ${AIRFLOW_BASIC_AUTH_HEADER} + + '/gocd': + target: https://your.gocd.instance.com/go/api + allowedMethods: ['GET'] + allowedHeaders: ['Authorization'] + headers: + Authorization: Basic ${GOCD_AUTH_CREDENTIALS} + + '/dynatrace': + target: https://your.dynatrace.instance.com/api/v2 + headers: + Authorization: 'Api-Token ${DYNATRACE_ACCESS_TOKEN}' + techdocs: builder: 'local' # Alternatives - 'external' generator: @@ -68,6 +138,7 @@ kubernetes: clusterLocatorMethods: - type: 'config' clusters: [] + kafka: clientId: backstage clusters: @@ -75,13 +146,45 @@ kafka: dashboardUrl: https://akhq.io/ brokers: - localhost:9092 + allure: baseUrl: http://localhost:5050/allure-docker-service + integrations: github: - host: github.com token: ${GITHUB_TOKEN} -scaffolder: {} + ### Example for how to add your GitHub Enterprise instance using the API: + # - host: ghe.example.net + # apiBaseUrl: https://ghe.example.net/api/v3 + # token: ${GHE_TOKEN} + ### Example for how to add your GitHub Enterprise instance using raw HTTP fetches (token is optional): + # - host: ghe.example.net + # rawBaseUrl: https://ghe.example.net/raw + # token: ${GHE_TOKEN} + gitlab: + - host: gitlab.com + token: ${GITLAB_TOKEN} + ### Example for how to add a bitbucket cloud integration + # bitbucketCloud: + # - username: ${BITBUCKET_USERNAME} + # appPassword: ${BITBUCKET_APP_PASSWORD} + ### Example for how to add your bitbucket server instance using the API: + # - host: server.bitbucket.com + # apiBaseUrl: server.bitbucket.com + # username: ${BITBUCKET_SERVER_USERNAME} + # appPassword: ${BITBUCKET_SERVER_APP_PASSWORD} + azure: + - host: dev.azure.com + token: ${AZURE_TOKEN} + # googleGcs: + # clientEmail: 'example@example.com' + # privateKey: ${GCS_PRIVATE_KEY} + awsS3: + - host: amazonaws.com + accessKeyId: ${AWS_ACCESS_KEY_ID} + secretAccessKey: ${AWS_SECRET_ACCESS_KEY} + costInsights: engineerCost: 200000 engineerThreshold: 0.5 @@ -151,3 +254,6 @@ apacheAirflow: gocd: baseUrl: https://your.gocd.instance.com + +permission: + enabled: true From 5157208d24b55fa10e70a9cd0809781c5f1ccfe1 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 22 Dec 2022 12:24:06 +0100 Subject: [PATCH 27/29] chore: just build the backend Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 25306e0f57..a170521ec9 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -41,7 +41,7 @@ jobs: - name: backstage build run: | - yarn build:all + yarn workspace backend build - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 From d756a38b17bf54d4cc79e4173b7b87ce8abc8fd0 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 22 Dec 2022 14:57:07 +0100 Subject: [PATCH 28/29] chore: don't need full types here Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index a170521ec9..e609aa1baa 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -37,7 +37,7 @@ jobs: - name: typescript build run: | - yarn tsc:full + yarn tsc - name: backstage build run: | From 71a0dee0b80f98fbda5a3b029eca88c009dc88f0 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 22 Dec 2022 16:00:41 +0100 Subject: [PATCH 29/29] chore: build example backend Signed-off-by: blam --- .github/workflows/uffizzi-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index e609aa1baa..1a86f8de71 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -41,7 +41,7 @@ jobs: - name: backstage build run: | - yarn workspace backend build + yarn workspace example-backend build - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2