|
| 1 | +:_content-type: PROCEDURE |
| 2 | +:imagesdir: ../../../images |
| 3 | + |
| 4 | +[id="deploying-retail-pattern"] |
| 5 | += Deploying the retail pattern |
| 6 | + |
| 7 | +.Prerequisites |
| 8 | + |
| 9 | +* An OpenShift cluster |
| 10 | + ** To create an OpenShift cluster, go to the https://console.redhat.com/[Red Hat Hybrid Cloud console]. |
| 11 | + ** Select *Services \-> Containers \-> Create cluster*. |
| 12 | + ** The cluster must have a dynamic `StorageClass` to provision `PersistentVolumes`. See link:../../multicloud-gitops/mcg-cluster-sizing[sizing your cluster]. |
| 13 | +* Optional: A second OpenShift cluster for multicloud demonstration. |
| 14 | +//Replaced git and podman prereqs with the tooling dependencies page |
| 15 | +* https://validatedpatterns.io/learn/quickstart/[Install the tooling dependencies]. |
| 16 | + |
| 17 | +The use of this pattern depends on having at least one running Red Hat OpenShift cluster. However, consider creating a cluster for deploying the GitOps management hub assets and a separate cluster for the managed cluster. |
| 18 | + |
| 19 | +If you do not have a running Red Hat OpenShift cluster, you can start one on a public or private cloud by using https://console.redhat.com/openshift/create[Red Hat Hybrid Cloud Console]. |
| 20 | + |
| 21 | +.Procedure |
| 22 | + |
| 23 | +. Fork the https://github.com/validatedpatterns/retail[retail] repository on GitHub. |
| 24 | + |
| 25 | +. Clone the forked copy of this repository. |
| 26 | ++ |
| 27 | +[source,terminal] |
| 28 | +---- |
| 29 | +git clone [email protected]:your-username/retail.git |
| 30 | +---- |
| 31 | + |
| 32 | +. Create a local copy of the secret values file that can safely include credentials. Run the following commands: |
| 33 | ++ |
| 34 | +[source,terminal] |
| 35 | +---- |
| 36 | +cp values-secret.yaml.template ~/values-secret.yaml |
| 37 | +---- |
| 38 | + |
| 39 | +. Edit `values-secret.yaml` populating with your quay `username` and `password`. |
| 40 | ++ |
| 41 | +[source,yaml] |
| 42 | +--- |
| 43 | +# NEVER COMMIT THESE VALUES TO GIT |
| 44 | +version: "2.0" |
| 45 | +secrets: |
| 46 | + # These are credentials to allow you to push to your image registry (quay.io) for application images |
| 47 | + - name: imageregistry |
| 48 | + fields: |
| 49 | + # eg. Quay -> Robot Accounts -> Robot Login |
| 50 | + - name: username |
| 51 | + value: "my-quay-username" |
| 52 | + - name: password |
| 53 | + value: "my-quay-password" |
| 54 | +---- |
| 55 | ++ |
| 56 | +[WARNING] |
| 57 | +==== |
| 58 | +Do not commit this file. You do not want to push personal credentials to GitHub. |
| 59 | +==== |
| 60 | +
|
| 61 | +. Customize the deployment for your cluster by following these steps: |
| 62 | +
|
| 63 | +.. Create a new branch named my-branch and switch to it by running the following command: |
| 64 | ++ |
| 65 | +[source,terminal] |
| 66 | +---- |
| 67 | +$ git switch -c my-branch |
| 68 | +---- |
| 69 | +
|
| 70 | +.. Edit the `values-hub.yaml` file to customize the deployment for your cluster by running the following command: |
| 71 | ++ |
| 72 | +[source,terminal] |
| 73 | +---- |
| 74 | +$ vi values-global.yaml |
| 75 | +---- |
| 76 | ++ |
| 77 | +The values that you need to change are under the `imageregistry` key, to use your own account and hostname. If you like, you can change the `git` settings of `account`, `email` and `hostname` to reflect your own account settings. |
| 78 | +
|
| 79 | +If you plan to customize the build of the applications themselves, there are `revision` and `imageTag` settings for each of them. The defaults should suffice if you just want to see the apps running. |
| 80 | +
|
| 81 | +.. Stage the changes to the `values-hub.yaml` file by running the following commands: |
| 82 | ++ |
| 83 | +[source,terminal] |
| 84 | +---- |
| 85 | +$ git add values-global.yaml |
| 86 | +---- |
| 87 | +
|
| 88 | +.. Commit the changes to the `values-hub.yaml` file by running the following commands: |
| 89 | ++ |
| 90 | +[source,terminal] |
| 91 | +---- |
| 92 | +$ git commit -m "update deployment for my-branch" |
| 93 | +---- |
| 94 | +
|
| 95 | +.. Push the changes to the `values-global.yaml` file by running the following command: |
| 96 | ++ |
| 97 | +[source,terminal] |
| 98 | +---- |
| 99 | +$ git push origin my-branch |
| 100 | +---- |
| 101 | +
|
| 102 | +. Deploy the pattern by running `./pattern.sh make install` or by using the link:/infrastructure/using-validated-pattern-operator/[Validated Patterns Operator]. |
| 103 | +
|
| 104 | +[id="deploying-cluster-using-patternsh-file"] |
| 105 | +== Deploying the pattern by using the pattern.sh script |
| 106 | +
|
| 107 | +To deploy the pattern by using the `pattern.sh` script, complete the following steps: |
| 108 | +
|
| 109 | +. Log in to your cluster by running the following: |
| 110 | +
|
| 111 | +.. Obtain an API token by visiting https://oauth-openshift.apps.<your-cluster>.<domain>/oauth/token/request |
| 112 | +
|
| 113 | +.. Log in with this retrieved token by running the following command: |
| 114 | ++ |
| 115 | +[source,terminal] |
| 116 | +---- |
| 117 | +$ oc login --token=<retrieved-token> --server=https://api.<your-cluster>.<domain>:6443 |
| 118 | +---- |
| 119 | +
|
| 120 | +. Alternatively log in by running the following command: |
| 121 | ++ |
| 122 | +[source,terminal] |
| 123 | +---- |
| 124 | +$ export KUBECONFIG=~/<path_to_kubeconfig> |
| 125 | +---- |
| 126 | +
|
| 127 | +. Deploy the pattern to your cluster by running the following command: |
| 128 | ++ |
| 129 | +[source,terminal] |
| 130 | +---- |
| 131 | +$ ./pattern.sh make install |
| 132 | +---- |
| 133 | +
|
| 134 | +[id="verify-trvlops-pattern-install"] |
| 135 | +== Verify the retail pattern installation |
| 136 | +
|
| 137 | +. Verify that the Operators have been installed. |
| 138 | +
|
| 139 | + .. To verify, in the OpenShift Container Platform web console, navigate to *Operators → Installed Operators* page. |
| 140 | +
|
| 141 | + .. Set your project to `All Projects` and verify the operators are installed and have a status of `Succeeded`. |
| 142 | + + |
| 143 | + link:/images/retail/retail-v1-operators.png[image:/images/retail/retail-v1-operators.png[retail-v1-operators]] |
| 144 | +
|
| 145 | +. Track the progress through the Hub ArgoCD UI from the nines menu.: |
| 146 | ++ |
| 147 | +link:/images/retail/retail-v1-console-menu.png[image:/images/retail/retail-v1-console-menu.png[retail-v1-console-menu]] |
| 148 | +
|
| 149 | +Ensure that the Hub ArgoCD instance shows all of its apps in Healthy and Synced status once all of the images have been built: |
| 150 | ++ |
| 151 | +link:/images/retail/retail-v1-argo-apps-p1.png[image:/images/retail/retail-v1-argo-apps-p1.png[retail-v1-argo-apps-p1]] |
| 152 | +
|
| 153 | +. Check on the pipelines, if you chose to run them. They should all complete successfully: |
| 154 | ++ |
| 155 | +link:/images/retail/retail-v1-pipelines.png[image:/images/retail/retail-v1-pipelines.png[retail-v1-pipelines]] |
| 156 | +
|
| 157 | +. Go to the *Quarkus Coffeeshop Landing Page* where you are presented with the applications in the pattern: |
| 158 | ++ |
| 159 | +link:/images/retail/retail-v1-landing-page.png[image:/images/retail/retail-v1-landing-page.png[retail-v1-landing-page]] |
| 160 | +
|
| 161 | +. Click the *Store Web Page* to open the Quarkus Coffeeshop Demo: |
| 162 | ++ |
| 163 | +link:/images/retail/retail-v1-store-page.png[image:/images/retail/retail-v1-store-page.png[retail-v1-store-page]] |
| 164 | +
|
| 165 | +. Click the *TEST Store Web Page* to open a separate copy of the same demo. |
| 166 | +
|
| 167 | +. Clicking the respective *Kafdrop* links to go to a Kafdrop instance that allows inspection of each of the respective environments. |
| 168 | ++ |
| 169 | +link:/images/retail/retail-v1-kafdrop.png[image:/images/retail/retail-v1-kafdrop.png[retail-v1-kafdrop]] |
0 commit comments