{"id":30188705,"url":"https://github.com/rhecosystemappeng/rec-sys-gitops","last_synced_at":"2026-04-06T03:02:30.007Z","repository":{"id":293246166,"uuid":"952031667","full_name":"RHEcosystemAppEng/rec-sys-gitops","owner":"RHEcosystemAppEng","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-10T08:42:13.000Z","size":8306,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-10T09:38:10.842Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RHEcosystemAppEng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-20T16:14:06.000Z","updated_at":"2025-06-10T08:42:18.000Z","dependencies_parsed_at":"2025-06-10T09:39:21.500Z","dependency_job_id":null,"html_url":"https://github.com/RHEcosystemAppEng/rec-sys-gitops","commit_stats":null,"previous_names":["rhecosystemappeng/rec-sys-gitops"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/RHEcosystemAppEng/rec-sys-gitops","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Frec-sys-gitops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Frec-sys-gitops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Frec-sys-gitops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Frec-sys-gitops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RHEcosystemAppEng","download_url":"https://codeload.github.com/RHEcosystemAppEng/rec-sys-gitops/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Frec-sys-gitops/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270108991,"owners_count":24528772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-12T17:46:03.558Z","updated_at":"2026-04-06T03:02:24.969Z","avatar_url":"https://github.com/RHEcosystemAppEng.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Retail Recommendation System Demo\n## Introduction\nThis deployment is based on the validated pattern framework, utilizing GitOps for seamless provisioning of all operators and applications. It deploys a Retail Recommendation System that leverages two-towe algorithm training technich to provide personalized item suggestions to customers, enhancing store sales by considering their preferences and demographics.\n\nThe pattern harnesses Red Hat OpenShift AI to deploy and serve recommendation at scale. It integrates the Feast Feature Store for feature management, EDB Postgres to store user and item embeddings, and a simple user interface (UI) to facilitate customer interactions with the system. Running on Red Hat OpenShift, this demo showcases a scalable, enterprise-ready solution for retail recommendations.\n## Pre-requisites\n\n- Podman\n- Red Hat Openshift cluster running in AWS. Supported regions are : us-east-1 us-east-2 us-west-1 us-west-2 ca-central-1 sa-east-1 eu-west-1 eu-west-2 eu-west-3 eu-central-1 eu-north-1 ap-northeast-1 ap-northeast-2 ap-northeast-3 ap-southeast-1 ap-southeast-2 ap-south-1.\n- GPU Node to run Hugging Face Text Generation Inference server on Red Hat OpenShift cluster.\n- Create a fork of the \u003cTODO add link for the repo after moving it to VP project\u003e git repository.\n\n## Demo Description \u0026 Architecture\n### Key Features\n* UI: Allows users to browse recommendations, add items to cart, purchase, or rate products.\n* Feast Feature Store: Manages and serves features for training and real-time inference.\n* EDB Postgres with PGVector: Stores user and item embeddings, enabling fast similarity searches.\n* Kafka Integration: Records user interactions for continuous learning and dataset updates.\n* Red Hat OpenShift AI\n* Two-Tower Architecture: Utilizes separate neural networks to generate user and item embeddings for personalized recommendations.\n\u003c!-- * Monitoring Dashboard: Provides performance metrics using Prometheus and Grafana.\n* GitOps Deployment: Ensures an end-to-end, reproducible setup of the demo. --\u003e\n\n### Serving\n\u003cimg src=\"images/inference.png\" alt=\"Training \u0026 Batch scoring\" width=\"80%\"\u003e\n\nUsers can interact with the user interface to view items, add items to their cart, make purchases, or submit reviews.\n\nEach user interaction is sent to a Kafka queue to be saved for training. Since we use a batch recommendation system, the suggested items are already computed during training, and we only need to perform a get operation on the dataset to retrieve the user’s suggestions.\n\n### Workflow\n\nThe workflow consists of the following steps:\n\n1. Data Ingestion\n* Data originates from parquet files containing users, items, and interactions.\n* Feast scans feature definitions, validates them, and syncs metadata to its registry.\n\n2. Training - using the Two-Tower algorithm:\n\n![InGestion and Training](images/Data_ingestion_and_training.drawio.png)\n\nWe have two encoders:\n* User Tower: Encodes user features (age, gender, preference, ...) into embedding.\n* Item Tower: Encodes item features (category, price, ...) into embedding.\n  \nFor each interaction, positive or negative, train the encoders in such a way that positive interactions bring the item and the user closer in cosine similarity in the embedding space, and negative interactions move the user and the item embeddings farther apart.\n\n3. Batch Scoring \u0026 Materialization\n\n![Batch Scoring](images/high_level_batch_scoring.drawio.png)\n\n* Generates embeddings for all users and items using trained encoders.\n* Computes the latest feature values and precomputes top-k recommendations for each user.\n* Stores results in the online store for fast retrieval.\n\n### Components Deployed\n* Recommendation UI: A simple web application for users to interact with recommendations.\n* Kafka \u0026 Kafka connect: ingest user interaction with items from the ui and sent them to Kafka, kafka connect move this intercation events into a EDB database.\n* Feast Feature Store: Manages feature definitions and serves data for training and inference.\n* EDB Postgres with PGVector: Acts as online (real-time embeddings) stores.\n* Kubeflow job: A batch job that train the user and item encoders, then genrate the data generates embeddings into the vector database.\n\n## Deploying the demo\n\nTo run the demo, ensure the Podman is running on your machine.Fork the [rec-sys-gitops](https://github.com/validatedpatterns/rec-sys-gitops) repo into your organization\n\n### Login to OpenShift cluster\n\nReplace the token and the api server url in the command below to login to the OpenShift cluster.\n\n```sh\noc login --token=\u003ctoken\u003e --server=\u003capi_server_url\u003e # login to Openshift cluster\n```\n\n### Cloning repository\n\n```sh\ngit clone https://github.com/\u003c\u003cyour-username\u003e\u003e/rec-sys-gitops.git\ncd rec-sys-gitops\n```\n\n\u003c!-- ### Configuring model\n\nThis pattern deploys [IBM Granite 3.1-8B-Instruct](https://huggingface.co/ibm-granite/granite-3.1-8b-instruct) out of box. Run the following command to configure vault with the model Id.\n\n```sh\n# Copy values-secret.yaml.template to ~/values-secret-rag-llm-gitops.yaml.\n# You should never check-in these files\n# Add secrets to the values-secret.yaml that needs to be added to the vault.\ncp values-secret.yaml.template ~/values-secret-rag-llm-gitops.yaml\n```\n\nTo deploy a model that can requires an Hugging Face token, grab the [Hugging Face token](https://huggingface.co/settings/tokens) and accept the terms and conditions on the model page. Edit ~/values-secret-rag-llm-gitops.yaml to replace the `model Id` and the `Hugging Face` token.\n\n```sh\nsecrets:\n  - name: hfmodel\n    fields:\n    - name: hftoken\n      value: null\n    - name: modelId\n      value: \"ibm-granite/granite-3.1-8b-instruct\"\n  - name: minio\n    fields:\n    - name: MINIO_ROOT_USER\n      value: minio\n    - name: MINIO_ROOT_PASSWORD\n      value: null\n      onMissingValue: generate\n``` --\u003e\n\n\u003c!-- ### Provision GPU MachineSet\n\nAs a pre-requisite to deploy the application using the validated pattern, GPU nodes should be provisioned along with Node Feature Discovery Operator and NVIDIA GPU operator. To provision GPU Nodes\n\nFollowing command will take about 5-10 minutes.\n\n```sh\n./pattern.sh make create-gpu-machineset\n```\n\nWait till the nodes are provisioned and running.\n\n![Diagram](images/nodes.png)\n\nAlternatiely, follow the [instructions](./GPU_provisioning.md) to manually install GPU nodes, Node Feature Discovery Operator and NVIDIA GPU operator. --\u003e\n\n\u003c!-- ### Deploy application\n\n***Note:**: This pattern supports two types of vector databases, EDB Postgres for Kubernetes and Redis. By default the pattern will deploy EDB Postgres for Kubernetes as a vector DB. To deploy Redis, change the global.db.type to REDIS in [values-global.yaml](./values-global.yaml).\n\n```yaml\n---\nglobal:\n  pattern: rag-llm-gitops\n  options:\n    useCSV: false\n    syncPolicy: Automatic\n    installPlanApproval: Automatic\n# Possible value for db.type = [REDIS, EDB]\n  db:\n    index: docs\n    type: EDB  # \u003c--- Default is EDB, Change the db type to REDIS for Redis deployment\nmain:\n  clusterGroupName: hub\n  multiSourceConfig:\n    enabled: true\n``` --\u003e\n\nFollowing commands will take about 15-20 minutes\n\n### Deploying the pattern\n\n```sh\n./pattern.sh make install\n```\n\n### 1: Verify the installation\n\n- Login to the OpenShift web console.\n- Navigate to the Workloads --\u003e Pods.\n- Select the `rec-sys` project from the drop down.\n- Following pods should be up and running.\n\n\u003cTODO\u003e\n\n\n### 2: Launch the application\n\n\u003cTODO\u003e\n\n### 3: Run the training workflow\n\u003cTODO\u003e\n\n### 4: Use the UI to get recommendations\n\u003cTODO\u003e\n\n## Licenses\n\nEDB Postgres for Kubernetes is distributed under the EDB Limited Usage License\nAgreement, available at [enterprisedb.com/limited-use-license](https://www.enterprisedb.com/limited-use-license).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhecosystemappeng%2Frec-sys-gitops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhecosystemappeng%2Frec-sys-gitops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhecosystemappeng%2Frec-sys-gitops/lists"}