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
-
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
-
Verify or install cert-manager operator:
oc get csv -n cert-manager-operatorThis 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 SucceededInstall cert-manager operator if you don’t have it:
oc apply -f ./content/modules/ROOT/examples/lab-prep/cert-manager-operator.yaml -
Install GitLab operator in the
gitlab-systemnamespace:oc apply -f ./content/modules/ROOT/examples/lab-prep/gitlab-operator.yaml oc get csv -n gitlab-systemThis 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 -
Install Red Hat Developer Hub operator in the
rhdh-operatornamespace:oc apply -f ./content/modules/ROOT/examples/lab-prep/rhdh-operator.yaml oc get csv -n rhdh-operatorThis 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
-
Set the
BASEDOMAINenvironment 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 - -
Wait for GitLab Running phase:
oc get gitlabs gitlab -o jsonpath='{.status.phase}' -n gitlab-system -
Retrieve root password:
oc get secret gitlab-gitlab-initial-root-password -o jsonpath='{.data.password}' -n gitlab-system | base64 -dYou will need this password to setup GitLab in future steps. -
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:
In that case, execute the script with the |
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
-
Apply the base Backstage CR to deploy the Red Hat Developer Hub instance in the
rhdh-gitlabnamespace:oc apply -f ./content/modules/ROOT/examples/lab-prep/rhdh-instance.yaml -
Verify deployment status:
oc get backstage developer-hub -o jsonpath='{.status.conditions[0].type}' -n rhdh-gitlab -
Print the Red Hat Developer Hub URL:
echo https://$(oc get route backstage-developer-hub -n rhdh-gitlab -o jsonpath='{.spec.host}') -
Verify that Red Hat Developer Hub is running.