|
1 | | -# example-backend |
| 1 | +# x2a backend |
2 | 2 |
|
3 | | -This package is an EXAMPLE of a Backstage backend. |
| 3 | +Backstage backend for local development of the **x2a** workspace. |
4 | 4 |
|
5 | | -The main purpose of this package is to provide a test bed for Backstage plugins |
6 | | -that have a backend part. Feel free to experiment locally or within your fork by |
7 | | -adding dependencies and routes to this backend, to try things out. |
| 5 | +This package wires together the x2a plugins and the standard Backstage |
| 6 | +infrastructure so you can run a fully functional backend on your machine. |
8 | 7 |
|
9 | | -Our goal is to eventually amend the create-app flow of the CLI, such that a |
10 | | -production ready version of a backend skeleton is made alongside the frontend |
11 | | -app. Until then, feel free to experiment here! |
| 8 | +## x2a service factories |
12 | 9 |
|
13 | | -## Development |
| 10 | +The x2a plugins share service refs defined in |
| 11 | +`@red-hat-developer-hub/backstage-plugin-x2a-node` (the `x2a-node` |
| 12 | +node-library). Those refs carry **no `defaultFactory`**. |
14 | 13 |
|
15 | | -To run the example backend, first go to the project root and run |
| 14 | +The `x2a-backend` default export is a `createBackendFeatureLoader` that yields |
| 15 | +both the plugin and the matching service factories (`x2aDatabaseServiceFactory`, |
| 16 | +`kubeServiceFactory`). This means a single `backend.add(...)` call registers |
| 17 | +everything: |
16 | 18 |
|
17 | | -```bash |
18 | | -yarn install |
| 19 | +```ts |
| 20 | +backend.add(import('@red-hat-developer-hub/backstage-plugin-x2a-backend')); |
19 | 21 | ``` |
20 | 22 |
|
21 | | -You should only need to do this once. |
| 23 | +This design works in both local development and in RHDH dynamic plugin mode, |
| 24 | +because RHDH's dynamic plugin loader only reads the default export of each |
| 25 | +plugin package. |
22 | 26 |
|
23 | | -After that, go to the `packages/backend` directory and run |
| 27 | +## Development |
| 28 | + |
| 29 | +From the workspace root: |
24 | 30 |
|
25 | 31 | ```bash |
| 32 | +yarn install |
26 | 33 | yarn start |
27 | 34 | ``` |
28 | 35 |
|
29 | | -If you want to override any configuration locally, for example adding any secrets, |
30 | | -you can do so in `app-config.local.yaml`. |
31 | | - |
32 | | -The backend starts up on port 7007 per default. |
33 | | - |
34 | | -## Populating The Catalog |
35 | | - |
36 | | -If you want to use the catalog functionality, you need to add so called |
37 | | -locations to the backend. These are places where the backend can find some |
38 | | -entity descriptor data to consume and serve. For more information, see |
39 | | -[Software Catalog Overview - Adding Components to the Catalog](https://backstage.io/docs/features/software-catalog/#adding-components-to-the-catalog). |
40 | | - |
41 | | -To get started quickly, this template already includes some statically configured example locations |
42 | | -in `app-config.yaml` under `catalog.locations`. You can remove and replace these locations as you |
43 | | -like, and also override them for local development in `app-config.local.yaml`. |
44 | | - |
45 | | -## Authentication |
| 36 | +Override secrets or local configuration in `app-config.local.yaml`. |
| 37 | +The backend starts on port **7007** by default. |
46 | 38 |
|
47 | | -We chose [Passport](http://www.passportjs.org/) as authentication platform due |
48 | | -to its comprehensive set of supported authentication |
49 | | -[strategies](http://www.passportjs.org/packages/). |
| 39 | +## Populating the catalog |
50 | 40 |
|
51 | | -Read more about the |
52 | | -[auth-backend](https://github.com/backstage/backstage/blob/master/plugins/auth-backend/README.md) |
53 | | -and |
54 | | -[how to add a new provider](https://github.com/backstage/backstage/blob/master/docs/auth/add-auth-provider.md) |
| 41 | +Add location entries under `catalog.locations` in `app-config.yaml`. |
| 42 | +See [Adding Components to the Catalog](https://backstage.io/docs/features/software-catalog/#adding-components-to-the-catalog) |
| 43 | +for details. |
55 | 44 |
|
56 | 45 | ## Documentation |
57 | 46 |
|
58 | | -- [Backstage Readme](https://github.com/backstage/backstage/blob/master/README.md) |
59 | 47 | - [Backstage Documentation](https://backstage.io/docs) |
0 commit comments