From 473b06232996f9285eb5490ba9bb21af0ea83af7 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Fri, 21 Mar 2025 11:39:20 +0100 Subject: [PATCH] gateway: tweak readme Signed-off-by: Vincenzo Scamporlino --- plugins/gateway-backend/README.md | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins/gateway-backend/README.md diff --git a/plugins/gateway-backend/README.md b/plugins/gateway-backend/README.md new file mode 100644 index 0000000000..a8b55b36c7 --- /dev/null +++ b/plugins/gateway-backend/README.md @@ -0,0 +1,34 @@ +# gateway + +Welcome to the gateway backend plugin! + +This plugin is useful for adopters who have [split the backend plugins into multiple different Backstage deployments](https://backstage.io/docs/backend-system/building-backends/index#split-into-multiple-backends) and implemented their own Discovery service to resolve the urls of the backend plugins. + +A custom discovery service helps you routing the requests from a backend plugin to another backend plugin, but it doesn't help you routing the requests from the frontend to a backend plugin, unless you hardcode the urls in the frontend or expose the different backend plugins via a custom reverse proxy. + +You can deploy this plugin in a "gateway" Backstage deployment to route requests from the frontend to the correct backend plugin. The plugin leverages the Discovery service to resolve the urls of the other backend plugins. If a plugin is already installed in the "gateway" Backstage deployment, the plugin the local plugin will be used. + +## Installation + +This plugin is installed via the `@backstage/plugin-gateway-backend` package. To install it to your backend package, run the following command: + +```bash +# From your root directory +yarn --cwd packages/backend add @backstage/plugin-gateway-backend +``` + +Then add the plugin to your backend in `packages/backend/src/index.ts`: + +```ts +const backend = createBackend(); +// ... +backend.add(import('@backstage/plugin-gateway-backend')); +``` + +Make sure to configure the `baseUrl` in the `app-config.yaml` file to point to the "gateway" Backstage deployment. + +```yaml +backend: + # the baseUrl of the "gateway" Backstage deployment + baseUrl: http://gateway-backstage-backend.example.com +```