Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/nomad/.changeset/bright-ads-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage-community/plugin-nomad-backend': minor
---

Drops support for the old backend system.
3 changes: 2 additions & 1 deletion workspaces/nomad/bcp.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"autoVersionBump": true,
"knipReports": false
"knipReports": false,
"listDeprecations": true
}
49 changes: 1 addition & 48 deletions workspaces/nomad/plugins/nomad-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

A backend for [Nomad](https://www.nomadproject.io/), this plugin exposes a service with routes that are used by the `@backstage-community/plugin-nomad-backend` plugin to query Job and Group information from a Nomad API.

## New Backend System

The Nomad backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up:
## Setup

In your `packages/backend/src/index.ts` make the following changes:

Expand All @@ -16,49 +14,4 @@ In your `packages/backend/src/index.ts` make the following changes:
backend.start();
```

## Set Up

1. Install the plugin using:

```bash
# From your Backstage root directory
yarn --cwd packages/backend add @backstage-community/plugin-nomad-backend
```

2. Create a `nomad.ts` file inside `packages/backend/src/plugins/`:

```typescript
import { createRouter } from '@backstage-community/plugin-nomad-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

export default async function createPlugin(
props: PluginEnvironment,
): Promise<Router> {
return await createRouter(props);
}
```

3. Modify your `packages/backend/src/index.ts` to include:

```diff
...

import { Config } from '@backstage/config';
import app from './plugins/app';
+import nomad from './plugins/nomad';
...

async function main() {
...

const authEnv = useHotMemoize(module, () => createEnv('auth'));
+ const nomadEnv = useHotMemoize(module, () => createEnv('nomad'));
...

const apiRouter = Router();
apiRouter.use('/catalog', await catalog(catalogEnv));
+ apiRouter.use('/nomad', await nomad(nomadEnv));
```

Note: for this backend to work, the `nomad` configuration described in the README of `@backstage-community/plugin-nomad` must be implemented.
14 changes: 0 additions & 14 deletions workspaces/nomad/plugins/nomad-backend/report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,10 @@

```ts
import { BackendFeature } from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
import express from 'express';
import { LoggerService } from '@backstage/backend-plugin-api';

// @public @deprecated (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;

// @public
const nomadPlugin: BackendFeature;
export default nomadPlugin;

// @public @deprecated (undocumented)
export interface RouterOptions {
// (undocumented)
config: Config;
// (undocumented)
logger: LoggerService;
}

// (No @packageDocumentation comment for this package)
```
1 change: 0 additions & 1 deletion workspaces/nomad/plugins/nomad-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './service/router';
export { nomadPlugin as default } from './plugin';
3 changes: 0 additions & 3 deletions workspaces/nomad/plugins/nomad-backend/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ export const nomadPlugin = createBackendPlugin({
async init({ logger, config, httpRouter }) {
httpRouter.use(
await createRouter({
/**
* Logger for logging purposes
*/
logger,
config,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@ import Router from 'express-promise-router';
import { LoggerService } from '@backstage/backend-plugin-api';
import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';

/**
* @deprecated Please migrate to the new backend system as this will be removed in the future.
*
* @public */
export interface RouterOptions {
logger: LoggerService;
config: Config;
}

/**
* @deprecated Please migrate to the new backend system as this will be removed in the future.
*
* @public */
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
Expand Down