Skip to content

Commit b2eb525

Browse files
siddhivelankar23pre-commit-ci[bot]xiguiw
authored
struct2graph patch to resolve hardcoded url (#1705)
* patch additions Signed-off-by: siddhivelankar23 <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: siddhivelankar23 <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: xiguiw <[email protected]>
1 parent 60e9e5f commit b2eb525

File tree

7 files changed

+19
-6
lines changed

7 files changed

+19
-6
lines changed

comps/struct2graph/deployment/docker_compose/struct2graph-compose.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ services:
1212
- no_proxy=${no_proxy}
1313
- https_proxy=${https_proxy}
1414
- http_proxy=${http_proxy}
15-
- NEO4J_URL=${NEO4J_URL}
15+
- NEO4J_URL=bolt://neo4j-apoc:7687
16+
- NEO4J_USERNAME=neo4j
17+
- NEO4J_PASSWORD=neo4j_password
18+
- NEO4J_URI=bolt://neo4j-apoc:7687
1619
- NEO4J_server_directories_import=import
1720
- NEO4J_PLUGINS=["apoc"]
1821
- NEO4J_dbms_security_allow__csv__import__from__file__urls=true
1922
- NEO4J_server_directories_import='/var/lib/neo4j/import'
2023
- NEO4J_dbms_security_procedures_unrestricted=apoc.\\\* neo4j:5.23.0
24+
- STRUCT2GRAPH_PORT=${STRUCT2GRAPH_PORT:-8090}
2125
ports:
22-
- ${STRUCT2GRAPH_PORT:-8090}:8090
26+
- "${STRUCT2GRAPH_PORT:-8090}:8090"
2327
depends_on:
2428
neo4j-apoc:
2529
condition: service_healthy
@@ -30,7 +34,6 @@ services:
3034
retries: 10
3135
start_period: 30s
3236
ipc: host
33-
network_mode: host
3437
restart: always
3538

3639
networks:

comps/struct2graph/src/environment_setup.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ export DATA_DIRECTORY=${DATA_DIRECTORY:-data}
1919
export FILENAME=${FILENAME:-test1.csv}
2020
export LOAD_FORMAT=${LOAD_FORMAT:-"CSV"}
2121

22+
export STRUCT2GRAPH_PORT=${STRUCT2GRAPH_PORT:-8090}
23+
export NEO4J_URL=bolt://neo4j-apoc:7687
24+
export NEO4J_URI=bolt://neo4j-apoc:7687
25+
export NEO4J_PORT1=7474
26+
export NEO4J_PORT2=7687
27+
export NEO4J_HEALTH_URL="http://localhost:7474"
28+
2229

2330
export CYPHER_CSV_CMD="LOAD CSV WITH HEADERS FROM 'file:////test1.csv' AS row \
2431
CREATE (:Person {ID: toInteger(row.ID), Name: row.Name, Age: toInteger(row.Age), City: row.City});"

comps/struct2graph/src/integrations/opea.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ async def check_health(self) -> bool:
6161
"""
6262
try:
6363
logger.info("Performing health check...")
64-
response = requests.get("http://localhost:7474", timeout=5)
64+
neo4j_health_url = os.getenv("NEO4J_HEALTH_URL")
65+
response = requests.get(neo4j_health_url, timeout=5)
6566
if response.status_code == 200:
6667
return True
6768
else:

comps/struct2graph/src/opea_struct2graph_microservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
name="opea_service@struct2graph",
3131
endpoint="/v1/struct2graph",
3232
host="0.0.0.0",
33-
port=os.getenv("STRUCT2GRAPH_PORT"),
33+
port=int(os.getenv("STRUCT2GRAPH_PORT", "8090")),
3434
)
3535
async def execute_agent(input: Input):
3636
"""Execute triplet extraction from text file.

comps/struct2graph/src/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ langchain-community
66
langchain-neo4j
77
neo4j
88
numpy
9+
openai
910
opentelemetry-api
1011
opentelemetry-exporter-otlp
1112
opentelemetry-sdk

comps/third_parties/neo4j/deployment/docker_compose/compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ services:
1313
- ./data/neo4j/config:/config
1414
- ./data/neo4j/data:/data
1515
- ./data/neo4j/plugins:/plugins
16+
- ./data:/var/lib/neo4j/import
1617
ipc: host
1718
environment:
1819
- no_proxy=${no_proxy}

tests/struct2graph/test_struct2graph_opea.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WORKPATH=$(git rev-parse --show-toplevel)
66
echo $WORKPATH
77
TAG='latest'
88
LOG_PATH="$WORKPATH/comps/struct2graph/deployment/docker_compose"
9-
source $WORKPATH/comps/struct2graph/src/setup_service_env.sh
9+
source $WORKPATH/comps/struct2graph/src/environment_setup.sh
1010
STRUCT2GPAPH_PORT=8090
1111
ip_address=$(hostname -I | awk '{print $1}')
1212
service_name="struct2graph"

0 commit comments

Comments
 (0)