diff --git a/backend/README.md b/backend/README.md new file mode 100644 index 0000000..7eedeff --- /dev/null +++ b/backend/README.md @@ -0,0 +1,51 @@ +# Runtime Conditions backend plugin + +The backend half of the [Runtime Conditions Backstage plugin](https://github.com/runtimeconditions/backstage-plugin). + +A Runtime Conditions Profile lists what a workload needs at runtime, for example a database or a queue. Platform adapters set up those needs in each environment. This plugin gives the adapters one place to report what they set up: which resources fulfill which condition, in which environment. The frontend plugin, [@runtimeconditions/plugin-runtime-conditions](https://www.npmjs.com/package/@runtimeconditions/plugin-runtime-conditions), then shows those resources on the Component's **Runtime Conditions** tab. + +You only need this plugin if adapters will report fulfillments. The frontend plugin works without it and then shows no fulfillments. + +## Install + +```sh +yarn --cwd packages/backend add @runtimeconditions/plugin-runtime-conditions-backend +``` + +In `packages/backend/src/index.ts`: + +```ts +backend.add(import('@runtimeconditions/plugin-runtime-conditions-backend')); +``` + +## API + +The plugin adds two routes under `/api/runtime-conditions`: + +| Route | What it does | +| --- | --- | +| `POST /fulfillments` | An adapter reports the resources that fulfill one condition in one environment. A report is added and never replaces an earlier one. | +| `GET /fulfillments` | Lists the reports. Filter with `?profileName=` and `?condition=`. | + +A report looks like this: + +```json +{ + "profileName": "orders-api", + "condition": "orders-database", + "environment": "production", + "resources": [ + { "kind": "database", "provider": "aws-rds", "reference": "arn:aws:rds:us-east-1:123456789012:db:orders" } + ] +} +``` + +The full request and response shapes are in the [fulfillment API docs](https://github.com/runtimeconditions/backstage-plugin/blob/main/docs/fulfillment-api.md). Every [GitHub release](https://github.com/runtimeconditions/backstage-plugin/releases) also has the generated `openapi.yaml`. + +## Good to know + +Reports are kept in memory for now, so they are lost when the backend restarts. Adapters should report again after a restart. Storing them durably is tracked in [issue #26](https://github.com/runtimeconditions/backstage-plugin/issues/26). + +## License + +MIT diff --git a/backend/package.json b/backend/package.json index 2fb5b3f..fbf6d3c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,14 @@ { "name": "@runtimeconditions/plugin-runtime-conditions-backend", "version": "0.1.0", + "description": "Backstage backend plugin for Runtime Conditions. Platform adapters report here which resources fulfill a workload's conditions, and the frontend plugin shows them.", + "keywords": [ + "backstage", + "backstage-plugin", + "backstage-backend-plugin", + "runtime-conditions", + "platform-engineering" + ], "license": "MIT", "repository": { "type": "git", diff --git a/package.json b/package.json index c1201b5..b9e2d7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,13 @@ { "name": "@runtimeconditions/plugin-runtime-conditions", "version": "0.1.0", + "description": "Backstage plugin that shows a Component's Runtime Conditions Profiles: what the workload needs at runtime, in each cluster, and which resources fulfill each need.", + "keywords": [ + "backstage", + "backstage-plugin", + "runtime-conditions", + "platform-engineering" + ], "license": "MIT", "repository": { "type": "git",