Skip to content

Commit 2ae0162

Browse files
Gerry-Fordehmanwani-rhnickboldtthemr0cJessicaJHee
authored
RHIDP-4802 - Dynamic plugin: Document how users can add middleware functions to proxy backend (#766)
* RHIDP-4802 - Dynamic plugin: Document how users can add middleware functions to proxy backend * RHIDP-4566: document how to manage PVCs in RHDH operator (#702) * RHIDP-4566: document how to manage PVCs in RHDH operator * Incorporated review suggestions * Incorporate QE suggestion * chore: dynamic plugins are all now expressed as wrappers (RHIDP-5103) (#753) * chore: dynamic plugins are all now expressed as wrappers so we don't need to parse janus-plugins repo anymore Signed-off-by: Nick Boldt <[email protected]> * comment out the TP stuff and mark it with RHIDP-5103 so we can re-enable it if needed in future Signed-off-by: Nick Boldt <[email protected]> * regen content from showcase main branch Signed-off-by: Nick Boldt <[email protected]> * re-add missing community plugins Signed-off-by: Nick Boldt <[email protected]> * re-add missing community plugins (regen content) Signed-off-by: Nick Boldt <[email protected]> --------- Signed-off-by: Nick Boldt <[email protected]> Co-authored-by: Fabrice Flore-Thébault <[email protected]> * RHIDP-4409: update metric monitoring instructions for OCP and AKS (#757) * update metric monitoring instructions for OCP and AKS Signed-off-by: Jessica He <[email protected]> * modularized the content --------- Signed-off-by: Jessica He <[email protected]> Co-authored-by: Fabrice Flore-Thébault <[email protected]> Co-authored-by: Heena Manwani <[email protected]> * added missing article (#741) * chore: fix known issues search string (#774) Signed-off-by: Fabrice Flore-Thébault <[email protected]> * RHIDP-4805: RHBK v24 support for RHDH 1.4 (#767) * RHBK v24 support for RHDH 1.4 * Added note * review suggestions incorporated * RHIDP-4572: Updating /metrics port (#735) Co-authored-by: Fabrice Flore-Thébault <[email protected]> * chore(installation): remove non-OLM installation doc; add link to OLM quickstart (RHIDP-2707) (RHIDP-3497) (#700) * chore(installation): remove doc about non-OLM instlalation method; add extra link to OLM quickstart at https://olm.operatorframework.io/docs/getting-started/ (RHIDP-2707) (RHIDP-3497) Signed-off-by: Nick Boldt <[email protected]> * Update modules/installation/proc-rhdh-deploy-eks-operator.adoc Co-authored-by: Heena Manwani <[email protected]> --------- Signed-off-by: Nick Boldt <[email protected]> Co-authored-by: Heena Manwani <[email protected]> Co-authored-by: Fabrice Flore-Thébault <[email protected]> * Add supported keycloak version * Remove Audit log file rotation in RHDH * RHIDP-4802 - Dynamic plugin: Document how users can add middleware functions to proxy backend * RHIDP-4802 - Dynamic plugin: Document how users can add middleware functions to proxy backend --------- Signed-off-by: Nick Boldt <[email protected]> Signed-off-by: Jessica He <[email protected]> Signed-off-by: Fabrice Flore-Thébault <[email protected]> Co-authored-by: Heena Manwani <[email protected]> Co-authored-by: Nick Boldt <[email protected]> Co-authored-by: Fabrice Flore-Thébault <[email protected]> Co-authored-by: Jessica He <[email protected]> Co-authored-by: Heena Manwani <[email protected]> Co-authored-by: Priyanka Abel <[email protected]> Co-authored-by: jmagak <[email protected]>
1 parent b2d2ba3 commit 2ae0162

File tree

2 files changed

+103
-3
lines changed

2 files changed

+103
-3
lines changed

assemblies/dynamic-plugins/assembly-configuring-rhdh-plugins.adoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ include::../../artifacts/rhdh-plugins-reference/tekton/tekton-plugin-admin.adoc[
2121
include::../modules/dynamic-plugins/proc-topology-install.adoc[leveloffset=+2]
2222
include::../modules/dynamic-plugins/proc-topology-configure.adoc[leveloffset=+2]
2323

24-
2524
include::../assembly-bulk-importing-from-github.adoc[leveloffset=+1]
2625

27-
2826
include::../assembly-using-servicenow.adoc[leveloffset=+1]
2927

30-
28+
// Overriding Core Backend Service Configuration
29+
include::../modules/dynamic-plugins/con-overriding-core-backend-services.adoc[leveloffset=+1]
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
[id="overriding-core-backend-services_{context}"]
2+
= Overriding Core Backend Service Configuration
3+
4+
The {product} ({product-very-short}) backend platform consists of a number of core services that are well encapsulated. The {product-very-short} backend installs these default core services statically during initialization.
5+
6+
You can configure these core services by customizing the backend source code and rebuilding your {product-short} application. Alternatively, you can customize a core service by installing it as a `BackendFeature` by using dynamic plugin functionality.
7+
8+
To use the dynamic plugin functionality to customize a core service in your RHDH application, you must configure the backend to avoid statically installing a given default core service.
9+
10+
For example, adding a middleware function to handle all incoming requests can be done by installing a custom `configure` function for the root `HTTP` router backend service which allows access to the underlying Express application.
11+
12+
.Example of a `BackendFeature` middleware function to handle incoming `HTTP` requests
13+
14+
[source,javascript]
15+
----
16+
// Create the BackendFeature
17+
export const customRootHttpServerFactory: BackendFeature =
18+
rootHttpRouterServiceFactory({
19+
configure: ({ app, routes, middleware, logger }) => {
20+
logger.info(
21+
'Using custom root HttpRouterServiceFactory configure function',
22+
);
23+
app.use(middleware.helmet());
24+
app.use(middleware.cors());
25+
app.use(middleware.compression());
26+
app.use(middleware.logging());
27+
// Add a the custom middleware function before all
28+
// of the route handlers
29+
app.use(addTestHeaderMiddleware({ logger }));
30+
app.use(routes);
31+
app.use(middleware.notFound());
32+
app.use(middleware.error());
33+
},
34+
});
35+
36+
// Export the BackendFeature as the default entrypoint
37+
export default customRootHttpServerFactory;
38+
----
39+
40+
In the above example, as the `BackendFeature` overrides the default implementation of the HTTP router service, you must set the `ENABLE_CORE_ROOTHTTPROUTER_OVERRIDE` environment variable to `true` so that the {product-short} does not install the default implementation automatically.
41+
42+
== Overriding environment variables
43+
To allow a dynamic plugin to load a core service override, you must start the {product-short} backend with the corresponding core service ID environment variable set to `true`.
44+
45+
.Environment variables and core service IDs
46+
[cols="50%,50%", frame="all", options="header"]
47+
|===
48+
|Variable
49+
|Description
50+
51+
|`ENABLE_CORE_AUTH_OVERRIDE`
52+
|Override the `core.auth` service
53+
54+
| `ENABLE_CORE_CACHE_OVERRIDE`
55+
| Override the `core.cache` service
56+
57+
| `ENABLE_CORE_ROOTCONFIG_OVERRIDE`
58+
| Override the `core.rootConfig` service
59+
60+
| `ENABLE_CORE_DATABASE_OVERRIDE`
61+
| Override the `core.database` service
62+
63+
| `ENABLE_CORE_DISCOVERY_OVERRIDE`
64+
| Override the `core.discovery` service
65+
66+
| `ENABLE_CORE_HTTPAUTH_OVERRIDE`
67+
| Override the `core.httpAuth` service
68+
69+
| `ENABLE_CORE_HTTPROUTER_OVERRIDE`
70+
| Override the `core.httpRouter` service
71+
72+
| `ENABLE_CORE_LIFECYCLE_OVERRIDE`
73+
| Override the `core.lifecycle` service
74+
75+
| `ENABLE_CORE_LOGGER_OVERRIDE`
76+
| Override the `core.logger` service
77+
78+
| `ENABLE_CORE_PERMISSIONS_OVERRIDE`
79+
| Override the `core.permissions` service
80+
81+
| `ENABLE_CORE_ROOTHEALTH_OVERRIDE`
82+
| Override the `core.rootHealth` service
83+
84+
| `ENABLE_CORE_ROOTHTTPROUTER_OVERRIDE`
85+
| Override the `core.rootHttpRouter` service
86+
87+
| `ENABLE_CORE_ROOTLIFECYCLE_OVERRIDE`
88+
| Override the `core.rootLifecycle` service
89+
90+
| `ENABLE_CORE_SCHEDULER_OVERRIDE`
91+
| Override the `core.scheduler` service
92+
93+
| `ENABLE_CORE_USERINFO_OVERRIDE`
94+
| Override the `core.userInfo` service
95+
96+
| `ENABLE_CORE_URLREADER_OVERRIDE`
97+
| Override the `core.urlReader` service
98+
99+
| `ENABLE_EVENTS_SERVICE_OVERRIDE`
100+
| Override the `events.service` service
101+
|===

0 commit comments

Comments
 (0)