Chapter 3. Supported configurations for Red Hat Developer Hub

This section describes the configurations that are required to access the Red Hat Developer Hub, including:

  • Custom applications configuration
  • Source control configuration for Developer Hub Catalog

3.1. Adding a custom application configuration file to Red Hat OpenShift

To access the Red Hat Developer Hub, you must add a custom application configuration file to OpenShift. In OpenShift, you can use the following content as a base template to create a ConfigMap named app-config-rhdh:

kind: ConfigMap
apiVersion: v1
metadata:
  name: app-config-rhdh
data:
  app-config-rhdh.yaml: |
    app:
      title: Red Hat Developer Hub

Prerequisites

  • You have created an account in Red Hat OpenShift.

Procedure

  1. Navigate to OpenShift and select the ConfigMaps tab.
  2. Click Create ConfigMap.

    Create ConfigMap page appears.

  3. Select the YAML view option in Configure via and make the changes to the file, if needed.
  4. Click Create.
  5. Go to the Helm tab.

    The list of Helm Releases appears on the page.

  6. Click the three dots of a Helm release and select Upgrade.
  7. Add the following values in Root Schema → Backstage Chart Schema → Backstage Parameters → Extra App Configuration files to inline into command arguments:

    • ConfigMapRef: app-config-rhdh
    • filename: app-config-rhdh.yaml
  8. Click Upgrade.
  9. Alternatively, go to the YAML view for the helm values and set the value of upstream.backstage.command to [].
  10. Click Upgrade.

3.2. Adding source control for Catalog in Red Hat Developer Hub

To populate the Catalog in Red Hat Developer Hub, you need to add software templates, and to add the templates, you must enable a source control such as GitHub, GitLab, or BitBucket.

3.2.1. Setting GitHub integration and authentication

The GitHub integration and authentication is required to enable the GitHub plugins in Red Hat Developer Hub.

Prerequisites

  • You have a GitHub account.
  • You have an account in Red Hat OpenShift

Procedure

  1. In OpenShift, click ConfigMap.
  2. Modify your app-config-rhdh file to include the GitHub configuration as follows:

    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: app-config-rhdh
    data:
      app-config-rhdh.yaml: |
        app:
          title: Red Hat Developer Hub
        integrations:
          github:
            - host: github.com
              apps:
                - appId: ${GITHUB_APP_APP_ID}
                  clientId: ${GITHUB_APP_CLIENT_ID}
                  clientSecret: ${GITHUB_APP_CLIENT_SECRET}
                  webhookUrl: ${GITHUB_APP_WEBHOOK_URL}
                  webhookSecret: ${GITHUB_APP_WEBHOOK_SECRET}
                  privateKey: |
                    ${GITHUB_APP_PRIVATE_KEY}
        auth:
          # see https://backstage.io/docs/auth/ to learn about auth providers
          environment: development
          providers:
            github:
              development:
                clientId: ${GITHUB_APP_CLIENT_ID}
                clientSecret: ${GITHUB_APP_CLIENT_SECRET}
  3. Click Save.
  4. Create a key or value Secret file named rhdh-secrets using the environment variables as keys from the previous code snippet by following the steps below:

    1. In Red Hat OpenShift, go to the Secrets tab and click Create.
    2. Enter Secret name as rhdh-secrets.
    3. Add environment variables as Key and Value and click Create.
  5. To log in using your GitHub application, ensure that the Callback URL in your GitHub application is configured as follows:

    https://developer-hub-<NAMESPACE_NAME>.<OPENSHIFT_ROUTE_HOST>/api/auth/github/handler/frame

    In the previous example of Callback URL, OPENSHIFT_ROUTE_HOST is the API URL added into the Root Schema → global → clusterRouteBase field.

    The following is an example of the Callback URL:

    example callback url
    Note

    To access the GitHub security insights widget on the Overview page in Developer Hub, ensure that your GitHub application has Read-only Dependabot Alerts permissions.

  6. Navigate to the Helm tab and select Upgrade.
  7. Under Root Schema → Backstage Chart Schema → Backstage Parameters → Backstage container environment variables from existing Secrets, add rhdh-secrets as value.
  8. Click Upgrade.

3.2.2. Enabling GitHub discovery in Red Hat Developer Hub

You can enable GitHub discoverability for your components in Developer Hub, such as any repositories that contain catalog-info.yaml file.

Prerequisites

Procedure

  1. In Red Hat Openshift, go to the Helm tab and upgrade the Developer Hub release.
  2. Under global → Dynamic plugins configuration → List of dynamic plugins that should be installed in the backstage application. → Package specification of the dynamic plugin to install. It should be usable by the npm pack command., add the following value:

    ./dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-dynamic

    enable gh discovery
  3. Click Upgrade.
  4. Add the following code in the ConfigMap:

    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: app-config-rhdh
    data:
      app-config-rhdh.yaml: |
        ...
          catalog:
            providers:
              github:
                providerId:
                  organization: '${GITHUB_ORG}'
                schedule:
                  frequency:
                    minutes: 30
                  initialDelay:
                    seconds: 15
                  timeout:
                    minutes: 3
        ...

    In the previous code, replace ${GITHUB_ORG} with the GitHub organization from where you want to discover the components. Also, if there is a single provider, then following code can be added in the ConfigMap:

    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: app-config-rhdh
    data:
      app-config-rhdh.yaml: |
        ...
        catalog:
          providers:
            github:
              organization: ${GITHUB_ORG}
              schedule:
                frequency: { minutes: 1 }
                timeout: { minutes: 1 }
                initialDelay: { seconds: 100 }
        ...

    The providerId in the previous code is required to identify the provider when there is a list of them.

  5. Click Save.

3.2.3. Enabling GitHub organization member discovery in Red Hat Developer Hub

You can also enable GitHub discoverability for the members of your GitHub organization.

Prerequisites

Procedure

  1. In Red Hat Openshift, go to the Helm tab and upgrade the Developer Hub release.
  2. Under global → Dynamic plugins configuration → List of dynamic plugins that should be installed in the backstage application. → Package specification of the dynamic plugin to install. It should be usable by the npm pack command., add the following value:

    ./dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-org-dynamic

    enable gh member discovery
  3. Click Upgrade.
  4. Add the following code in the ConfigMap:

    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: app-config-rhdh
    data:
      app-config-rhdh.yaml: |
        ...
        catalog:
          providers:
            githubOrg:
              default:
                id: production
                orgUrl: '${GITHUB_ORG_URL}'
        ...

    In the previous code, replace ${GITHUB_ORG_URL} with the GitHub organization you want to ingest users from.

  5. Click Save.