chore: refactor and rename a little bit
Signed-off-by: benjdlambert <ben@blam.sh>
@@ -0,0 +1,8 @@
|
||||
.git
|
||||
.yarn/cache
|
||||
.yarn/install-state.gz
|
||||
node_modules
|
||||
packages/*/src
|
||||
packages/*/node_modules
|
||||
plugins
|
||||
*.local.yaml
|
||||
@@ -0,0 +1 @@
|
||||
playwright.config.ts
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Coverage directory generated when running tests with coverage
|
||||
coverage
|
||||
|
||||
# Dependencies
|
||||
node_modules/
|
||||
|
||||
# Yarn files
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
# Node version directives
|
||||
.nvmrc
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# Build output
|
||||
dist
|
||||
dist-types
|
||||
|
||||
# Temporary change files created by Vim
|
||||
*.swp
|
||||
|
||||
# MkDocs build output
|
||||
site
|
||||
|
||||
# Local configuration files
|
||||
*.local.yaml
|
||||
|
||||
# Sensitive credentials
|
||||
*-credentials.yaml
|
||||
|
||||
# vscode database functionality support files
|
||||
*.session.sql
|
||||
|
||||
# E2E test reports
|
||||
e2e-test-report/
|
||||
|
||||
# Cache
|
||||
.cache/
|
||||
@@ -0,0 +1,4 @@
|
||||
dist
|
||||
dist-types
|
||||
coverage
|
||||
.vscode
|
||||
@@ -0,0 +1,3 @@
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.4.1.cjs
|
||||
@@ -0,0 +1,10 @@
|
||||
# [Backstage](https://backstage.io)
|
||||
|
||||
This is your newly scaffolded Backstage App, Good Luck!
|
||||
|
||||
To start the app, run:
|
||||
|
||||
```sh
|
||||
yarn install
|
||||
yarn start
|
||||
```
|
||||
@@ -0,0 +1,55 @@
|
||||
app:
|
||||
# Should be the same as backend.baseUrl when using the `app-backend` plugin.
|
||||
baseUrl: http://localhost:7007
|
||||
|
||||
backend:
|
||||
# Note that the baseUrl should be the URL that the browser and other clients
|
||||
# should use when communicating with the backend, i.e. it needs to be
|
||||
# reachable not just from within the backend host, but from all of your
|
||||
# callers. When its value is "http://localhost:7007", it's strictly private
|
||||
# and can't be reached by others.
|
||||
baseUrl: http://localhost:7007
|
||||
# The listener can also be expressed as a single <host>:<port> string. In this case we bind to
|
||||
# all interfaces, the most permissive setting. The right value depends on your specific deployment.
|
||||
listen: ':7007'
|
||||
|
||||
# config options: https://node-postgres.com/apis/client
|
||||
database:
|
||||
client: pg
|
||||
connection:
|
||||
host: ${POSTGRES_HOST}
|
||||
port: ${POSTGRES_PORT}
|
||||
user: ${POSTGRES_USER}
|
||||
password: ${POSTGRES_PASSWORD}
|
||||
# https://node-postgres.com/features/ssl
|
||||
# you can set the sslmode configuration option via the `PGSSLMODE` environment variable
|
||||
# see https://www.postgresql.org/docs/current/libpq-ssl.html Table 33.1. SSL Mode Descriptions (e.g. require)
|
||||
# ssl:
|
||||
# ca: # if you have a CA file and want to verify it you can uncomment this section
|
||||
# $file: <file-path>/ca/server.crt
|
||||
|
||||
auth:
|
||||
providers:
|
||||
guest: {}
|
||||
|
||||
catalog:
|
||||
# Overrides the default list locations from app-config.yaml as these contain example data.
|
||||
# See https://backstage.io/docs/features/software-catalog/#adding-components-to-the-catalog for more details
|
||||
# on how to get entities into the catalog.
|
||||
locations:
|
||||
# Local example data, replace this with your production config, these are intended for demo use only.
|
||||
# File locations are relative to the backend process, typically in a deployed context, such as in a Docker container, this will be the root
|
||||
- type: file
|
||||
target: ./examples/entities.yaml
|
||||
|
||||
# Local example template
|
||||
- type: file
|
||||
target: ./examples/template/template.yaml
|
||||
rules:
|
||||
- allow: [Template]
|
||||
|
||||
# Local example organizational data
|
||||
- type: file
|
||||
target: ./examples/org.yaml
|
||||
rules:
|
||||
- allow: [User, Group]
|
||||
@@ -0,0 +1,116 @@
|
||||
app:
|
||||
title: Scaffolded Backstage App
|
||||
baseUrl: http://localhost:3000
|
||||
|
||||
experimental:
|
||||
packages: all
|
||||
|
||||
organization:
|
||||
name: My Company
|
||||
|
||||
backend:
|
||||
# Used for enabling authentication, secret is shared by all backend plugins
|
||||
# See https://backstage.io/docs/auth/service-to-service-auth for
|
||||
# information on the format
|
||||
# auth:
|
||||
# keys:
|
||||
# - secret: ${BACKEND_SECRET}
|
||||
baseUrl: http://localhost:7007
|
||||
listen:
|
||||
port: 7007
|
||||
# Uncomment the following host directive to bind to specific interfaces
|
||||
# host: 127.0.0.1
|
||||
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
|
||||
cors:
|
||||
origin: http://localhost:3000
|
||||
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
|
||||
credentials: true
|
||||
# This is for local development only, it is not recommended to use this in production
|
||||
# The production database configuration is stored in app-config.production.yaml
|
||||
database:
|
||||
client: better-sqlite3
|
||||
connection: ':memory:'
|
||||
# workingDirectory: /tmp # Use this to configure a working directory for the scaffolder, defaults to the OS temp-dir
|
||||
|
||||
integrations:
|
||||
github:
|
||||
- host: github.com
|
||||
# This is a Personal Access Token or PAT from GitHub. You can find out how to generate this token, and more information
|
||||
# about setting up the GitHub integration here: https://backstage.io/docs/integrations/github/locations#configuration
|
||||
token: ${GITHUB_TOKEN}
|
||||
### 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}
|
||||
|
||||
proxy:
|
||||
### Example for how to add a proxy endpoint for the frontend.
|
||||
### A typical reason to do this is to handle HTTPS and CORS for internal services.
|
||||
# endpoints:
|
||||
# '/test':
|
||||
# target: 'https://example.com'
|
||||
# changeOrigin: true
|
||||
|
||||
# Reference documentation http://backstage.io/docs/features/techdocs/configuration
|
||||
# Note: After experimenting with basic setup, use CI/CD to generate docs
|
||||
# and an external cloud storage when deploying TechDocs for production use-case.
|
||||
# https://backstage.io/docs/features/techdocs/how-to-guides#how-to-migrate-from-techdocs-basic-to-recommended-deployment-approach
|
||||
techdocs:
|
||||
builder: 'local' # Alternatives - 'external'
|
||||
generator:
|
||||
runIn: 'docker' # Alternatives - 'local'
|
||||
publisher:
|
||||
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.
|
||||
|
||||
auth:
|
||||
# see https://backstage.io/docs/auth/ to learn about auth providers
|
||||
providers:
|
||||
# See https://backstage.io/docs/auth/guest/provider
|
||||
guest: {}
|
||||
|
||||
scaffolder:
|
||||
# see https://backstage.io/docs/features/software-templates/configuration for software template options
|
||||
|
||||
catalog:
|
||||
import:
|
||||
entityFilename: catalog-info.yaml
|
||||
pullRequestBranchName: backstage-integration
|
||||
rules:
|
||||
- allow: [Component, System, API, Resource, Location]
|
||||
locations:
|
||||
# Local example data, file locations are relative to the backend process, typically `packages/backend`
|
||||
- type: file
|
||||
target: ../../examples/entities.yaml
|
||||
|
||||
# Local example template
|
||||
- type: file
|
||||
target: ../../examples/template/template.yaml
|
||||
rules:
|
||||
- allow: [Template]
|
||||
|
||||
# Local example organizational data
|
||||
- type: file
|
||||
target: ../../examples/org.yaml
|
||||
rules:
|
||||
- allow: [User, Group]
|
||||
|
||||
## Uncomment these lines to add more example data
|
||||
# - type: url
|
||||
# target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml
|
||||
|
||||
## Uncomment these lines to add an example org
|
||||
# - type: url
|
||||
# target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/acme-corp.yaml
|
||||
# rules:
|
||||
# - allow: [User, Group]
|
||||
|
||||
kubernetes:
|
||||
# see https://backstage.io/docs/features/kubernetes/configuration for kubernetes configuration options
|
||||
|
||||
# see https://backstage.io/docs/permissions/getting-started for more on the permission framework
|
||||
permission:
|
||||
# setting this to `false` will disable permissions
|
||||
enabled: true
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"version": "{{version 'root'}}"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: {{name}}
|
||||
description: An example of a Backstage application.
|
||||
# Example for optional annotations
|
||||
# annotations:
|
||||
# github.com/project-slug: backstage/backstage
|
||||
# backstage.io/techdocs-ref: dir:.
|
||||
spec:
|
||||
type: website
|
||||
owner: john@example.com
|
||||
lifecycle: experimental
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: System
|
||||
metadata:
|
||||
name: examples
|
||||
spec:
|
||||
owner: guests
|
||||
---
|
||||
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: example-website
|
||||
spec:
|
||||
type: website
|
||||
lifecycle: experimental
|
||||
owner: guests
|
||||
system: examples
|
||||
providesApis: [example-grpc-api]
|
||||
---
|
||||
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-api
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: API
|
||||
metadata:
|
||||
name: example-grpc-api
|
||||
spec:
|
||||
type: grpc
|
||||
lifecycle: experimental
|
||||
owner: guests
|
||||
system: examples
|
||||
definition: |
|
||||
syntax = "proto3";
|
||||
|
||||
service Exampler {
|
||||
rpc Example (ExampleMessage) returns (ExampleMessage) {};
|
||||
}
|
||||
|
||||
message ExampleMessage {
|
||||
string example = 1;
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-user
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: User
|
||||
metadata:
|
||||
name: guest
|
||||
spec:
|
||||
memberOf: [guests]
|
||||
---
|
||||
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-group
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Group
|
||||
metadata:
|
||||
name: guests
|
||||
spec:
|
||||
type: team
|
||||
children: []
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: ${{ values.name | dump }}
|
||||
spec:
|
||||
type: service
|
||||
owner: user:guest
|
||||
lifecycle: experimental
|
||||
@@ -0,0 +1 @@
|
||||
console.log('Hello from ${{ values.name }}!');
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "${{ values.name }}",
|
||||
"private": true,
|
||||
"dependencies": {}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
apiVersion: scaffolder.backstage.io/v1beta3
|
||||
# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template
|
||||
kind: Template
|
||||
metadata:
|
||||
name: example-nodejs-template
|
||||
title: Example Node.js Template
|
||||
description: An example template for the scaffolder that creates a simple Node.js service
|
||||
spec:
|
||||
owner: user:guest
|
||||
type: service
|
||||
|
||||
# These parameters are used to generate the input form in the frontend, and are
|
||||
# used to gather input data for the execution of the template.
|
||||
parameters:
|
||||
- title: Fill in some steps
|
||||
required:
|
||||
- name
|
||||
properties:
|
||||
name:
|
||||
title: Name
|
||||
type: string
|
||||
description: Unique name of the component
|
||||
ui:autofocus: true
|
||||
ui:options:
|
||||
rows: 5
|
||||
- title: Choose a location
|
||||
required:
|
||||
- repoUrl
|
||||
properties:
|
||||
repoUrl:
|
||||
title: Repository Location
|
||||
type: string
|
||||
ui:field: RepoUrlPicker
|
||||
ui:options:
|
||||
allowedHosts:
|
||||
- github.com
|
||||
|
||||
# These steps are executed in the scaffolder backend, using data that we gathered
|
||||
# via the parameters above.
|
||||
steps:
|
||||
# Each step executes an action, in this case one templates files into the working directory.
|
||||
- id: fetch-base
|
||||
name: Fetch Base
|
||||
action: fetch:template
|
||||
input:
|
||||
url: ./content
|
||||
values:
|
||||
name: ${{ parameters.name }}
|
||||
|
||||
# This step publishes the contents of the working directory to GitHub.
|
||||
# If you or your organization prefer another default branch name over 'main'
|
||||
# you can change that here.
|
||||
- id: publish
|
||||
name: Publish
|
||||
action: publish:github
|
||||
input:
|
||||
description: This is ${{ parameters.name }}
|
||||
repoUrl: ${{ parameters.repoUrl }}
|
||||
defaultBranch: 'main'
|
||||
|
||||
# The final step is to register our new component in the catalog.
|
||||
- id: register
|
||||
name: Register
|
||||
action: catalog:register
|
||||
input:
|
||||
repoContentsUrl: ${{ steps['publish'].output.repoContentsUrl }}
|
||||
catalogInfoPath: '/catalog-info.yaml'
|
||||
|
||||
# Outputs are displayed to the user after a successful execution of the template.
|
||||
output:
|
||||
links:
|
||||
- title: Repository
|
||||
url: ${{ steps['publish'].output.remoteUrl }}
|
||||
- title: Open in catalog
|
||||
icon: catalog
|
||||
entityRef: ${{ steps['register'].output.entityRef }}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "root",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": "20 || 22"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "backstage-cli repo start",
|
||||
"build:backend": "yarn workspace backend build",
|
||||
"build:all": "backstage-cli repo build --all",
|
||||
"build-image": "yarn workspace backend build-image",
|
||||
"tsc": "tsc",
|
||||
"tsc:full": "tsc --skipLibCheck false --incremental false",
|
||||
"clean": "backstage-cli repo clean",
|
||||
"test": "backstage-cli repo test",
|
||||
"test:all": "backstage-cli repo test --coverage",
|
||||
"test:e2e": "playwright test",
|
||||
"fix": "backstage-cli repo fix",
|
||||
"lint": "backstage-cli repo lint --since origin/{{defaultBranch}}",
|
||||
"lint:all": "backstage-cli repo lint",
|
||||
"prettier:check": "prettier --check .",
|
||||
"new": "backstage-cli new"
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"packages/*",
|
||||
"plugins/*"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^{{version '@backstage/cli'}}",
|
||||
"@backstage/e2e-test-utils": "^{{version '@backstage/e2e-test-utils'}}",
|
||||
"@playwright/test": "^1.32.3",
|
||||
"node-gyp": "^10.0.0",
|
||||
"prettier": "^2.3.2",
|
||||
"typescript": "~5.8.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18"
|
||||
},
|
||||
"prettier": "@backstage/cli/config/prettier",
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,ts,tsx,mjs,cjs}": [
|
||||
"eslint --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"*.{json,md}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"packageManager": "yarn@4.4.1"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# The Packages Folder
|
||||
|
||||
This is where your own applications and centrally managed libraries live, each
|
||||
in a separate folder of its own.
|
||||
|
||||
From the start there's an `app` folder (for the frontend) and a `backend` folder
|
||||
(for the Node backend), but you can also add more modules in here that house
|
||||
your core additions and adaptations, such as themes, common React component
|
||||
libraries, utilities, and similar.
|
||||
@@ -14,17 +14,22 @@
|
||||
"lint": "backstage-cli package lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/frontend-defaults": "^{{version '@backstage/frontend-defaults'}}",
|
||||
"@backstage/frontend-plugin-api": "^{{version '@backstage/frontend-plugin-api'}}",
|
||||
"@backstage/plugin-catalog": "^{{version '@backstage/plugin-catalog'}}",
|
||||
"@backstage/ui": "^{{version '@backstage/ui'}}",
|
||||
"@backstage/core-compat-api": "^{{ version '@backstage/core-compat-api'}}",
|
||||
"@backstage/frontend-defaults": "^{{ version '@backstage/frontend-defaults'}}",
|
||||
"@backstage/frontend-plugin-api": "^{{ version '@backstage/frontend-plugin-api'}}",
|
||||
"@backstage/plugin-catalog": "^{{ version '@backstage/plugin-catalog'}}",
|
||||
"@backstage/plugin-org": "^{{ version '@backstage/plugin-org'}}",
|
||||
"@backstage/plugin-scaffolder": "^{{ version '@backstage/plugin-scaffolder'}}",
|
||||
"@backstage/plugin-search": "^{{ version '@backstage/plugin-search'}}",
|
||||
"@backstage/plugin-user-settings": "^{{ version '@backstage/plugin-user-settings'}}",
|
||||
"@backstage/ui": "^{{ version '@backstage/ui'}}",
|
||||
"react": "^18.0.2",
|
||||
"react-dom": "^18.0.2",
|
||||
"react-router": "^6.3.0",
|
||||
"react-router-dom": "^6.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/test-utils": "^{{version '@backstage/test-utils'}}",
|
||||
"@backstage/frontend-test-utils": "^{{ version '@backstage/frontend-test-utils'}}",
|
||||
"@playwright/test": "^1.32.3",
|
||||
"@testing-library/dom": "^9.0.0",
|
||||
"@testing-library/jest-dom": "^6.0.0",
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 883 B After Width: | Height: | Size: 883 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1 @@
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
@@ -0,0 +1,70 @@
|
||||
# This dockerfile builds an image for the backend package.
|
||||
# It should be executed with the root of the repo as docker context.
|
||||
#
|
||||
# Before building this image, be sure to have run the following commands in the repo root:
|
||||
#
|
||||
# yarn install --immutable
|
||||
# yarn tsc
|
||||
# yarn build:backend
|
||||
#
|
||||
# Once the commands have been run, you can build the image using `yarn build-image`
|
||||
#
|
||||
# Alternatively, there is also a multi-stage Dockerfile documented here:
|
||||
# https://backstage.io/docs/deployment/docker#multi-stage-build
|
||||
|
||||
FROM node:20-bookworm-slim
|
||||
|
||||
# Set Python interpreter for `node-gyp` to use
|
||||
ENV PYTHON=/usr/bin/python3
|
||||
|
||||
# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
|
||||
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 python3 g++ build-essential && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 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.
|
||||
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 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# From here on we use the least-privileged `node` user to run the backend.
|
||||
USER node
|
||||
|
||||
# This should create the app dir as `node`.
|
||||
# If it is instead created as `root` then the `tar` command below will fail: `can't create directory 'packages/': Permission denied`.
|
||||
# If this occurs, then ensure BuildKit is enabled (`DOCKER_BUILDKIT=1`) so the app dir is correctly created as `node`.
|
||||
WORKDIR /app
|
||||
|
||||
# Copy files needed by Yarn
|
||||
COPY --chown=node:node .yarn ./.yarn
|
||||
COPY --chown=node:node .yarnrc.yml ./
|
||||
COPY --chown=node:node backstage.json ./
|
||||
|
||||
# This switches many Node.js dependencies to production mode.
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# This disables node snapshot for Node 20 to work with the Scaffolder
|
||||
ENV NODE_OPTIONS="--no-node-snapshot"
|
||||
|
||||
# Copy repo skeleton first, to avoid unnecessary docker cache invalidation.
|
||||
# The skeleton contains the package.json of each package in the monorepo,
|
||||
# and along with yarn.lock and the root package.json, that's enough to run yarn install.
|
||||
COPY --chown=node:node yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
|
||||
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz
|
||||
|
||||
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
|
||||
yarn workspaces focus --all --production && rm -rf "$(yarn cache clean)"
|
||||
|
||||
# This will include the examples, if you don't need these simply remove this line
|
||||
COPY --chown=node:node examples ./examples
|
||||
|
||||
# Then copy the rest of the backend bundle, along with any other files we might want.
|
||||
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"]
|
||||
@@ -0,0 +1,59 @@
|
||||
# example-backend
|
||||
|
||||
This package is an EXAMPLE of a Backstage backend.
|
||||
|
||||
The main purpose of this package is to provide a test bed for Backstage plugins
|
||||
that have a backend part. Feel free to experiment locally or within your fork by
|
||||
adding dependencies and routes to this backend, to try things out.
|
||||
|
||||
Our goal is to eventually amend the create-app flow of the CLI, such that a
|
||||
production ready version of a backend skeleton is made alongside the frontend
|
||||
app. Until then, feel free to experiment here!
|
||||
|
||||
## Development
|
||||
|
||||
To run the example backend, first go to the project root and run
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
You should only need to do this once.
|
||||
|
||||
After that, go to the `packages/backend` directory and run
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
```
|
||||
|
||||
If you want to override any configuration locally, for example adding any secrets,
|
||||
you can do so in `app-config.local.yaml`.
|
||||
|
||||
The backend starts up on port 7007 per default.
|
||||
|
||||
## Populating The Catalog
|
||||
|
||||
If you want to use the catalog functionality, you need to add so called
|
||||
locations to the backend. These are places where the backend can find some
|
||||
entity descriptor data to consume and serve. For more information, see
|
||||
[Software Catalog Overview - Adding Components to the Catalog](https://backstage.io/docs/features/software-catalog/#adding-components-to-the-catalog).
|
||||
|
||||
To get started quickly, this template already includes some statically configured example locations
|
||||
in `app-config.yaml` under `catalog.locations`. You can remove and replace these locations as you
|
||||
like, and also override them for local development in `app-config.local.yaml`.
|
||||
|
||||
## Authentication
|
||||
|
||||
We chose [Passport](http://www.passportjs.org/) as authentication platform due
|
||||
to its comprehensive set of supported authentication
|
||||
[strategies](http://www.passportjs.org/packages/).
|
||||
|
||||
Read more about the
|
||||
[auth-backend](https://github.com/backstage/backstage/blob/master/plugins/auth-backend/README.md)
|
||||
and
|
||||
[how to add a new provider](https://github.com/backstage/backstage/blob/master/docs/auth/add-auth-provider.md)
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Backstage Readme](https://github.com/backstage/backstage/blob/master/README.md)
|
||||
- [Backstage Documentation](https://backstage.io/docs)
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "0.0.0",
|
||||
"main": "dist/index.cjs.js",
|
||||
"types": "src/index.ts",
|
||||
"private": true,
|
||||
"backstage": {
|
||||
"role": "backend"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "backstage-cli package start",
|
||||
"build": "backstage-cli package build",
|
||||
"lint": "backstage-cli package lint",
|
||||
"test": "backstage-cli package test",
|
||||
"clean": "backstage-cli package clean",
|
||||
"build-image": "docker build ../.. -f Dockerfile --tag backstage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-defaults": "^{{version '@backstage/backend-defaults'}}",
|
||||
"@backstage/config": "^{{version '@backstage/config'}}",
|
||||
"@backstage/plugin-app-backend": "^{{version '@backstage/plugin-app-backend'}}",
|
||||
"@backstage/plugin-auth-backend": "^{{version '@backstage/plugin-auth-backend'}}",
|
||||
"@backstage/plugin-auth-backend-module-github-provider": "^{{version '@backstage/plugin-auth-backend-module-github-provider'}}",
|
||||
"@backstage/plugin-auth-backend-module-guest-provider": "^{{version '@backstage/plugin-auth-backend-module-guest-provider'}}",
|
||||
"@backstage/plugin-auth-node": "^{{version '@backstage/plugin-auth-node'}}",
|
||||
"@backstage/plugin-catalog-backend": "^{{version '@backstage/plugin-catalog-backend'}}",
|
||||
"@backstage/plugin-catalog-backend-module-logs": "^{{version '@backstage/plugin-catalog-backend-module-logs'}}",
|
||||
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^{{version '@backstage/plugin-catalog-backend-module-scaffolder-entity-model'}}",
|
||||
"@backstage/plugin-kubernetes-backend": "^{{version '@backstage/plugin-kubernetes-backend'}}",
|
||||
"@backstage/plugin-permission-backend": "^{{version '@backstage/plugin-permission-backend'}}",
|
||||
"@backstage/plugin-permission-backend-module-allow-all-policy": "^{{version '@backstage/plugin-permission-backend-module-allow-all-policy'}}",
|
||||
"@backstage/plugin-permission-common": "^{{version '@backstage/plugin-permission-common'}}",
|
||||
"@backstage/plugin-permission-node": "^{{version '@backstage/plugin-permission-node'}}",
|
||||
"@backstage/plugin-proxy-backend": "^{{version '@backstage/plugin-proxy-backend'}}",
|
||||
"@backstage/plugin-scaffolder-backend": "^{{version '@backstage/plugin-scaffolder-backend'}}",
|
||||
"@backstage/plugin-scaffolder-backend-module-github": "^{{version '@backstage/plugin-scaffolder-backend-module-github'}}",
|
||||
"@backstage/plugin-search-backend": "^{{version '@backstage/plugin-search-backend'}}",
|
||||
"@backstage/plugin-search-backend-module-catalog": "^{{version '@backstage/plugin-search-backend-module-catalog'}}",
|
||||
"@backstage/plugin-search-backend-module-pg": "^{{version '@backstage/plugin-search-backend-module-pg'}}",
|
||||
"@backstage/plugin-search-backend-module-techdocs": "^{{version '@backstage/plugin-search-backend-module-techdocs'}}",
|
||||
"@backstage/plugin-search-backend-node": "^{{version '@backstage/plugin-search-backend-node'}}",
|
||||
"@backstage/plugin-techdocs-backend": "^{{version '@backstage/plugin-techdocs-backend'}}",
|
||||
"app": "link:../app",
|
||||
"better-sqlite3": "^9.0.0",
|
||||
"node-gyp": "^10.0.0",
|
||||
"pg": "^8.11.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^{{version '@backstage/cli'}}"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Hi!
|
||||
*
|
||||
* Note that this is an EXAMPLE Backstage backend. Please check the README.
|
||||
*
|
||||
* Happy hacking!
|
||||
*/
|
||||
|
||||
import { createBackend } from '@backstage/backend-defaults';
|
||||
|
||||
const backend = createBackend();
|
||||
|
||||
backend.add(import('@backstage/plugin-app-backend'));
|
||||
backend.add(import('@backstage/plugin-proxy-backend'));
|
||||
backend.add(import('@backstage/plugin-scaffolder-backend'));
|
||||
backend.add(import('@backstage/plugin-scaffolder-backend-module-github'));
|
||||
backend.add(import('@backstage/plugin-techdocs-backend'));
|
||||
|
||||
// auth plugin
|
||||
backend.add(import('@backstage/plugin-auth-backend'));
|
||||
// See https://backstage.io/docs/backend-system/building-backends/migrating#the-auth-plugin
|
||||
backend.add(import('@backstage/plugin-auth-backend-module-guest-provider'));
|
||||
// See https://backstage.io/docs/auth/guest/provider
|
||||
|
||||
// catalog plugin
|
||||
backend.add(import('@backstage/plugin-catalog-backend'));
|
||||
backend.add(
|
||||
import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'),
|
||||
);
|
||||
|
||||
// See https://backstage.io/docs/features/software-catalog/configuration#subscribing-to-catalog-errors
|
||||
backend.add(import('@backstage/plugin-catalog-backend-module-logs'));
|
||||
|
||||
// permission plugin
|
||||
backend.add(import('@backstage/plugin-permission-backend'));
|
||||
// See https://backstage.io/docs/permissions/getting-started for how to create your own permission policy
|
||||
backend.add(
|
||||
import('@backstage/plugin-permission-backend-module-allow-all-policy'),
|
||||
);
|
||||
|
||||
// search plugin
|
||||
backend.add(import('@backstage/plugin-search-backend'));
|
||||
|
||||
// search engine
|
||||
// See https://backstage.io/docs/features/search/search-engines
|
||||
backend.add(import('@backstage/plugin-search-backend-module-pg'));
|
||||
|
||||
// search collators
|
||||
backend.add(import('@backstage/plugin-search-backend-module-catalog'));
|
||||
backend.add(import('@backstage/plugin-search-backend-module-techdocs'));
|
||||
|
||||
// kubernetes
|
||||
backend.add(import('@backstage/plugin-kubernetes-backend'));
|
||||
|
||||
backend.start();
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2023 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { defineConfig } from '@playwright/test';
|
||||
import { generateProjects } from '@backstage/e2e-test-utils/playwright';
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
export default defineConfig({
|
||||
timeout: 60_000,
|
||||
|
||||
expect: {
|
||||
timeout: 5_000,
|
||||
},
|
||||
|
||||
// Run your local dev server before starting the tests
|
||||
webServer: process.env.CI
|
||||
? []
|
||||
: [
|
||||
{
|
||||
command: 'yarn start',
|
||||
port: 3000,
|
||||
reuseExistingServer: true,
|
||||
timeout: 60_000,
|
||||
},
|
||||
],
|
||||
|
||||
forbidOnly: !!process.env.CI,
|
||||
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
|
||||
reporter: [['html', { open: 'never', outputFolder: 'e2e-test-report' }]],
|
||||
|
||||
use: {
|
||||
actionTimeout: 0,
|
||||
baseURL:
|
||||
process.env.PLAYWRIGHT_URL ??
|
||||
(process.env.CI ? 'http://localhost:7007' : 'http://localhost:3000'),
|
||||
screenshot: 'only-on-failure',
|
||||
trace: 'on-first-retry',
|
||||
},
|
||||
|
||||
outputDir: 'node_modules/.cache/e2e-test-results',
|
||||
|
||||
projects: generateProjects(), // Find all packages with e2e-test folders
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
# The Plugins Folder
|
||||
|
||||
This is where your own plugins and their associated modules live, each in a
|
||||
separate folder of its own.
|
||||
|
||||
If you want to create a new plugin here, go to your project root directory, run
|
||||
the command `yarn new`, and follow the on-screen instructions.
|
||||
|
||||
You can also check out existing plugins on [the plugin marketplace](https://backstage.io/plugins)!
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "@backstage/cli/config/tsconfig.json",
|
||||
"include": [
|
||||
"packages/*/src",
|
||||
"packages/*/config.d.ts",
|
||||
"plugins/*/src",
|
||||
"plugins/*/config.d.ts",
|
||||
"plugins/*/dev",
|
||||
"plugins/*/migrations"
|
||||
],
|
||||
"exclude": ["node_modules"],
|
||||
"compilerOptions": {
|
||||
"outDir": "dist-types",
|
||||
"rootDir": ".",
|
||||
"jsx": "react-jsx"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# This file is generated by running "yarn install" inside your project.
|
||||
# Manual changes might be lost - proceed with caution!
|
||||
|
||||
__metadata:
|
||||
version: 8
|
||||
cacheKey: 10
|
||||
|
||||
"root-workspace-0b6124@workspace:.":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "root-workspace-0b6124@workspace:."
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||