Skip to content

Commit 5493d07

Browse files
authored
Clean up Gen AI Dev running process (opendatahub-io#5527)
* Clean up Gen AI Dev running process * PR change * updated README in genAI
1 parent 9f712dd commit 5493d07

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

packages/gen-ai/.env.development

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
APP_ENV=development
2-
DEPLOYMENT_MODE=standalone
2+
DEPLOYMENT_MODE=standalone
3+
LLAMA_STACK_URL=<your-llama-stack-url>
4+
MAAS_URL=<your-maas-url>
5+
DISTRIBUTION_NAME=<your-distribution-name>
6+
MAAS_NAMESPACE=<your-maas-namespace>
7+
PLAYGROUND_NAMESPACE=<your-playground-namespace>

packages/gen-ai/Makefile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ include ${ENV_FILE}
1717
export $(shell sed 's/=.*//' ${ENV_FILE})
1818
endif
1919

20-
.PHONY: help dev-install-dependencies dev-frontend dev-bff dev-start clean clean-all
20+
.PHONY: help dev-install-dependencies dev-frontend dev-bff dev-start dev-start-no-portforward dev-portforward clean clean-all
2121

2222
help: ## Display this help message
2323
@echo "Available commands:"
@@ -33,7 +33,7 @@ dev-bff-mock: ## Run only the bff in development mode
3333

3434
.PHONY: dev-bff
3535
dev-bff:
36-
cd bff && LLAMA_STACK_URL=${LLAMA_STACK_URL} AUTH_TOKEN=user_token AUTH_TOKEN_HEADER=Authorization AUTH_TOKEN_PREFIX="Bearer " make run STATIC_ASSETS_DIR=../frontend/dist
36+
cd bff && MAAS_URL=${MAAS_URL} DISTRIBUTION_NAME=${DISTRIBUTION_NAME} LLAMA_STACK_URL=${LLAMA_STACK_URL} AUTH_TOKEN=user_token AUTH_TOKEN_HEADER=Authorization AUTH_TOKEN_PREFIX="Bearer " make run STATIC_ASSETS_DIR=../frontend/dist
3737

3838

3939
.PHONY: dev-frontend
@@ -44,8 +44,22 @@ dev-frontend: ## Run only the frontend in development mode
4444
dev-start-mock: ## Run both frontend and bff in development mode
4545
make -j 2 dev-bff-mock dev-frontend
4646

47+
.PHONY: dev-portforward
48+
dev-portforward: ## Start port-forwarding in separate terminals
49+
@echo "Starting port-forward for maas-api..."
50+
@oc port-forward -n ${MAAS_NAMESPACE} svc/maas-api 8081:8080 &
51+
@sleep 1
52+
@echo "Starting port-forward for lsd-genai-playground-service..."
53+
@oc port-forward -n ${PLAYGROUND_NAMESPACE} svc/lsd-genai-playground-service 8321:8321 &
54+
@echo "Port-forwarding started in background!"
55+
4756
.PHONY: dev-start
48-
dev-start:
57+
dev-start: dev-portforward ## Start frontend, bff, and port-forwarding
58+
@sleep 2
59+
make -j 2 dev-bff dev-frontend
60+
61+
.PHONY: dev-start-no-portforward
62+
dev-start-no-portforward: ## Start frontend and bff without port-forwarding
4963
make -j 2 dev-bff dev-frontend
5064

5165
clean: ## Clean build artifacts and node_modules

packages/gen-ai/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ make run MOCK_MAAS_CLIENT=true
110110
make dev-bff-mock
111111
```
112112

113+
## Running Frontend and BFF Together
114+
115+
For convenience, you can start both the frontend and BFF simultaneously using these Makefile targets from the root of the gen-ai package:
116+
117+
```bash
118+
# Start frontend, bff, and port-forwarding
119+
make dev-start
120+
121+
# Start frontend and bff without port-forwarding
122+
make dev-start-no-portforward
123+
```
124+
125+
These commands will run both services in parallel, making it easier to start your development environment with a single command.
126+
113127
## Building and Running with Docker
114128

115129
The project includes a multi-stage Dockerfile that builds both the frontend and backend components and creates a minimal production image.
@@ -179,8 +193,8 @@ docker run -p 8080:8080 \
179193
A complimentary script is provided to build and run GenAI Studio as standalone application
180194
in OpenShift by using the build and deploy capacities of OpenShift through the `oc new-app` command.
181195

182-
183196
Prerequisites:
197+
184198
- Logged into OpenShift (`oc login`) and a target project selected (`oc project <name>`)
185199
- Current git branch tracks a remote and the remote fetch URL uses HTTPS
186200
- A browser extension that allows "Autorization: Bearer <oc whoami -t >" token
@@ -192,6 +206,7 @@ Run from the repository root:
192206
```
193207

194208
What the script does (high level):
209+
195210
- Detects repo URL and current branch; validates HTTPS fetch URL
196211
- Creates a Docker BuildConfig via `oc new-app` (scoped to `packages/gen-ai`)
197212
- Patches the BuildConfig to use `packages/gen-ai/Dockerfile`

0 commit comments

Comments
 (0)