This documentation has been tested on CRC (CodeReady Containers) Version 1.7 which includes OpenShift 4.3.1, and on Red Hat OpenShift 4.3 on IBM Cloud (currently in Beta).
You also find a hands-on workshop documentation, for pre-provisioned RedHat OpenShift clusters, here
Start with these 2 documents to create and get access to an OpenShift 4 environment, but make sure to come back here. Do not follow the links at the end of these instructions ("Continue with ...")!
- Get access to an OpenShift cluster Note: Don't continue with the Istio installation, Istio is currently not required! Continue here:
- Requirements for Cloud Native Starter on OpenShift Note: Don't follow the "Continue with ..." link at the end of this document, instead return here and continue with the next section!
The following script will inform about missing tools:
$ cd ${ROOT_FOLDER}/reactive
$ ROOT_FOLDER=$(pwd)
$ sh os4-scripts/check-prerequisites.sh
We will install Kafka via a script using the Strimzi operator:
$ sh os4-scripts/deploy-kafka.sh
This script will
- Create a project kafka in OpenShift
- Install the "strimzi-cluster-operator"
- Deploy the "my-cluster-entity-operator"
- Deploy Kafka (3 pods my-cluster-zookeeper, 3 pods my-cluster-kafka)
We will install PostgreSQL using the Dev2Devs operator in the OpenShift Web Console
- Login to/open the OpenShift Web Console (
crc console
). - In the 'Administrator' view, in 'Home' -> 'Projects' create a new project 'postgres'.
- In the 'Administrator' view, in 'Operators' -> 'OperatorHub' filter for 'postgres'. Note: If you don't see the 'Operator' menu, refresh your browser.
- Click on 'PostgreSQL Operator by Dev4Ddevs.com', continue on the 'Show Community Operator' dialog, then click 'Install'.
- 'Installation Mode' is 'A specific namespace on the cluster', namespace is the 'postgres' project. All else should remain default. Click 'Subscribe'.
- In the 'Installed Operators' view in project 'postgres' wait until the status of the 'PostgreSQL Operator by Dev4Ddevs.com' shows a green checkmark and 'InstallSucceeded'.
- Click on the operator name, then click 'Create Instance' for the 'Database Database' API.
- In the YAML file change 'metadata.name' from 'database' to 'database-articles'. Make sure 'metadata.namespace' is 'postgres'. Click 'Create'.
- Go to 'Administrator' view, 'Workloads' -> 'Pods' and check that you see two Running pods, one for database and one for the operator.
$ cd ${ROOT_FOLDER}
$ sh os4-scripts/deploy-articles-reactive-postgres.sh
$ sh os4-scripts/deploy-authors.sh
$ sh os4-scripts/deploy-web-api-reactive.sh
$ sh os4-scripts/deploy-web-app-reactive.sh
$ sh os4-scripts/show-urls.sh
- To see an example, open the web-app service in your browser.
- Then create a new article, either with the API explorer of the articles-reactive service or the respective curl command. (See the output of 'show-urls.sh' for the URL and the curl sample.) Every time you create a new article, the articles list of the web app will automatically show the newest 5 articles.
To delete the project including Kafka and Postgres from OpenShift, run:
$ cd ${ROOT_FOLDER}
$ sh os4-scripts/cleanup.sh