Configuring
Configuring Red Hat Developer Hub
Abstract
Preface
Learn how to configure Red Hat Developer Hub by adding custom configuration files.
Chapter 1. Authoring custom Red Hat Developer Hub configuration files
To configure Red Hat Developer Hub, author your custom Red Hat Developer Hub configuration files before deploying Red Hat Developer Hub.
Red Hat Developer Hub installs a default configuration that is not suitable for production use, and that you cannot edit after installation. Both the operator and Helm revert your manual changes
Prepare your custom configuration file before deploying Developer Hub.
1.1. Authoring the main Red Hat Developer Hub configuration file
The main Red Hat Developer Hub configuration file is the app-config.yaml
file.
Procedure
Author the Developer Hub general configuration in the
app
section.- title
Enter your Developer Hub instance display name, such as <Red Hat Developer Hub>.
app-config.yaml
excerptapp: title: Red Hat Developer Hub
- baseURL
Enter the external URL of your Red Hat Developer Hub instance, such as https://<my_developer_hub_url>.
app-config.yaml
exampleapp: baseUrl: https://<my_developer_hub_url>
Author the Developer Hub backend configuration in the
backend
section.- auth
- Enter your authentication configuration. See Authentication.
- baseURL
Enter the external URL of your Red Hat Developer Hub instance, such as https://<my_developer_hub_url>.
app-config.yaml
examplebackend: baseUrl: https://<my_developer_hub_url> cors: origin: <RHDH_URL>
-
Optionally, to configure authorization, author the
permission
section. See Authorization.
1.2. Authoring optional Red Hat Developer Hub configuration files
You might need to author optional configuration files.
Procedure
-
Optionally, to enable dynamic plugins, author the
dynamic-plugins.yaml
file. See Installing and viewing dynamic plugins. -
Optionally, to configure authorization by using external files, author the
policy.csv
andrbac-policy.yaml
files. See Authorization.
Chapter 2. Adding custom configuration files to Red Hat Developer Hub
To configure Red Hat Developer Hub, add custom configuration files to Red Hat OpenShift Container Platform and register them in Developer Hub.
2.1. Adding custom Red Hat Developer Hub configuration files by using the operator
A custom application configuration file is a ConfigMap
object that you can use to change the configuration of your Red Hat Developer Hub instance. If you are deploying your Developer Hub instance on Red Hat OpenShift Container Platform, you can use the Red Hat Developer Hub Operator to add a custom application configuration file to your OpenShift Container Platform instance by creating the ConfigMap
object and referencing it in the Developer Hub custom resource (CR).
The custom application configuration file contains a sensitive environment variable, named BACKEND_SECRET
. This variable contains a mandatory backend authentication key that Developer Hub uses to reference an environment variable defined in an OpenShift Container Platform secret. You must create a secret, named 'secrets-rhdh', and reference it in the Developer Hub CR.
You are responsible for protecting your Red Hat Developer Hub installation from external and unauthorized access. Manage the backend authentication key like any other secret. Meet strong password requirements, do not expose it in any configuration files, and only inject it into configuration files as an environment variable.
Prerequisites
- You have authored custom configuration files.
- You have an active Red Hat OpenShift Container Platform account.
- Your administrator has installed the Red Hat Developer Hub Operator in OpenShift Container Platform.
-
You have created an OpenShift Container Platform project, named
<RHDH>
, to contain the Developer Hub instance.
Procedure
- From the Developer perspective in the OpenShift Container Platform web console, select the Topology view, and click the Open URL icon on the Developer Hub pod to identify your Developer Hub external URL: <RHDH_URL>.
Upload your custom configuration files to OpenShift Container Platform config maps, in your
<RHDH>
project.- From the Developer perspective in the OpenShift Container Platform web console, select the ConfigMaps view.
- Click Create ConfigMap.
- Click Create.
Create your OpenShift Container Platform secrets.
- Select the Secrets view.
- Click Create Key/value Secret.
-
Create a secret named
secrets-rhdh
. Add a key named
BACKEND_SECRET
and a base64 encoded string as a value. Use a unique value for each Red Hat Developer Hub instance. For example, you can use the following command to generate a key from your terminal:node -p 'require("crypto").randomBytes(24).toString("base64")'
- Click Create.
Configure the Developer Hub custom resource
- Select the Topology view.
Click the overflow menu for the Red Hat Developer Hub instance that you want to use and select Edit Backstage to load the YAML view of the Red Hat Developer Hub instance.
In the CR, enter the name of the custom application configuration config map as the value for the
spec.application.appConfig.configMaps
field, and enter the name of your secret as the value for thespec.application.extraEnvs.secrets
field. For example:apiVersion: rhdh.redhat.com/v1alpha1 kind: Backstage metadata: name: developer-hub spec: application: appConfig: mountPath: /opt/app-root/src configMaps: - name: app-config extraEnvs: secrets: - name: secrets-rhdh extraFiles: mountPath: /opt/app-root/src replicas: 1 route: enabled: true database: enableLocalDb: true
- Click Save.
- Navigate back to the Topology view and wait for the Red Hat Developer Hub pod to start.
- Click the Open URL icon to use the Red Hat Developer Hub platform with the configuration changes.
Additional resources
- For more information about roles and responsibilities in Developer Hub, see Role-Based Access Control (RBAC) in Red Hat Developer Hub.
2.2. Adding custom Red Hat Developer Hub configuration files by using the Helm chart
You can use the Red Hat Developer Hub Helm chart to add a custom application configuration file to your OpenShift Container Platform instance.
Prerequisites
- You have authored custom configuration files.
- You have created an Red Hat OpenShift Container Platform account.
-
You have created an OpenShift Container Platform project, named
<RHDH>
, to contain the Developer Hub instance.
Procedure
Upload your custom configuration files to OpenShift Container Platform config maps, in your
<RHDH>
project.- From the OpenShift Container Platform web console, select the ConfigMaps tab.
-
Click Create ConfigMap to create the
app-config
config map. - From Create ConfigMap page, select the YAML view option in Configure via and make changes to the file, if needed.
- Click Create.
Configure Helm to use your custom configuration files in Developer Hub.
- Go to the Helm tab to see the list of Helm releases.
- Click the overflow menu on the Helm release that you want to use and select Upgrade.
- Use the YAML view to edit the Helm configuration.
Set the value of the
upstream.backstage.extraAppConfig.configMapRef
andupstream.backstage.extraAppConfig.filename
parameters as follows:Helm configuration excerpt
upstream: backstage: extraAppConfig: - configMapRef: app-config filename: app-config.yaml
- Click Upgrade.
Next steps
- Install Developer Hub by using Helm.