Skip to content

Commit 4613ff7

Browse files
authored
Revert back to single-app mode (#201)
* Switch back to single app for now * mark the java startup script as executable * only try to restart an app we have installed * run java on 8080 always * use a separate env var for the metadata app port
1 parent b8d511c commit 4613ff7

File tree

9 files changed

+83
-38
lines changed

9 files changed

+83
-38
lines changed

.project-metadata.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,6 @@ tasks:
4545
entity_label: refresh_project
4646
short_summary: Run job to refresh the project from source and rebuilding.
4747

48-
- type: start_application
49-
name: RagStudioQdrant
50-
subdomain: ragstudioqdrant
51-
bypass_authentication: false
52-
static_subdomain: false
53-
script: scripts/startup_qdrant.py
54-
short_summary: Create and start RagStudio's Qdrant instance.
55-
long_summary: Create and start RagStudio Qdrant instance.
56-
cpu: 2
57-
memory: 4
58-
environment_variables:
59-
TASK_TYPE: START_APPLICATION
60-
61-
- type: start_application
62-
name: RagStudioMetadata
63-
subdomain: ragstudiometadata
64-
bypass_authentication: false
65-
static_subdomain: false
66-
script: scripts/startup_metadata_app.py
67-
short_summary: Create and start RagStudio's Metadata API instance.
68-
long_summary: Create and start RagStudio Metadata API instance.
69-
cpu: 2
70-
memory: 4
71-
environment_variables:
72-
TASK_TYPE: START_APPLICATION
73-
7448
- type: start_application
7549
name: RagStudio
7650
subdomain: ragstudio

backend/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ otel.metrics.exporter=none
5454
otel.traces.exporter=none
5555

5656
server.address=${API_HOST:127.0.0.1}
57-
server.port=${CDSW_APP_PORT:8080}
57+
server.port=${METADATA_APP_PORT:8080}

docs/allow_list.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,24 @@ Node 22:
77
https://nodejs.org/dist/v22.15.0/node-v22.15.0-darwin-arm64.tar.xz
88

99
RAG Studio artifacts:
10-
https://github.com/cloudera/CML_AMP_RAG_Studio/releases/latest/download
10+
# note: these first 3 redirect to the specific release url (eg. releases/download/1.16.0/...)
11+
https://github.com/cloudera/CML_AMP_RAG_Studio/releases/latest/download/rag-api.jar
12+
https://github.com/cloudera/CML_AMP_RAG_Studio/releases/latest/download/fe-dist.tar.gz
13+
https://github.com/cloudera/CML_AMP_RAG_Studio/releases/latest/download/node-dist.tar.gz
14+
https://github.com/cloudera/CML_AMP_RAG_Studio/releases/download/model_download/craft_mlt_25k.pth
15+
https://github.com/cloudera/CML_AMP_RAG_Studio/releases/download/model_download/latin_g2.pth
1116

1217
Qdrant:
1318
https://github.com/qdrant/qdrant/releases/download/v1.11.3/qdrant-x86_64-unknown-linux-musl.tar.gz
1419

1520
Java:
1621
https://corretto.aws/downloads/latest/amazon-corretto-21-x64-linux-jdk.tar.gz
1722

18-
RAG Studio CML image:
23+
RAG Studio CML image (the picture shown in the catalog):
1924
https://raw.githubusercontent.com
2025

2126
Python dependencies:
2227
https://pypi.org
2328
https://files.pythonhosted.org
2429

25-
Node dependencies:
26-
http://registry.npmjs.org/
2730

scripts/refresh_project.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ rm -rf node_modules
9191
tar -xzf ../../artifacts/node-dist.tar.gz
9292

9393
cd ../../scripts
94-
python install_qdrant_app.py
95-
python install_metadata_app.py
94+
#python install_qdrant_app.py
95+
#python install_metadata_app.py

scripts/restart_app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
client = cmlapi.default_client()
4646
project_id = os.environ["CDSW_PROJECT_ID"]
4747
cml_apps = client.list_applications(project_id=project_id)
48-
ragstudio_apps = ["RagStudioMetadata", "RagStudio"]
48+
# ragstudio_apps = ["RagStudioMetadata", "RagStudio"]
49+
ragstudio_apps = ["RagStudio"]
4950

5051
if len(cml_apps.applications) > 0:
5152
for app_name in ragstudio_apps:

scripts/startup_app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@
4242

4343
client = cmlapi.default_client()
4444
applications = client.list_applications(project_id=os.environ['CDSW_PROJECT_ID'])
45-
metadata_base_url: str = "whatever, bro"
45+
metadata_base_url: str = "http://localhost:8080"
4646
if len(applications.applications) > 0:
4747
for app in applications.applications:
4848
if app.name == "RagStudioMetadata":
49-
metadata_base_url = f"{app.subdomain}.{os.environ['CDSW_DOMAIN']}"
49+
metadata_base_url = f"https://{app.subdomain}.{os.environ['CDSW_DOMAIN']}"
5050

5151
root_dir = "/home/cdsw/rag-studio" if os.getenv("IS_COMPOSABLE", "") != "" else "/home/cdsw"
5252
os.chdir(root_dir)
5353

5454
env = os.environ.copy()
55-
env["API_URL"] = f"https://{metadata_base_url}"
55+
env["API_URL"] = f"{metadata_base_url}"
5656

5757
print("Starting application with metadata base URL: ", metadata_base_url)
5858

scripts/startup_app.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,15 @@ fi
6363
export RAG_DATABASES_DIR=$(pwd)/databases
6464
export LLM_SERVICE_URL="http://localhost:8081"
6565

66-
#export API_URL="http://localhost:8080"
6766
export MLFLOW_ENABLE_ARTIFACTS_PROGRESS_BAR=false
6867
export MLFLOW_RECONCILER_DATA_PATH=$(pwd)/llm-service/reconciler/data
6968

69+
# start Qdrant vector DB
70+
qdrant/qdrant & 2>&1
71+
72+
# start up the jarva
73+
scripts/startup_java.sh & 2>&1
74+
7075
# start Python backend
7176
cd llm-service
7277
mkdir -p $MLFLOW_RECONCILER_DATA_PATH

scripts/startup_java.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#
2+
# CLOUDERA APPLIED MACHINE LEARNING PROTOTYPE (AMP)
3+
# (C) Cloudera, Inc. 2025
4+
# All rights reserved.
5+
#
6+
# Applicable Open Source License: Apache 2.0
7+
#
8+
# NOTE: Cloudera open source products are modular software products
9+
# made up of hundreds of individual components, each of which was
10+
# individually copyrighted. Each Cloudera open source product is a
11+
# collective work under U.S. Copyright Law. Your license to use the
12+
# collective work is as provided in your written agreement with
13+
# Cloudera. Used apart from the collective work, this file is
14+
# licensed for your use pursuant to the open source license
15+
# identified above.
16+
#
17+
# This code is provided to you pursuant a written agreement with
18+
# (i) Cloudera, Inc. or (ii) a third-party authorized to distribute
19+
# this code. If you do not have a written agreement with Cloudera nor
20+
# with an authorized and properly licensed third party, you do not
21+
# have any rights to access nor to use this code.
22+
#
23+
# Absent a written agreement with Cloudera, Inc. ("Cloudera") to the
24+
# contrary, A) CLOUDERA PROVIDES THIS CODE TO YOU WITHOUT WARRANTIES OF ANY
25+
# KIND; (B) CLOUDERA DISCLAIMS ANY AND ALL EXPRESS AND IMPLIED
26+
# WARRANTIES WITH RESPECT TO THIS CODE, INCLUDING BUT NOT LIMITED TO
27+
# IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND
28+
# FITNESS FOR A PARTICULAR PURPOSE; (C) CLOUDERA IS NOT LIABLE TO YOU,
29+
# AND WILL NOT DEFEND, INDEMNIFY, NOR HOLD YOU HARMLESS FOR ANY CLAIMS
30+
# ARISING FROM OR RELATED TO THE CODE; AND (D)WITH RESPECT TO YOUR EXERCISE
31+
# OF ANY RIGHTS GRANTED TO YOU FOR THE CODE, CLOUDERA IS NOT LIABLE FOR ANY
32+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR
33+
# CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, DAMAGES
34+
# RELATED TO LOST REVENUE, LOST PROFITS, LOSS OF INCOME, LOSS OF
35+
# BUSINESS ADVANTAGE OR UNAVAILABILITY, OR LOSS OR CORRUPTION OF
36+
# DATA.
37+
#
38+
39+
set -ox pipefail
40+
41+
RAG_STUDIO_INSTALL_DIR="/home/cdsw/rag-studio"
42+
DB_URL_LOCATION="jdbc:h2:file:~/rag-studio/databases/rag"
43+
if [ -z "$IS_COMPOSABLE" ]; then
44+
RAG_STUDIO_INSTALL_DIR="/home/cdsw"
45+
DB_URL_LOCATION="jdbc:h2:file:~/databases/rag"
46+
fi
47+
48+
export DB_URL=$DB_URL_LOCATION
49+
export JAVA_ROOT=`ls ${RAG_STUDIO_INSTALL_DIR}/java-home`
50+
export JAVA_HOME="${RAG_STUDIO_INSTALL_DIR}/java-home/${JAVA_ROOT}"
51+
52+
for i in {1..3}; do
53+
echo "Starting Java application..."
54+
"$JAVA_HOME"/bin/java -jar artifacts/rag-api.jar
55+
echo "Java application crashed, retrying ($i/3)..."
56+
sleep 5
57+
done
58+
#while ! curl --output /dev/null --silent --fail http://localhost:8080/api/v1/rag/dataSources; do
59+
# echo "Waiting for the Java backend to be ready..."
60+
# sleep 4
61+
#done

scripts/startup_metadata_app.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ fi
5151
export DB_URL=$DB_URL_LOCATION
5252
export JAVA_ROOT=`ls ${RAG_STUDIO_INSTALL_DIR}/java-home`
5353
export JAVA_HOME="${RAG_STUDIO_INSTALL_DIR}/java-home/${JAVA_ROOT}"
54+
export METADATA_APP_PORT=${CDSW_APP_PORT}
5455

5556
for i in {1..3}; do
5657
echo "Starting Java application..."

0 commit comments

Comments
 (0)