Files
backstage/packages/backend
blam d50ddbd1d3 Merge branch 'master' of github.com:backstage/backstage into mob/scaffolder-frontend
* 'master' of github.com:backstage/backstage: (118 commits)
  cli: Fix handling of dynamic imports in esm.js files
  minor typo in migration
  chore(deps): bump archiver from 5.1.0 to 5.2.0
  dockerfile: mention build-image command
  Apply suggestions from code review
  update backend Dockerfile to use config example and fix comment
  docs: add full docker deployment docs
  chore: fix code review
  chore: fixing syntax
  docs: fixing custom implementations of utitiy apis
  a small start to the integrations section of the config
  TechDocs: Add changeset about Docker permission fix
  Updated unit tests for the new UI
  TechDocs: Pass user and group ID when invoking docker container
  Replace logging erro and return undefined for a throw new Error
  @types/react 16 not 17
  Use a more strict type for `variant` of cards
  docs(TechDocs): Add more context with AWS docs hyperlinks
  Added missing dep on @types/react
  Removed unused import
  ...
2021-02-18 11:41:34 +01:00
..
2021-02-11 10:15:47 +00:00
2020-11-03 11:03:49 +01:00

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

yarn install
yarn tsc
yarn build

You should only need to do this once.

After that, go to the packages/backend directory and run

AUTH_GOOGLE_CLIENT_ID=x AUTH_GOOGLE_CLIENT_SECRET=x \
AUTH_GITHUB_CLIENT_ID=x AUTH_GITHUB_CLIENT_SECRET=x \
AUTH_OAUTH2_CLIENT_ID=x AUTH_OAUTH2_CLIENT_SECRET=x \
AUTH_OAUTH2_AUTH_URL=x AUTH_OAUTH2_TOKEN_URL=x \
ROLLBAR_ACCOUNT_TOKEN=x \
SENTRY_TOKEN=x \
LOG_LEVEL=debug \
yarn start

Substitute x for actual values, or leave them as dummy values just to try out the backend without using the auth or sentry features. You can also, instead of using dummy values for a huge number of environment variables, remove those config directly from app-config.yaml file located in the root folder.

The backend starts up on port 7000 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.

For convenience we already include some statically configured example locations in app-config.yaml under catalog.locations. For local development you can override these in your own app-config.local.yaml.

Authentication

We chose Passport as authentication platform due to its comprehensive set of supported authentication strategies.

Read more about the auth-backend and how to add a new provider

Documentation