Skip to content

Commit ec66b91

Browse files
Feedback management microservice refactor (#1057)
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
1 parent 962e097 commit ec66b91

File tree

15 files changed

+22
-14
lines changed

15 files changed

+22
-14
lines changed

.github/workflows/docker/compose/feedback_management-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
services:
66
feedbackmanagement:
77
build:
8-
dockerfile: comps/feedback_management/mongo/Dockerfile
8+
dockerfile: comps/feedback_management/src/Dockerfile
99
image: ${REGISTRY:-opea}/feedbackmanagement:${TAG:-latest}

comps/feedback_management/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ The Feedback Management microservice able to support various database backends f
1919

2020
### Feedback Management with MongoDB
2121

22-
For more detail, please refer to this [README](./mongo/README.md)
22+
For more detail, please refer to this [README](./src/README.md)

comps/feedback_management/deployment/kubernetes/README.md

Whitespace-only changes.

comps/feedback_management/mongo/Dockerfile renamed to comps/feedback_management/src/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ COPY comps /home/user/comps
2020
COPY requirements.txt /home/user/
2121

2222
RUN pip install --no-cache-dir --upgrade pip setuptools && \
23-
pip install --no-cache-dir -r /home/user/comps/feedback_management/mongo/requirements.txt && \
23+
pip install --no-cache-dir -r /home/user/comps/feedback_management/src/requirements.txt && \
2424
pip install --no-cache-dir -r /home/user/requirements.txt
2525

2626
ENV PYTHONPATH=$PYTHONPATH:/home/user
2727

28-
WORKDIR /home/user/comps/feedback_management/mongo
28+
WORKDIR /home/user/comps/feedback_management/src
2929

30-
ENTRYPOINT ["python", "feedback.py"]
30+
ENTRYPOINT ["python", "opea_feedback_microservice.py"]

comps/feedback_management/mongo/README.md renamed to comps/feedback_management/src/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export COLLECTION_NAME=${COLLECTION_NAME}
2323

2424
```bash
2525
cd ~/GenAIComps
26-
docker build -t opea/feedbackmanagement-mongo-server:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/feedback_management/mongo/Dockerfile .
26+
docker build -t opea/feedbackmanagement:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/feedback_management/src/Dockerfile .
2727
```
2828

2929
### Run Docker with CLI
@@ -37,7 +37,7 @@ docker build -t opea/feedbackmanagement-mongo-server:latest --build-arg https_pr
3737
- Run Feedback Management microservice
3838

3939
```bash
40-
docker run -d --name="feedbackmanagement-mongo-server" -p 6016:6016 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/feedbackmanagement-mongo-server:latest
40+
docker run -d --name="feedbackmanagement-mongo-server" -p 6016:6016 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/feedbackmanagement:latest
4141
```
4242

4343
---
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0

comps/feedback_management/mongo/mongo_store.py renamed to comps/feedback_management/src/feedback_store.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import bson.errors as BsonError
55
from bson.objectid import ObjectId
6-
from config import COLLECTION_NAME
7-
from mongo_conn import MongoClient
6+
from integrations.mongo.config import COLLECTION_NAME
7+
from integrations.mongo.mongo_conn import MongoClient
88

99

1010
class FeedbackStore:
@@ -15,8 +15,9 @@ def __init__(
1515
):
1616
self.user = user
1717

18-
def initialize_storage(self) -> None:
19-
self.db_client = MongoClient.get_db_client()
18+
def initialize_storage(self, db_type="mongo") -> None:
19+
if db_type == "mongo":
20+
self.db_client = MongoClient.get_db_client()
2021
self.collection = self.db_client[COLLECTION_NAME]
2122

2223
async def save_feedback(self, feedback_data) -> str:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0

0 commit comments

Comments
 (0)