Red Hat Developer Hub 1.4

Configuring

Configuring Red Hat Developer Hub

Red Hat Customer Content Services

Abstract

Learn how to configure Red Hat Developer Hub by adding custom configuration files.

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

  1. 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 excerpt

    app:
      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 example

    app:
      baseUrl: https://<my_developer_hub_url>

  2. 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 example

    backend:
      baseUrl: https://<my_developer_hub_url>
      cors:
        origin: <RHDH_URL>

  3. 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

  1. Optionally, to enable dynamic plugins, author the dynamic-plugins.yaml file. See Installing and viewing dynamic plugins.
  2. Optionally, to configure authorization by using external files, author the policy.csv and rbac-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.

Note

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

Procedure

  1. 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>.
  2. Upload your custom configuration files to OpenShift Container Platform config maps, in your <RHDH> project.

    1. From the Developer perspective in the OpenShift Container Platform web console, select the ConfigMaps view.
    2. Click Create ConfigMap.
    3. Click Create.
  3. Create your OpenShift Container Platform secrets.

    1. Select the Secrets view.
    2. Click Create Key/value Secret.
    3. Create a secret named secrets-rhdh.
    4. 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")'
    5. Click Create.
  4. Configure the Developer Hub custom resource

    1. Select the Topology view.
    2. 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.

      operator install 2
    3. 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 the spec.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
    4. Click Save.
    5. Navigate back to the Topology view and wait for the Red Hat Developer Hub pod to start.
    6. Click the Open URL icon to use the Red Hat Developer Hub platform with the configuration changes.

Additional resources

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

  1. Upload your custom configuration files to OpenShift Container Platform config maps, in your <RHDH> project.

    1. From the OpenShift Container Platform web console, select the ConfigMaps tab.
    2. Click Create ConfigMap to create the app-config config map.
    3. From Create ConfigMap page, select the YAML view option in Configure via and make changes to the file, if needed.
    4. Click Create.
  2. Configure Helm to use your custom configuration files in Developer Hub.

    1. Go to the Helm tab to see the list of Helm releases.
    2. Click the overflow menu on the Helm release that you want to use and select Upgrade.
    3. Use the YAML view to edit the Helm configuration.
    4. Set the value of the upstream.backstage.extraAppConfig.configMapRef and upstream.backstage.extraAppConfig.filename parameters as follows:

      Helm configuration excerpt

      upstream:
        backstage:
          extraAppConfig:
            - configMapRef: app-config
              filename: app-config.yaml

    5. Click Upgrade.

Next steps

  • Install Developer Hub by using Helm.

Legal Notice

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.