Skip to content

Latest commit

 

History

History
141 lines (125 loc) · 5.61 KB

README.adoc

File metadata and controls

141 lines (125 loc) · 5.61 KB

Backstage Workshop featuring RHDH and GitHub

To learn about the Software Templates that were used in this workshop, explore the scaffolder-templates folder. For additional Template examples, see https://github.com/janus-idp/software-templates

Workshop Cluster Setup

To set up your own workshop cluster, implement the following changes to the demo-setup installation process:

  1. First, create a checkout of this workshop branch (instead of using the janus-idp/demo-setup repo):

    git clone https://github.com/ryanj/janus-platforms.git
    cd janus-platforms/ansible/cluster-setup
    git checkout workshop
  2. Next, fork this repo while setting the owner input to your new github org, and the name of the new repo to: software-templates

  3. Then, complete the rest of the demo-setup installation process (while skipping the optional quay section). That doc will instruct you to export several variables that will be used in the upcoming example commands

  4. Create another OAuth app to provide GitHub Auth into the Openshift cluster:

    open "https://github.com/organizations/$GITHUB_ORGANIZATION/settings/applications/new/?oauth_application[name]=$GITHUB_ORGANIZATION-auth&oauth_application[url]=https://oauth-openshift.apps$OPENSHIFT_CLUSTER_INFO&oauth_application[callback_url]=https://oauth-openshift.apps$OPENSHIFT_CLUSTER_INFO/oauth2callback/github"
  5. Configure your new GitHub OAuth App’s client id and secret, and include your gh org in the list of approved orgs:

    open "https://console-openshift-console.apps$OPENSHIFT_CLUSTER_INFO/settings/idp/github"
  6. Change the Base permissions for all repos to "Write"

    open "https://github.com/organizations/$GITHUB_ORGANIZATION/settings/member_privileges/"
  7. Install the CoP Namespace Configuration Operator from OperatorHub:

    oc new-project namespace-configuration-operator
    oc create -f https://raw.githubusercontent.com/redhat-cop/namespace-configuration-operator/master/config/operatorhub/operator.yaml
    # wait for the operator installation to complete...
    sleep 60
    cat <<EOF | oc create -f -
    kind: UserConfig
    apiVersion: redhatcop.redhat.io/v1alpha1
    metadata:
      name: test-user-config
    spec:
      annotationSelector: {}
      identityExtraFieldSelector: {}
      labelSelector: {}
      providerName: github
      templates:
        - excludedPaths:
            - .spec.replicas
            - .metadata
            - .status
          objectTemplate: |
            - apiVersion: project.openshift.io/v1
              kind: Project
              metadata:
                name: {{ .Name }}
            - apiVersion: rbac.authorization.k8s.io/v1
              kind: RoleBinding
              metadata:
                name: {{ .Name }}-rolebinding
                namespace: {{ .Name }}
              roleRef:
                apiGroup: rbac.authorization.k8s.io
                kind: ClusterRole
                name: admin
              subjects:
              - apiGroup: rbac.authorization.k8s.io
                kind: User
                name: {{ .Name }}
    EOF
  8. Increase cluster capacity by scaling up machineSets (if needed):

    open "https://console-openshift-console.apps$OPENSHIFT_CLUSTER_INFO/k8s/ns/openshift-machine-api/machine.openshift.io~v1beta1~MachineSet"
  9. Switch from Janus to RHDH (see below)

  10. Invite users to your github org:

    open "https://github.com/orgs/$GITHUB_ORGANIZATION/people"
  11. Distribute the following onboarding information to each workshop attendee:

    echo "Attendee invite: https://github.com/orgs/$GITHUB_ORGANIZATION/invitation" &&
    echo "Workshop Instructions: https://bit.ly/rhdh-workshop" &&
    echo "Cluster URL: https://console-openshift-console.apps$OPENSHIFT_CLUSTER_INFO"
    Warning
    Workshop users need to accept their org invitation before accessing the cluster

Janus to RHDH

To switch to the latest RHDH image, you will need to complete the following:

  1. Request access to the following quay repo via email: quay.io/rhdh/developer-hub-rhel9. Requests from Internal Red Hatters should be sent to [email protected]. Requests from customers should be sent to [email protected].

  2. After gaining access to the quay repo. Visit https://quay.io and click on Profile → Account Settings → Robot Accounts → Create Robot Account

  3. Name the Robot Account "rhdh_pull_secret".

  4. Open your robot account and select the "Kubernetes Secret" tab. Download your pull secret yaml.

  5. Edit your pull secret yaml, setting the pull secret’s metadata.name field to: rhdh-pull-secret

  6. Install your pull secret in the backstage namespace:

    kubectl create -f secret.yaml -n backstage
  7. Update the janus deployment to reference the new image pull secret:

    kubectl patch deploy/janus-dev -n backstage -p '{"spec":{"template":{"spec":{"imagePullSecrets":[{"name":"rhdh-pull-secret"}],"containers":[{"name":"janus-backstage","image":"quay.io/rhdh/developer-hub-rhel9:0.1"}]}}}}'

Workshop Content Development

workshop content is available at: https://redhat-scholars.github.io/backstage-workshop

Local Development with Gulp

Install local development dependencies via npm:

npm install

Launch a local development server:

npm start

Promoting your changes

Add and commit your changes, then run git push to trigger a new deployment:

git push origin master