Deprecated and will be removed shortly. Please see https://github.com/gnunn-gitops/product-catalog where development continues using ArgoCD for gitops
This is an OpenShift demo of a product catalog using React for the front-end with Quarkus providing APIs as the back-end. The back-end was originally written in PHP and then ported to Quarkus.
To run the demo locally on your laptop, you will need to have a MySQL or MariaDB database available. You will need to create a product database using the SQL in this repo and then update the quarkus application.properties file to reflect the location of the database.
To run the quarkus application, execute mvn quarkus:dev
from the root directory.
To run the client application, go into the client directory and run npm run start
.
To install the application in OpenShift, use the ansible-playbook in the ansible directory. Note that this playbook uses the k8s module so you will need to ensure you have it's pre-reqs installed.
Please follow these steps to install the demo:
- Update the vars/vars.yml file to reflect your cluster, specifically your wildcard domain if you don't it will not work!
- Login into your OpenShift cluster using the oc tool with the credentials you want the demo running under
- Switch to the ansible directory and run the following command:
ansible-playbook install.yml
Once the playbook has finished executing, a pipeline will build the images and deploy the client and server applications. If you go to the Developer console (4.2) and view the topology it will appear as follows:
When you install the demo, you have a choice to install it using Jenkins or Tekton for CI/CD. Note that Tekton is in tech preview and if you want to use it you must first install the OpenShift Pipelines operator.
To test the CI/CD, you can add a logo to the product catalog. The code to do this is commented out and can be found in the nav.jsx file.
Once you make the code change, start the client pipeline (Jenkins or Tekton). Note that in Tekton the GUI does not support creating a new PipelineRunTask with a workspace, if you want to drive it from a GUI go into the PipelineRuns and simple rerun an existing one.
You can provision the demo to use an enterprise registry such as quay.io. To do, set the use_enterprise_registry
to true and fill out the rest of the variables accordingly.
You will need to provide an registry_password
which is not included in the vars.yml, either add it, use an ansible vault or pass it on the command line:
ansible-playbook install.yml -e registry_password=XXXXX
To uninstall the demo, use the following:
ansible-playbook uninstall.yml