Environment setup

Before configuring Red Hat Developer Hub, install the operators and base platform services on OpenShift. This module prepares cert-manager, GitLab, and the Red Hat Developer Hub operator, then deploys an initial Developer Hub instance in the rhdh-gitlab namespace.

Set up your local environment

Cloning this repository will give you access to the examples and the workshop content to run into your OpenShift cluster:

mkdir -p ~/workshops
cd ~/workshops
git clone https://github.com/rmarting/rhdh-exercises.git

Login OpenShift

  1. Using the admin credentials provided for your environment, login to the OpenShift:

    oc login -u admin --server=<OPENSHIFT_API_URL>
Replace <OPENSHIFT_API_URL> with the actual API URL provided for your environment.

Install platform operators

  1. Verify or install cert-manager operator:

    oc get csv -n cert-manager-operator

    This output should show the Cert Manager operator is already installed.

    NAME                            DISPLAY                                       VERSION   REPLACES                        PHASE
    cert-manager-operator.v1.19.0   cert-manager Operator for Red Hat OpenShift   1.19.0    cert-manager-operator.v1.18.1   Succeeded

    Install cert-manager operator if you don’t have it:

    oc apply -f ./content/modules/ROOT/examples/lab-prep/cert-manager-operator.yaml
  2. Install GitLab operator in the gitlab-system namespace:

    oc apply -f ./content/modules/ROOT/examples/lab-prep/gitlab-operator.yaml
    oc get csv -n gitlab-system

    This should be the output after the operator installation:

    NAME                                DISPLAY   VERSION   REPLACES                            PHASE
    gitlab-operator-kubernetes.v3.0.1   GitLab    3.0.1     gitlab-operator-kubernetes.v3.0.0   Succeeded
  3. Install Red Hat Developer Hub operator in the rhdh-operator namespace:

    oc apply -f ./content/modules/ROOT/examples/lab-prep/rhdh-operator.yaml
    oc get csv -n rhdh-operator

    This should be the output after the operator installation:

    NAME                   DISPLAY                          VERSION   REPLACES               PHASE
    rhdh-operator.v1.9.4   Red Hat Developer Hub Operator   1.9.4     rhdh-operator.v1.9.3   Succeeded

Deploy and configure GitLab

  1. Set the BASEDOMAIN environment variable and deploy GitLab:

    export BASEDOMAIN=$(oc get ingresscontroller -n openshift-ingress-operator default -o jsonpath='{.status.domain}')
    envsubst < ./content/modules/ROOT/examples/lab-prep/gitlab.yaml | oc apply -f -
  2. Wait for GitLab Running phase:

    oc get gitlabs gitlab -o jsonpath='{.status.phase}' -n gitlab-system
  3. Retrieve root password:

    oc get secret gitlab-gitlab-initial-root-password -o jsonpath='{.data.password}' -n gitlab-system | base64 -d
    You will need this password to setup GitLab in future steps.
  4. Run GitLab bootstrap script:

    ./content/modules/ROOT/examples/lab-prep/configure-gitlab.sh

The initial configuration requires to push some content into GitLab, you should use the user1 credentials to do it.

If GitLab is deployed using self-signed certificates, you can get the following exception:

SSL certificate problem: self-signed certificate in certificate chain

In that case, execute the script with the --ssl_certs_self_signed=y argument.

This script will do the following:

Create different groups:

- team-a
- team-b
- rhdh

Create two users/passwords:

- user1/@abc1cde2
- user2/@abc1cde2

Ensure `user1` belongs to `team-a` and `user2` belongs to `team-b`.

Create a repo called `sample-app` under `team-a` add the `catalog-info.yaml` and `users-groups.yaml` at the root of the repo.

Deploy Red Hat Developer Hub instance

  1. Apply the base Backstage CR to deploy the Red Hat Developer Hub instance in the rhdh-gitlab namespace:

    oc apply -f ./content/modules/ROOT/examples/lab-prep/rhdh-instance.yaml
  2. Verify deployment status:

    oc get backstage developer-hub -o jsonpath='{.status.conditions[0].type}' -n rhdh-gitlab
  3. Print the Red Hat Developer Hub URL:

    echo https://$(oc get route backstage-developer-hub -n rhdh-gitlab -o jsonpath='{.spec.host}')
  4. Verify that Red Hat Developer Hub is running.

Learning outcomes

By completing this module, you should understand:

  • How to install cert-manager, GitLab, and Red Hat Developer Hub operators

  • How to deploy GitLab and run initial group/user/repository setup

  • How to deploy a base Backstage CR and verify the Red Hat Developer Hub route