diff --git a/.changeset/migrate-1713531195788.md b/.changeset/migrate-1713531195788.md new file mode 100644 index 0000000000..dc2617ded9 --- /dev/null +++ b/.changeset/migrate-1713531195788.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-nomad': patch +'@backstage/plugin-nomad-backend': patch +--- + +These packages have been migrated to the [backstage/community-plugins](https://github.com/backstage/community-plugins) repository. diff --git a/plugins/nomad-backend/README.md b/plugins/nomad-backend/README.md index 9f530bd943..b51608591a 100644 --- a/plugins/nomad-backend/README.md +++ b/plugins/nomad-backend/README.md @@ -1,64 +1,3 @@ -# @backstage/plugin-nomad-backend +# Deprecated -A backend for [Nomad](https://www.nomadproject.io/), this plugin exposes a service with routes that are used by the `@backstage/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: - -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-nomad-backend')); - backend.start(); -``` - -## Set Up - -1. Install the plugin using: - -```bash -# From your Backstage root directory -yarn --cwd packages/backend add @backstage/plugin-nomad-backend -``` - -2. Create a `nomad.ts` file inside `packages/backend/src/plugins/`: - -```typescript -import { createRouter } from '@backstage/plugin-nomad-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - props: PluginEnvironment, -): Promise { - 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/plugin-nomad` must be implemented. +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-nomad-backend` instead. diff --git a/plugins/nomad-backend/package.json b/plugins/nomad-backend/package.json index 5324065f91..833fd51909 100644 --- a/plugins/nomad-backend/package.json +++ b/plugins/nomad-backend/package.json @@ -2,7 +2,8 @@ "name": "@backstage/plugin-nomad-backend", "version": "0.1.19", "backstage": { - "role": "backend-plugin" + "role": "backend-plugin", + "moved": "@backstage-community/plugin-nomad-backend" }, "publishConfig": { "access": "public", @@ -45,5 +46,6 @@ "@backstage/cli": "workspace:^", "@types/supertest": "^2.0.8", "supertest": "^6.2.4" - } + }, + "deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-nomad-backend instead." } diff --git a/plugins/nomad/README.md b/plugins/nomad/README.md index 443669b71a..a5ec802195 100644 --- a/plugins/nomad/README.md +++ b/plugins/nomad/README.md @@ -1,167 +1,3 @@ -# @backstage/plugin-nomad +# Deprecated -This is a frontend plugin is for viewing [Nomad](https://www.nomadproject.io/) [job versions](https://developer.hashicorp.com/nomad/docs/concepts/architecture#job) and [task group allocations](https://developer.hashicorp.com/nomad/docs/concepts/architecture#allocation). - -This plugin has a corresponding backend plugin required to call the Nomad cluster's API: ` @backstage/plugin-nomad-backend`. - -## Introduction - -### [Nomad](https://www.nomadproject.io/) - -> A simple and flexible scheduler and orchestrator to deploy and manage containers and non-containerized applications across on-prem and clouds at scale. - -### Features - -This plugin provides two components: - -- a table to view recent [job versions](https://developer.hashicorp.com/nomad/docs/commands/job/history) -- a table to view [allocations for a job and/or group](https://developer.hashicorp.com/nomad/tutorials/manage-jobs/jobs-inspect) - -## Getting Started - -### Requirements - -You will need to have the backend Nomad plugin, `@backstage/plugin-nomad-backend`, installed and running. See its README for set up instructions. - -You will need a running Nomad cluster with an API address that is reachable from the `@backstage/plugin-nomad/backend` plugin [running in the back end](https://backstage.io/docs/overview/architecture-overview/#third-party-backed-plugins). You can follow [this tutorial](https://developer.hashicorp.com/nomad/tutorials/enterprise/production-deployment-guide-vm-with-consul) to learn how to deploy one. - -If your Nomad cluster has ACLs enabled, you will need a `token` with at least the [`list-jobs`capability](https://developer.hashicorp.com/nomad/tutorials/access-control/access-control-policies#namespace-rules). You can check [this tutorial](https://developer.hashicorp.com/nomad/tutorials/access-control/access-control-create-policy) for more info or the minimal [example below](#example-policy). - -### Installation - -```bash -# From your Backstage root directory -yarn --cwd packages/app add @backstage/plugin-nomad -``` - -### Configuration - -Add configuration to your [`app-config.yaml`](https://github.com/backstage/backstage/blob/master/app-config.yaml). For example: - -```yaml -nomad: - addr: 'http://localhost:4646' - token: '93e034ad-e504-42f9-129d-5d81be9f13d3' -``` - -The `token` can be excluded if [ACLs are not enabled](https://developer.hashicorp.com/nomad/api-docs#authentication). - -### Annotate Components - -Several annotations are available for Components that make use of this plugin: - -```yaml -apiVersion: backstage.io/v1alpha1 -kind: Component -metadata: - annotations: - nomad.io/namespace: default - nomad.io/job-id: redis - nomad.io/group: 'redis|prometheus-collector' -``` - -- `nomad.io/job-id` annotation's value is matched exactly and corresponds to `JobID` in the Nomad API. It is required for the Job Versions Card but optional for the Allocations Table -- `nomad.io/group` annotation's value is used as a regex pattern against `TaskGroup` using [Nomad's server-side filtering](https://developer.hashicorp.com/nomad/api-docs#filtering). It is optional for the [Allocations Table](#allocations-table) -- `nomad.io/namespace` is the Namespace of the Job and Allocations of the Component. If omitted, it defaults to `default` - -### Job Versions Card - -The snippet below adds a card to the overview tab on the EntityPage. It shows versions of a Nomad job associated with a Component in the Catalog. - -```typescript -// In packages/app/src/components/catalog/EntityPage.tsx - -import { EntityNomadJobVersionListCard, isNomadJobIDAvailable } from '@backstage/plugin-nomad'; - -const overviewContent = ( - ... - - - - - - - -); -``` - -
- -
- -#### Requirements - -- the `nomad.io/job-id` annotation must be set - -### Allocations Table - -The snippet below adds a `/nomad` tab to the EntityPage that displays all allocations associated the `nomad.io/job-id` and/or `nomad.io/group` of Component's annotations. - -```typescript -// In packages/app/src/components/catalog/EntityPage.tsx - -import { EntityNomadAllocationListTable, isNomadAllocationsAvailable } from '@backstage/plugin-nomad'; - -const serviceEntityPage = ( - ... - - - -) -``` - -
- -
- -#### Requirements - -- `nomad.io/job-id` and/or `nomad.io/group` annotations must be set - -## ACL Policy Example - -Because this plugin uses API endpoints that require the `list-jobs` capability, the token you provide to the plugin's [`nomad` configuration](#configuration) needs at least that. - -To create such a token you can create a policy like below. This policy applies to all namespaces: - -```hcl -# backstage.policy.hcl -namespace "*" { - policy = "read" -} - -node { - policy = "read" -} -``` - -And create a policy for it: - -```bash -nomad acl policy apply backstage backstage.policy.hcl -``` - -Then create a client token for it: - -```bash -nomad acl token create -name=backstage -policy=backstage -Accessor ID = 5e9fe97b-76c5-8803-21b8-083308dc6c11 -Secret ID = 93e034ad-e504-42f9-129d-5d81be9f13d3 -Name = backstage -Type = client -Global = false -Create Time = 2023-06-05 00:45:20.51905 +0000 UTC -Expiry Time = -Create Index = 54 -Modify Index = 54 -Policies = [backstage] - -Roles - -``` - -In the example above, the `Secret ID` is the `token` to use in the [configuration](#configuration). +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-nomad` instead. diff --git a/plugins/nomad/package.json b/plugins/nomad/package.json index 9ac59ef5ba..74af9b96ec 100644 --- a/plugins/nomad/package.json +++ b/plugins/nomad/package.json @@ -2,7 +2,8 @@ "name": "@backstage/plugin-nomad", "version": "0.1.15", "backstage": { - "role": "frontend-plugin" + "role": "frontend-plugin", + "moved": "@backstage-community/plugin-nomad" }, "publishConfig": { "access": "public", @@ -78,5 +79,6 @@ ] } } - } + }, + "deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-nomad instead." }