Initial Backstage setup

This commit is contained in:
2025-12-08 16:36:15 +00:00
commit e866064be5
54 changed files with 35530 additions and 0 deletions

View File

@@ -0,0 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);

View File

@@ -0,0 +1,22 @@
FROM node:18-bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 g++ build-essential && \
rm -rf /var/lib/apt/lists/*
USER node
WORKDIR /app
ENV NODE_ENV=production
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
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"]

View File

@@ -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)

View File

@@ -0,0 +1,57 @@
{
"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": "^0.13.1",
"@backstage/config": "^1.3.6",
"@backstage/plugin-app-backend": "^0.5.8",
"@backstage/plugin-auth-backend": "^0.25.6",
"@backstage/plugin-auth-backend-module-github-provider": "^0.3.9",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.14",
"@backstage/plugin-auth-node": "^0.6.9",
"@backstage/plugin-catalog-backend": "^3.2.0",
"@backstage/plugin-catalog-backend-module-logs": "^0.1.16",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.14",
"@backstage/plugin-kubernetes-backend": "^0.20.4",
"@backstage/plugin-notifications-backend": "^0.6.0",
"@backstage/plugin-permission-backend": "^0.7.6",
"@backstage/plugin-permission-backend-module-allow-all-policy": "^0.2.14",
"@backstage/plugin-permission-common": "^0.9.3",
"@backstage/plugin-permission-node": "^0.10.6",
"@backstage/plugin-proxy-backend": "^0.6.8",
"@backstage/plugin-scaffolder-backend": "^3.0.1",
"@backstage/plugin-scaffolder-backend-module-github": "^0.9.2",
"@backstage/plugin-scaffolder-backend-module-notifications": "^0.1.16",
"@backstage/plugin-search-backend": "^2.0.8",
"@backstage/plugin-search-backend-module-catalog": "^0.3.10",
"@backstage/plugin-search-backend-module-pg": "^0.5.50",
"@backstage/plugin-search-backend-module-techdocs": "^0.4.8",
"@backstage/plugin-search-backend-node": "^1.3.17",
"@backstage/plugin-signals-backend": "^0.3.10",
"@backstage/plugin-techdocs-backend": "^2.1.2",
"app": "link:../app",
"better-sqlite3": "^12.0.0",
"node-gyp": "^10.0.0",
"pg": "^8.11.3"
},
"devDependencies": {
"@backstage/cli": "^0.34.5"
},
"files": [
"dist"
]
}

View File

@@ -0,0 +1,66 @@
/*
* 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'));
// scaffolder plugin
backend.add(import('@backstage/plugin-scaffolder-backend'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-github'));
backend.add(
import('@backstage/plugin-scaffolder-backend-module-notifications'),
);
// techdocs plugin
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 plugin
backend.add(import('@backstage/plugin-kubernetes-backend'));
// notifications and signals plugins
backend.add(import('@backstage/plugin-notifications-backend'));
backend.add(import('@backstage/plugin-signals-backend'));
backend.start();