This documentation is for a release that is no longer maintained
See documentation for the latest supported version.Customizing
Customizing Red Hat Developer Hub
Abstract
Preface Copy linkLink copied to clipboard!
Learn to customize Red Hat Developer Hub, such as templates, learning paths, tech docs, tech radar, home page, quick access cards, and appearance.
Chapter 1. Customizing your Red Hat Developer Hub title Copy linkLink copied to clipboard!
You can change the default Red Hat Developer Hub display name.
Prerequisites
Procedure
In your custom
app-config.yaml
file, enter your Developer Hub instance display name, such as <Red Hat Developer Hub>.app-config.yaml
excerptapp: title: My custom Red Hat Developer Hub title
app: title: My custom Red Hat Developer Hub title
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 2. Customizing your Red Hat Developer Hub base URL Copy linkLink copied to clipboard!
You can change the default Red Hat Developer Hub base URL.
Prerequisites
- You know your desired Developer Hub external URL: https://<my_developer_hub_url>, and have configured DNS to point to your Red Hat OpenShift Container Platform cluster.
- Custom Developer Hub configuration.
Procedure
In your custom
app-config.yaml
file, enter your Developer Hub external URL, such as https://<my_developer_hub_url>.app-config.yaml
excerptCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 3. Customizing Red Hat Developer Hub backend secret Copy linkLink copied to clipboard!
The default Red Hat Developer Hub configuration defines the Developer Hub backend secret for service to service authentication.
You can define your custom Developer Hub backend secret.
Prerequisites
- You added a custom Developer Hub application configuration, and have sufficient permissions to modify it.
Procedure
To define the Developer Hub backend secret, add to your custom
<my_product_secrets>.txt
file theBACKEND_SECRET
environment variable with a base64 encoded string. Use a unique value for each Developer Hub instance.$ echo > <my_product_secrets>.txt "BACKEND_SECRET=$(node -p 'require("crypto").randomBytes(24).toString("base64")')"
$ echo > <my_product_secrets>.txt<my_product_secrets>.txt "BACKEND_SECRET=$(node -p 'require("crypto").randomBytes(24).toString("base64")')"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <my_product_secrets>.txt
exampleBACKEND_SECRET=3E2/rIPuZNFCtYHoxVP8wjriffnN1q/z
BACKEND_SECRET=3E2/rIPuZNFCtYHoxVP8wjriffnN1q/z
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add your backend secret to your custom
app-config.yaml
file.app-config.yaml
excerpt defining the backend secretCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 4. Configuring templates Copy linkLink copied to clipboard!
Configure templates to create software components, and publish these components to different locations, such as the Red Hat Developer Hub software catalog, or Git repositories.
A template is a form composed of different UI fields that is defined in a YAML file. Templates include actions, which are steps that are executed in sequential order and can be executed conditionally.
4.1. Creating a template by using the Template Editor Copy linkLink copied to clipboard!
You can create a template by using the Template Editor.
Procedure
Access the Template Editor by using one of the following options:
-
Open the URL
https://<rhdh_url>/create/edit
for your Red Hat Developer Hub instance. - Click Create… in the navigation menu of the Red Hat Developer Hub console, then click the overflow menu button and select Template editor.
-
Open the URL
- Click Edit Template Form.
- Optional: Modify the YAML definition for the parameters of your template. For more information about these parameters, see Section 4.2, “Creating a template as a YAML file”.
- In the Name * field, enter a unique name for your template.
- From the Owner drop-down menu, choose an owner for the template.
- Click Next.
In the Repository Location view, enter the following information about the hosted repository that you want to publish the template to:
Select an available Host from the drop-down menu.
NoteAvailable hosts are defined in the YAML parameters by the
allowedHosts
field:Example YAML
# ... ui:options: allowedHosts: - github.com # ...
# ... ui:options: allowedHosts: - github.com # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In the Owner * field, enter an organization, user or project that the hosted repository belongs to.
- In the Repository * field, enter the name of the hosted repository.
- Click Review.
- Review the information for accuracy, then click Create.
Verification
- Click the Catalog tab in the navigation panel.
- In the Kind drop-down menu, select Template.
- Confirm that your template is shown in the list of existing templates.
4.2. Creating a template as a YAML file Copy linkLink copied to clipboard!
You can create a template by defining a Template
object as a YAML file.
The Template
object describes the template and its metadata. It also contains required input variables and a list of actions that are executed by the scaffolding service.
Template
object example
- 1
- Specify a name for the template.
- 2
- Specify a title for the template. This is the title that is visible on the template tile in the Create… view.
- 3
- Specify a description for the template. This is the description that is visible on the template tile in the Create… view.
- 4
- Specify the ownership of the template. The
owner
field provides information about who is responsible for maintaining or overseeing the template within the system or organization. In the provided example, theowner
field is set tobackstage/techdocs-core
. This means that this template belongs to thetechdocs-core
project in thebackstage
namespace. - 5
- Specify the component type. Any string value is accepted for this required field, but your organization should establish a proper taxonomy for these. Red Hat Developer Hub instances may read this field and behave differently depending on its value. For example, a
website
type component may present tooling in the Red Hat Developer Hub interface that is specific to just websites.The following values are common for this field:
service
- A backend service, typically exposing an API.
website
- A website.
library
- A software library, such as an npm module or a Java library.
- 6
- Use the
parameters
section to specify parameters for user input that are shown in a form view when a user creates a component by using the template in the Red Hat Developer Hub console. Eachparameters
subsection, defined by a title and properties, creates a new form page with that definition. - 7
- Use the
steps
section to specify steps that are executed in the backend. These steps must be defined by using a unique step ID, a name, and an action. You can view actions that are available on your Red Hat Developer Hub instance by visiting the URLhttps://<rhdh_url>/create/actions
. - 8
- Use the
output
section to specify the structure of output data that is created when the template is used. Theoutput
section, particularly thelinks
subsection, provides valuable references and URLs that users can utilize to access and interact with components that are created from the template. - 9
- Provides a reference or URL to the repository associated with the generated component.
- 10
- Provides a reference or URL that allows users to open the generated component in a catalog or directory where various components are listed.
4.3. Importing an existing template to Red Hat Developer Hub Copy linkLink copied to clipboard!
You can add an existing template to your Red Hat Developer Hub instance by using the Catalog Processor.
Prerequisites
- You have created a directory or repository that contains at least one template YAML file.
- If you want to use a template that is stored in a repository such as GitHub or GitLab, you must configure a Red Hat Developer Hub integration for your provider.
Procedure
In the
app-config.yaml
configuration file, modify thecatalog.rules
section to include a rule for templates, and configure thecatalog.locations
section to point to the template that you want to add, as shown in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
- Click the Catalog tab in the navigation panel.
- In the Kind drop-down menu, select Template.
- Confirm that your template is shown in the list of existing templates.
Chapter 5. Customizing the Learning Paths in Red Hat Developer Hub Copy linkLink copied to clipboard!
In Red Hat Developer Hub, you can configure Learning Paths by passing the data into the app-config.yaml
file as a proxy. The base URL must include the /developer-hub/learning-paths
proxy.
Due to the use of overlapping pathRewrites
for both the learning-path
and homepage
quick access proxies, you must create the learning-paths
configuration (^api/proxy/developer-hub/learning-paths
) before you create the homepage
configuration (^/api/proxy/developer-hub
).
For more information about customizing the Home page in Red Hat Developer Hub, see Customizing the Home page in Red Hat Developer Hub.
You can provide data to the Learning Path from the following sources:
- JSON files hosted on GitHub or GitLab.
- A dedicated service that provides the Learning Path data in JSON format using an API.
5.1. Using hosted JSON files to provide data to the Learning Paths Copy linkLink copied to clipboard!
Prerequisites
You have installed Red Hat Developer Hub by using either the Operator or Helm chart. For more information, see Installing Red Hat Developer Hub on OpenShift Container Platform.
Procedure
To access the data from the JSON files, complete the following step:
Add the following code to the
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2. Using a dedicated service to provide data to the Learning Paths Copy linkLink copied to clipboard!
When using a dedicated service, you can do the following:
- Use the same service to provide the data to all configurable Developer Hub pages or use a different service for each page.
-
Use the
red-hat-developer-hub-customization-provider
as an example service, which provides data for both the Home and Tech Radar pages. Thered-hat-developer-hub-customization-provider
service provides the same data as default Developer Hub data. You can fork thered-hat-developer-hub-customization-provider
service repository from GitHub and modify it with your own data, if required. -
Deploy the
red-hat-developer-hub-customization-provider
service and the Developer Hub Helm chart on the same cluster.
Prerequisites
- You have installed the Red Hat Developer Hub using Helm chart. For more information, see Installing Red Hat Developer Hub on OpenShift Container Platform.
Procedure
To use a dedicated service to provide the Learning Path data, complete the following steps:
Add the following code to the
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow where the
LEARNING_PATH_DATA_URL
is defined ashttp://<SERVICE_NAME>/learning-paths
, for example,http://rhdh-customization-provider/learning-paths
.NoteYou can define the
LEARNING_PATH_DATA_URL
by adding it torhdh-secrets
or by directly replacing it with its value in your custom ConfigMap.- Delete the Developer Hub pod to ensure that the new configurations are loaded correctly.
Chapter 6. Configuring TechDocs Copy linkLink copied to clipboard!
Configure the Red Hat Developer Hub TechDocs plugin to create, find, and use documentation in a central location and in a standardized way. For example:
- Docs-like-code approach
- Write your technical documentation in Markdown files that are stored inside your project repository along with your code.
- Documentation site generation
- Use MkDocs to create a full-featured, Markdown-based, static HTML site for your documentation that is rendered centrally in Developer Hub.
- Documentation site metadata and integrations
- See additional metadata about the documentation site alongside the static documentation, such as the date of the last update, the site owner, top contributors, open GitHub issues, Slack support channels, and Stack Overflow Enterprise tags.
- Built-in navigation and search
- Find the information that you want from a document more quickly and easily.
- Add-ons
- Customize your TechDocs experience with Add-ons to address higher-order documentation needs.
The TechDocs plugin is preinstalled and enabled on a Developer Hub instance by default. You can disable or enable the TechDocs plugin, and change other parameters, by configuring the Red Hat Developer Hub Helm chart or the Red Hat Developer Hub Operator config map.
Red Hat Developer Hub includes a built-in TechDocs builder that generates static HTML documentation from your codebase. However, the default basic setup of the local builder is not intended for production.
You can use a CI/CD pipeline with the repository that has a dedicated job to generate docs for TechDocs. The generated static files are stored in OpenShift Data Foundation or in a cloud storage solution of your choice and published to a static HTML documentation site.
After you configure OpenShift Data Foundation to store the files that TechDocs generates, you can configure the TechDocs plugin to use the OpenShift Data Foundation for cloud storage.
6.1. Configuring storage for TechDocs files Copy linkLink copied to clipboard!
The TechDocs publisher stores generated files in local storage or in cloud storage, such as OpenShift Data Foundation, Google GCS, AWS S3, or Azure Blob Storage.
6.1.1. Using OpenShift Data Foundation for file storage Copy linkLink copied to clipboard!
You can configure OpenShift Data Foundation to store the files that TechDocs generates instead of relying on other cloud storage solutions.
OpenShift Data Foundation provides an ObjectBucketClaim
custom resource (CR) that you can use to request an S3 compatible bucket backend. You must install the OpenShift Data Foundation Operator to use this feature.
Prerequisites
- An OpenShift Container Platform administrator has installed the OpenShift Data Foundation Operator in Red Hat OpenShift Container Platform. For more information, see OpenShift Container Platform - Installing Red Hat OpenShift Data Foundation Operator.
-
An OpenShift Container Platform administrator has created an OpenShift Data Foundation cluster and configured the
StorageSystem
schema. For more information, see OpenShift Container Platform - Creating an OpenShift Data Foundation cluster.
Procedure
Create an
ObjectBucketClaim
CR where the generated TechDocs files are stored. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteCreating the Developer Hub
ObjectBucketClaim
CR automatically creates both the Developer HubObjectBucketClaim
config map and secret. The config map and secret have the same name as theObjectBucketClaim
CR.
After you create the ObjectBucketClaim
CR, you can use the information stored in the config map and secret to make the information accessible to the Developer Hub container as environment variables. Depending on the method that you used to install Developer Hub, you add the access information to either the Red Hat Developer Hub Helm chart or Operator configuration.
6.1.2. Making object storage accessible to containers by using the Helm chart Copy linkLink copied to clipboard!
Creating a ObjectBucketClaim
custom resource (CR) automatically generates both the Developer Hub ObjectBucketClaim
config map and secret. The config map and secret contain ObjectBucket
access information. Adding the access information to the Helm chart configuration makes it accessible to the Developer Hub container by adding the following environment variables to the container:
-
BUCKET_NAME
-
BUCKET_HOST
-
BUCKET_PORT
-
BUCKET_REGION
-
BUCKET_SUBREGION
-
AWS_ACCESS_KEY_ID
-
AWS_SECRET_ACCESS_KEY
These variables are then used in the TechDocs plugin configuration.
Prerequisites
- You have installed Red Hat Developer Hub on OpenShift Container Platform using the Helm chart.
-
You have created an
ObjectBucketClaim
CR for storing files generated by TechDocs. For more information see Using OpenShift Data Foundation for file storage
Procedure
In the
upstream.backstage
key in the Helm chart values, enter the name of the Developer HubObjectBucketClaim
secret as the value for theextraEnvVarsSecrets
field and theextraEnvVarsCM
field. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.1.2.1. Example TechDocs Plugin configuration for the Helm chart Copy linkLink copied to clipboard!
The following example shows a Developer Hub Helm chart configuration for the TechDocs plugin:
6.1.3. Making object storage accessible to containers by using the Operator Copy linkLink copied to clipboard!
Creating a ObjectBucketClaim
custom resource (CR) automatically generates both the Developer Hub ObjectBucketClaim
config map and secret. The config map and secret contain ObjectBucket
access information. Adding the access information to the Operator configuration makes it accessible to the Developer Hub container by adding the following environment variables to the container:
-
BUCKET_NAME
-
BUCKET_HOST
-
BUCKET_PORT
-
BUCKET_REGION
-
BUCKET_SUBREGION
-
AWS_ACCESS_KEY_ID
-
AWS_SECRET_ACCESS_KEY
These variables are then used in the TechDocs plugin configuration.
Prerequisites
- You have installed Red Hat Developer Hub on OpenShift Container Platform using the Operator.
-
You have created an
ObjectBucketClaim
CR for storing files generated by TechDocs.
Procedure
In your
Backstage
CR, enter the name of the Developer HubObjectBucketClaim
config map as the value for thespec.application.extraEnvs.configMaps
field and enter the Developer HubObjectBucketClaim
secret name as the value for thespec.application.extraEnvs.secrets
field. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.1.3.1. Example TechDocs Plugin configuration for the Operator Copy linkLink copied to clipboard!
The following example shows a Red Hat Developer Hub Operator config map configuration for the TechDocs plugin:
6.2. Configuring CI/CD to generate and publish TechDocs sites Copy linkLink copied to clipboard!
TechDocs reads the static generated documentation files from a cloud storage bucket, such as OpenShift Data Foundation. The documentation site is generated on the CI/CD workflow associated with the repository containing the documentation files. You can generate docs on CI and publish to a cloud storage using the techdocs-cli
CLI tool.
You can use the following example to create a script for TechDocs publication:
The TechDocs workflow starts the CI when a user makes changes in the repository containing the documentation files. You can configure the workflow to start only when files inside the docs/
directory or mkdocs.yml
are changed.
6.2.1. Preparing your repository for CI Copy linkLink copied to clipboard!
The first step on the CI is to clone your documentation source repository in a working directory.
Procedure
To clone your documentation source repository in a working directory, enter the following command:
git clone <https://path/to/docs-repository/>
git clone <https://path/to/docs-repository/>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2.2. Generating the TechDocs site Copy linkLink copied to clipboard!
Procedure
To configure CI/CD to generate your techdocs, complete the following steps:
Install the
npx
package to runtechdocs-cli
using the following command:npm install -g npx
npm install -g npx
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
techdocs-cli
tool using the following command:npm install -g @techdocs/cli
npm install -g @techdocs/cli
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
mkdocs
plugins using the following command:pip install "mkdocs-techdocs-core==1.*"
pip install "mkdocs-techdocs-core==1.*"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate your techdocs site using the following command:
npx @techdocs/cli generate --no-docker --source-dir <path_to_repo> --output-dir ./site
npx @techdocs/cli generate --no-docker --source-dir <path_to_repo> --output-dir ./site
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Where
<path_to_repo>
is the location in the file path that you used to clone your repository.
6.2.3. Publishing the TechDocs site Copy linkLink copied to clipboard!
Procedure
To publish your techdocs site, complete the following steps:
- Set the necessary authentication environment variables for your cloud storage provider.
Publish your techdocs using the following command:
npx @techdocs/cli publish --publisher-type <awsS3|googleGcs> --storage-name <bucket/container> --entity <namespace/kind/name> --directory ./site
npx @techdocs/cli publish --publisher-type <awsS3|googleGcs> --storage-name <bucket/container> --entity <namespace/kind/name> --directory ./site
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add a
.github/workflows/techdocs.yml
file in your Software Template(s). For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 7. Customizing the Tech Radar page in Red Hat Developer Hub Copy linkLink copied to clipboard!
In Red Hat Developer Hub, the Tech Radar page is provided by the tech-radar
dynamic plugin, which is disabled by default. For information about enabling dynamic plugins in Red Hat Developer Hub see Configuring plugins in Red Hat Developer Hub.
In Red Hat Developer Hub, you can configure Learning Paths by passing the data into the app-config.yaml
file as a proxy. The base Tech Radar URL must include the /developer-hub/tech-radar
proxy.
Due to the use of overlapping pathRewrites
for both the tech-radar
and homepage
quick access proxies, you must create the tech-radar
configuration (^api/proxy/developer-hub/tech-radar
) before you create the homepage
configuration (^/api/proxy/developer-hub
).
For more information about customizing the Home page in Red Hat Developer Hub, see Customizing the Home page in Red Hat Developer Hub.
You can provide data to the Tech Radar page from the following sources:
- JSON files hosted on GitHub or GitLab.
- A dedicated service that provides the Tech Radar data in JSON format using an API.
7.1. Using hosted JSON files to provide data to the Tech Radar page Copy linkLink copied to clipboard!
Prerequisites
- You have installed Red Hat Developer Hub by using either the Operator or Helm chart. For more information, see Installing Red Hat Developer Hub on OpenShift Container Platform.
-
You have specified the data sources for the Tech Radar plugin in the
integrations
section of theapp-config.yaml
file. For example, to configure GitHub as an integration, see Authenticating with GitHub.
Procedure
To access the data from the JSON files, complete the following step:
-
Enable the
./dynamic-plugins/dist/backstage-community-plugin-tech-radar
and/dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
plugins. Add the following code to the
app-config.yaml
file:techRadar: url: ${TECH_RADAR_DATA_URL}
techRadar: url: ${TECH_RADAR_DATA_URL}
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
TECH_RADAR_DATA_URL
is the URL from which the JSON data is loaded.
7.2. Using a dedicated service to provide data to the Tech Radar page Copy linkLink copied to clipboard!
When using a dedicated service, you can do the following:
- Use the same service to provide the data to all configurable Developer Hub pages or use a different service for each page.
-
Use the
red-hat-developer-hub-customization-provider
as an example service, which provides data for both the Home and Tech Radar pages. Thered-hat-developer-hub-customization-provider
service provides the same data as default Developer Hub data. You can fork thered-hat-developer-hub-customization-provider
service repository from GitHub and modify it with your own data, if required. -
Deploy the
red-hat-developer-hub-customization-provider
service and the Developer Hub Helm chart on the same cluster.
Prerequisites
- You have installed the Red Hat Developer Hub using Helm chart. For more information, see Installing Red Hat Developer Hub on OpenShift Container Platform with the Helm chart.
Procedure
To use a separate service to provide the Tech Radar data, complete the following steps:
Add the dedicated service as an allowed host by adding the following code to the
app-config.yaml
file:backend: reading: allow: - host: 'hostname'
backend: reading: allow: - host: 'hostname'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following to the
app-config.yaml
file:techRadar: url: ${TECH_RADAR_DATA_URL}
techRadar: url: ${TECH_RADAR_DATA_URL}
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
TECH_RADAR_DATA_URL
is the URL from which the JSON data is loaded.
Chapter 8. Customizing Red Hat Developer Hub appearance Copy linkLink copied to clipboard!
The following default theme configurations are available for Red Hat Developer Hub:
- The Red Hat Developer Hub theme
- Default theme configurations to make your developer portal look like a standard Red Hat Developer Hub instance. For more information, see Section 8.7, “Default Red Hat Developer Hub theme”
- The Backstage theme
- Default theme configurations to make your developer portal look like a standard Backstage instance. For more information, see Section 8.8, “Default Backstage theme”
You can change or disable particular parameters in a default theme or create a fully customized theme by modifying the app-config-rhdh.yaml
file. From the app-config-rhdh.yaml
file, you can customize common theme components, including the following:
- Company name and logo
- Font color, size, and style of text in paragraphs, headings, headers, and buttons
- Header color, gradient, and shape
- Button color
- Navigation indicator color
You can also customize some components from the Developer Hub GUI, such as the theme mode (Light Theme, Dark Theme, or Auto).
8.1. Customizing the theme mode for your Developer Hub instance Copy linkLink copied to clipboard!
In Developer Hub, theme configurations are used to change the look and feel of different UI components. So, you might notice changes in different UI components, such as buttons, tabs, sidebars, cards, and tables along with some changes in background color and font used on the RHDH pages.
You can choose one of the following theme modes for your Developer Hub instance:
- Light theme
- Dark theme
- Auto
The default theme mode is Auto, which automatically sets the light or dark theme based on your system preferences.
Prerequisites
- You are logged in to the Developer Hub web console.
Procedure
- From the Developer Hub web console, click Settings.
From the Appearance panel, click LIGHT THEME, DARK THEME, or AUTO to change the theme mode.
8.2. Customizing the branding logo of your Developer Hub instance Copy linkLink copied to clipboard!
You can customize the branding logo of your Developer Hub instance by configuring the branding
section in the app-config.yaml
file, as shown in the following example:
app: branding: fullLogo: ${BASE64_EMBEDDED_FULL_LOGO} iconLogo: ${BASE64_EMBEDDED_ICON_LOGO}
app:
branding:
fullLogo: ${BASE64_EMBEDDED_FULL_LOGO}
iconLogo: ${BASE64_EMBEDDED_ICON_LOGO}
where:
- 1
fullLogo
is the logo on the expanded (pinned) sidebar and expects a base64 encoded image.- 2
iconLogo
is the logo on the collapsed (unpinned) sidebar and expects a base64 encoded image.You can format the
BASE64_EMBEDDED_FULL_LOGO
environment variable as follows:BASE64_EMBEDDED_FULL_LOGO: "data:_<media_type>_;base64,<base64_data>"
BASE64_EMBEDDED_FULL_LOGO: "data:_<media_type>_;base64,<base64_data>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following example demonstrates how to customize the
BASE64_EMBEDDED_FULL_LOGO
using thedata:_<media_type>_;base64,<base64_data>
format:SVGLOGOBASE64=$(base64 -i logo.svg) BASE64_EMBEDDED_FULL_LOGO="data:image/svg+xml;base64,$SVGLOGOBASE64"
SVGLOGOBASE64=$(base64 -i logo.svg) BASE64_EMBEDDED_FULL_LOGO="data:image/svg+xml;base64,$SVGLOGOBASE64"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
image/svg+xml
with the correct media type for your image (for example,image/png
andimage/jpeg
), and adjust the file extension accordingly. As a result, you can embed the logo directly without referencing an external file.
You can also customize the width of the branding logo by setting a value for the fullLogoWidth
field in the branding
section, as shown in the following example:
app: branding: fullLogoWidth: 110px # ...
app:
branding:
fullLogoWidth: 110px
# ...
- 1
- The default value for the logo width is
110px
. The following units are supported:integer
,px
,em
,rem
, percentage.
8.4. Customizing the theme mode color palettes for your Developer Hub instance Copy linkLink copied to clipboard!
You can customize the color palettes of the light and dark theme modes in your Developer Hub instance by configuring the light.palette
and dark.palette
parameters in the branding.theme
section of the app-config.yaml
file, as shown in the following example:
- 1
- The main primary color for the light color palette, for example,
#ffffff
orwhite
- 2
- The color of the navigation indicator for the light color palette, which is a vertical bar that indicates the selected tab in the navigation panel, for example,
#FF0000
orred
- 3
- The background color for the default page theme for the light color palette, for example,
#ffffff
orwhite
- 4
- The main primary color for the dark color palette, for example,
#000000
orblack
- 5
- The color of the navigation indicator for the dark color palette, which is a vertical bar that indicates the selected tab in the navigation panel, for example,
#FF0000
orred
- 6
- The background color for the default page theme for the dark color palette, for example,
#000000
orblack
Additional resources
8.5. Customizing the page theme header for your Developer Hub instance Copy linkLink copied to clipboard!
You can customize the header color for the light and dark theme modes in your Developer Hub instance by modifying the branding.theme
section of the app-config.yaml
file. You can also customize the page headers for additional Developer Hub pages, such as the Home, Catalog, and APIs pages.
- 1
- The theme mode, for example,
light
ordark
- 2
- The
yaml
header for the default page theme configuration - 3
- The color of the page header background, for example,
#ffffff
orwhite
- 4
- The color of the text in the page header, for example,
#000000
orblack
- 5
- The pattern on the page header, for example,
wave
,round
, ornone
- 6
- The
yaml
header for a specific page theme configuration, for example,apis
,home
8.6. Customizing the font for your Developer Hub instance Copy linkLink copied to clipboard!
You can configure the typography
section of the app-config.yaml
file to change the default font family and size of the page text, as well as the font family and size of each heading level, as shown in the following example:
8.7. Default Red Hat Developer Hub theme Copy linkLink copied to clipboard!
You can use the default Red Hat Developer Hub theme configurations to make your Developer Hub instance look like a standard Red Hat Developer Hub instance. You can also modify the app-config.yaml
file to customize or disable particular parameters.
8.7.1. Default Red Hat Developer Hub theme color palette Copy linkLink copied to clipboard!
The app-config.yaml
file uses the following configurations for the default Red Hat Developer Hub color palette:
Alternatively, you can use the following variant
and mode
values in the app-config.yaml
file to apply the previous default configuration:
8.7.2. Default Red Hat Developer Hub page themes Copy linkLink copied to clipboard!
The default Developer Hub header color is white in light mode and black in dark mode, as shown in the following app-config.yaml
file configuration:
8.8. Default Backstage theme Copy linkLink copied to clipboard!
You can use the default Backstage theme configurations to make your Developer Hub instance look like a standard Backstage instance. You can also modify the app-config.yaml
file to customize or disable particular parameters.
8.8.1. Default Backstage theme color palette Copy linkLink copied to clipboard!
The app-config.yaml
file uses the following configurations for the default Backstage color palette:
Alternatively, you can use the following variant
and mode
values in the app-config.yaml
file to apply the previous default configuration:
8.8.2. Default Backstage page themes Copy linkLink copied to clipboard!
The default Backstage header color is white in light mode and black in dark mode, as shown in the following app-config.yaml
file configuration:
8.9. Loading a custom Developer Hub theme by using a dynamic plugin Copy linkLink copied to clipboard!
You can load a custom Developer Hub theme from a dynamic plugin.
Procedure
Export a theme provider function in your dynamic plugin, for example:
Sample
myTheme.ts
fragmentimport { lightTheme } from './lightTheme'; // some custom theme import { UnifiedThemeProvider } from '@backstage/theme'; export const lightThemeProvider = ({ children }: { children: ReactNode }) => ( <UnifiedThemeProvider theme={lightTheme} children={children} /> );
import { lightTheme } from './lightTheme'; // some custom theme import { UnifiedThemeProvider } from '@backstage/theme'; export const lightThemeProvider = ({ children }: { children: ReactNode }) => ( <UnifiedThemeProvider theme={lightTheme} children={children} /> );
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about creating a custom theme, see Backstage documentation - Creating a Custom Theme.
Configure Developer Hub to load the theme in the UI by using the
themes
configuration field:app-config.yaml
fragmentCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Set your theme ID by specifying the desired value. Optionally, override the default Developer Hub themes by using the following ID values:
light
to replace the default light theme, ordark
to replace the default dark theme.
Verification
- The theme is available in the Developer Hub Settings page.
8.10. Custom component options for your Developer Hub instance Copy linkLink copied to clipboard!
There are two component variants that you can use to customize various components of your Developer Hub theme:
- Patternfly
- MUI
In addition to assigning a component variant to each parameter in the light or dark theme mode configurations, you can toggle the rippleEffect
on
or off
.
The following code shows the options that you can use in the app-config.yaml
file to configure the theme components for your Developer Hub instance:
Chapter 9. Customizing the Home page Copy linkLink copied to clipboard!
When using the app-config
, you can do the following:
- Customize and extend the default Home page layout with additional cards that appear based on the plugins you have installed and enabled.
- Change quick access links.
Add, reorganize, and remove the following available cards:
- Search bar
- Quick access
- Headline
- Markdown
- Placeholder
- Catalog starred entities
- Featured docs
9.1. Customizing the Home page cards Copy linkLink copied to clipboard!
Administrators can change the fixed height of cards that are in a 12-column grid.
The default Home page is as shown in the following app-config.yaml
file configuration:
Prerequisites
-
You have administrative access and can modify the
app-config.yaml
file for dynamic plugin configurations.
Procedure
Configure different cards for your Home page in Red Hat Developer Hub as follows:
- Search
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Expand Table 9.1. Available props Prop Default Description path
/search
Override the linked search path if needed
queryParam
query
Override the search query parameter name if needed
- Quick access
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Expand Table 9.2. Available props Prop Default Description title
Quick Access
Override the linked search path if needed
path
none
Override the search query parameter name if needed
- Headline
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Expand Table 9.3. Available props Prop Default Description title
none
Title
- Markdown
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Placeholder
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Catalog starred entities
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Featured docs
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
9.2. Defining the layout of the Red Hat Developer Hub Home page Copy linkLink copied to clipboard!
The Home page uses a 12-column grid to position your cards. You can use the optimal parameters to define the layout of your Developer Hub Home page.
Prerequisites
Include the following optimal parameters in each of your breakpoints:
- width (w)
- height (h)
- position (x and y)
Procedure
Configure your Developer Hub
app-config.yaml
configuration file by choosing one of the following options:- Use the full space on smaller windows and half of the space on larger windows as follows:
-
Show the cards side by side by defining the
x
parameter as shown in the following example:
However, you can see a second card below this card by default.
-
Show the cards in three columns by defining the
x
parameter as shown in the following example:
Chapter 10. Customizing the Quick access card Copy linkLink copied to clipboard!
To access the Home page in Red Hat Developer Hub, the base URL must include the /developer-hub
proxy. You can configure the Home page by passing the data into the app-config.yaml
file as a proxy. You can provide data to the Home page from the following sources:
- JSON files hosted on GitHub or GitLab.
- A dedicated service that provides the Home page data in JSON format using an API.
10.1. Using hosted JSON files to provide data to the Quick access card Copy linkLink copied to clipboard!
Prerequisites
- You have installed Red Hat Developer Hub by using either the Operator or Helm chart. See Installing Red Hat Developer Hub on OpenShift Container Platform.
Procedure
-
To access the data from the JSON files, add the following code to the
app-config.yaml
Developer Hub configuration file: Add the following code to the
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2. Using a dedicated service to provide data to the Quick access card Copy linkLink copied to clipboard!
When using a dedicated service, you can do the following tasks:
- Use the same service to provide the data to all configurable Developer Hub pages or use a different service for each page.
-
Use the
red-hat-developer-hub-customization-provider
as an example service, which provides data for both the Home and Tech Radar pages. Thered-hat-developer-hub-customization-provider
service provides the same data as default Developer Hub data. You can fork thered-hat-developer-hub-customization-provider
service repository from GitHub and modify it with your own data, if required. -
Deploy the
red-hat-developer-hub-customization-provider
service and the Developer Hub Helm chart on the same cluster.
Prerequisites
- You have installed the Red Hat Developer Hub using Helm chart. For more information, see Installing Red Hat Developer Hub on OpenShift Container Platform with the Helm chart.
Procedure
To use a separate service to provide the Home page data, complete the following steps:
- From the Developer perspective in the Red Hat OpenShift Container Platform web console, click +Add > Import from Git.
Enter the URL of your Git repository into the Git Repo URL field.
To use the
red-hat-developer-hub-customization-provider
service, add the URL for the red-hat-developer-hub-customization-provider repository or your fork of the repository containing your customizations.-
On the General tab, enter
red-hat-developer-hub-customization-provider
in the Name field and click Create. On the Advanced Options tab, copy the value from Target Port.
NoteTarget Port automatically generates a Kubernetes or OpenShift Container Platform service to communicate with.
Add the following code to the
app-config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
http://<SERVICE_NAME>:8080
, for example,http://rhdh-customization-provider:8080
.
NoteThe
red-hat-developer-hub-customization-provider
service contains the 8080 port by default. If you are using a custom port, you can specify it with the 'PORT' environmental variable in theapp-config.yaml
file.-
Replace the
HOMEPAGE_DATA_URL
by adding the URL torhdh-secrets
or by directly replacing it in your custom ConfigMap. - Delete the Developer Hub pod to ensure that the new configurations are loaded correctly.
Verification
To view the service, go to the Administrator perspective in the OpenShift Container Platform web console and click Networking > Service.
NoteYou can also view Service Resources in the Topology view.
Ensure that the provided API URL for the Home page returns the data in JSON format as shown in the following example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf the request call fails or is not configured, the Developer Hub instance falls back to the default local data.
-
If the images or icons do not load, then allowlist them by adding your image or icon host URLs to the content security policy (csp)
img-src
in your custom ConfigMap as shown in the following example: