update installation instructions in readme files for new backend system

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-09-04 11:15:41 +02:00
parent 906dfe9873
commit 5d1670f959
9 changed files with 79 additions and 232 deletions
+12
View File
@@ -0,0 +1,12 @@
---
'@backstage/plugin-scaffolder-backend-module-confluence-to-markdown': patch
'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch
'@backstage/plugin-scaffolder-backend-module-gitlab': patch
'@backstage/plugin-scaffolder-backend-module-sentry': patch
'@backstage/plugin-scaffolder-backend-module-yeoman': patch
'@backstage/plugin-scaffolder-backend-module-rails': patch
'@backstage/plugin-user-settings-backend': patch
'@backstage/plugin-devtools-backend': patch
---
Update README installation instructions
+24 -19
View File
@@ -4,7 +4,30 @@ Welcome to the DevTools backend plugin! This plugin provides data for the [DevTo
## Setup
Here's how to get the DevTools Backend up and running:
Here's how to get the DevTools Backend up and running in the new backend system:
1. First we need to add the `@backstage/plugin-devtools-backend` package to your backend:
```sh
# From the Backstage root directory
yarn --cwd packages/backend add @backstage/plugin-devtools-backend
```
2. Then add the plugin to your backend index file:
```ts
// In packages/backend/src/index.ts
const backend = createBackend();
// ... other feature additions
backend.add(import('@backstage/plugin-devtools-backend'));
```
3. Now run `yarn start-backend` from the repo root
4. Finally open `http://localhost:7007/api/devtools/health` in a browser and it should return `{"status":"ok"}`
## Old Backend System
If you are still on the old backend system, please consider migrating to the new backend system. But to install this plugin in an old backend, see below.
1. First we need to add the `@backstage/plugin-devtools-backend` package to your backend:
@@ -50,24 +73,6 @@ Here's how to get the DevTools Backend up and running:
4. Now run `yarn start-backend` from the repo root
5. Finally open `http://localhost:7007/api/devtools/health` in a browser and it should return `{"status":"ok"}`
### New Backend System
The DevTools backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up:
In your `packages/backend/src/index.ts` make the following changes:
```diff
import { createBackend } from '@backstage/backend-defaults';
const backend = createBackend();
// ... other feature additions
+ backend.add(import('@backstage/plugin-devtools-backend'));
backend.start();
```
## Links
- [Frontend part of the plugin](https://github.com/backstage/backstage/tree/master/plugins/devtools)
@@ -15,47 +15,16 @@ From your Backstage root directory run:
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-confluence-to-markdown
```
Then configure the action:
(you can check the [docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions) to see all options):
Then ensure that both the scaffolder and this module are added to your backend:
```typescript
// packages/backend/src/plugins/scaffolder.ts
import { createBuiltinActions } from '@backstage/plugin-scaffolder-backend';
import { ScmIntegrations } from '@backstage/integration';
import { createConfluenceToMarkdownAction } from '@backstage/plugin-scaffolder-backend-module-confluence-to-markdown';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const catalogClient = new CatalogClient({ discoveryApi: env.discovery });
const integrations = ScmIntegrations.fromConfig(env.config);
const builtInActions = createBuiltinActions({
integrations,
catalogClient,
config: env.config,
reader: env.reader,
});
const actions = [
...builtInActions,
createConfluenceToMarkdownAction({
integrations,
config: env.config,
reader: env.reader,
}),
];
return createRouter({
actions,
catalogClient: catalogClient,
logger: env.logger,
config: env.config,
database: env.database,
reader: env.reader,
});
}
// In packages/backend/src/index.ts
const backend = createBackend();
// ...
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
backend.add(
import('@backstage/plugin-scaffolder-backend-module-confluence-to-markdown'),
);
```
### Configuration
@@ -13,31 +13,14 @@ You need to configure the action in your backend:
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-cookiecutter
```
Configure the action:
(you can check the [docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions) to see all options):
Then ensure that both the scaffolder and this module are added to your backend:
```typescript
// packages/backend/src/plugins/scaffolder.ts
const actions = [
createFetchCookiecutterAction({
integrations,
reader: env.reader,
}),
...createBuiltInActions({
...
})
];
return await createRouter({
containerRunner,
catalogClient,
actions,
logger: env.logger,
config: env.config,
database: env.database,
reader: env.reader,
});
// In packages/backend/src/index.ts
const backend = createBackend();
// ...
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-cookiecutter'));
```
After that you can use the action in your template:
@@ -13,50 +13,17 @@ Here you can find all Gitlab related features to improve your scaffolder:
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-gitlab
```
Configure the action:
(you can check the [docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions) to see all options):
Then ensure that both the scaffolder and this module are added to your backend:
```typescript
// packages/backend/src/plugins/scaffolder.ts
import {
createGitlabProjectAccessTokenAction,
createGitlabProjectDeployTokenAction,
createGitlabProjectVariableAction,
createGitlabGroupEnsureExistsAction,
createGitlabIssueAction,
} from '@backstage/plugin-scaffolder-backend-module-gitlab';
// Create BuiltIn Actions
const builtInActions = createBuiltinActions({
integrations,
catalogClient,
config: env.config,
reader: env.reader,
});
// Add Gitlab Actions
const actions = [
...builtInActions,
createGitlabProjectAccessTokenAction({ integrations: integrations }),
createGitlabProjectDeployTokenAction({ integrations: integrations }),
createGitlabProjectVariableAction({ integrations: integrations }),
createGitlabGroupEnsureExistsAction({ integrations: integrations }),
createGitlabIssueAction({ integrations: integrations }),
];
// Create Scaffolder Router
return await createRouter({
catalogClient,
actions,
logger: env.logger,
config: env.config,
database: env.database,
reader: env.reader,
});
// In packages/backend/src/index.ts
const backend = createBackend();
// ...
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-gitlab'));
```
After that you can use the action in your template:
After that you can use the actions in your template:
```yaml
apiVersion: scaffolder.backstage.io/v1beta3
@@ -18,26 +18,14 @@ You need to configure the action in your backend:
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-rails
```
Configure the action (you can check
the [docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions) to
see all options):
Then ensure that both the scaffolder and this module are added to your backend:
```typescript
const actions = [
createFetchRailsAction({
integrations,
reader: env.reader,
}),
];
return await createRouter({
catalogClient,
actions,
logger: env.logger,
config: env.config,
database: env.database,
reader: env.reader,
});
// In packages/backend/src/index.ts
const backend = createBackend();
// ...
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-rails'));
```
After that you can use the action in your template:
@@ -244,16 +232,3 @@ steps:
system: ${{ parameters.system }}
railsArguments: ${{ parameters.railsArguments }}
```
You also need to configure the list of allowed images as part of the creating the action for the scaffolder backend:
```typescript
const actions = [
createFetchRailsAction({
integrations,
reader: env.reader,
containerRunner,
allowedImageNames: ['repository/rails:tag'],
}),
];
```
@@ -15,28 +15,14 @@ You need to configure the action in your backend:
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-sentry
```
Configure the action (you can check
the [docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions) to
see all options):
Then ensure that both the scaffolder and this module are added to your backend:
```typescript
const actions = [
createSentryCreateProjectAction({
integrations,
reader: env.reader,
containerRunner,
}),
];
return await createRouter({
containerRunner,
catalogClient,
actions,
logger: env.logger,
config: env.config,
database: env.database,
reader: env.reader,
});
// In packages/backend/src/index.ts
const backend = createBackend();
// ...
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-sentry'));
```
You need to define your Sentry API Token in your `app-config.yaml`:
@@ -13,32 +13,14 @@ You need to configure the action in your backend:
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-yeoman
```
Configure the action:
(you can check the [docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions) to see all options):
Then ensure that both the scaffolder and this module are added to your backend:
```typescript
// packages/backend/src/plugins/scaffolder.ts
const actions = [
createRunYeomanAction(),
...createBuiltInActions({
containerRunner,
catalogClient,
integrations,
config: env.config,
reader: env.reader,
}),
];
return await createRouter({
containerRunner,
catalogClient,
actions,
logger: env.logger,
config: env.config,
database: env.database,
reader: env.reader,
});
// In packages/backend/src/index.ts
const backend = createBackend();
// ...
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-yeoman'));
```
After that you can use the action in your template:
+4 -36
View File
@@ -10,48 +10,16 @@ Install the backend plugin
```bash
# From your Backstage root directory
yarn --cwd packages/backend add @backstage/plugin-user-settings-backend
yarn --cwd packages/backend add @backstage/plugin-user-settings-backend @backstage/plugin-signals-backend
```
### New backend
Add the plugin to your backend in `packages/backend/src/index.ts`:
```ts
backend.add(import('@backstage/plugin-user-settings-backend/alpha'));
```
To get real-time updates of the user settings across different user sessions, you must also install
the `@backstage/plugin-signals-backend` plugin.
### Old backend
1. Configure the routes by adding a new `userSettings.ts` file in
`packages/backend/src/plugins/`:
```ts
// packages/backend/src/plugins/userSettings.ts
import { createRouter } from '@backstage/plugin-user-settings-backend';
import { PluginEnvironment } from '../types';
export default async function createPlugin(env: PluginEnvironment) {
return await createRouter({
database: env.database,
identity: env.identity,
});
}
```
2. Add the new routes to your backend by modifying `packages/backend/src/index.ts`:
```diff
// packages/backend/src/index.ts
+import userSettings from './plugins/userSettings';
async function main() {
+ const userSettingsEnv = useHotMemoize(module, () => createEnv('user-settings'));
const apiRouter = Router();
+ apiRouter.use('/user-settings', await userSettings(userSettingsEnv));
}
// The signals backend is technically optional but enables real-time update of user
// settings across different sessions
backend.add(import('@backstage/plugin-signals-backend'));
```
## Setup app