Skip to content

Commit 142cc48

Browse files
author
sd109
committed
Add tilt dev setup
1 parent 948a71f commit 142cc48

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Tiltfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Toggles whether UI should be run locally using gradio hot-reloading
2+
# or should be included in the remote Helm install
3+
run_ui_locally = True
4+
5+
# Tilt warns is if we try to use tilt against a cluster named 'production'
6+
# Use this line to allow it for now
7+
allow_k8s_contexts('production-llm-service-admin@production-llm-service')
8+
9+
# TODO: Include image builds in tilt up
10+
# docker_build("images/ui-base/")
11+
12+
chart_yaml = helm(
13+
"chart/",
14+
values="hu-dev-values.yml",
15+
# Enable/disable remote UI install depending on if we're running it locally
16+
set="ui.enabled={}".format(not str(run_ui_locally).lower()),
17+
)
18+
k8s_yaml(chart_yaml)
19+
20+
if not run_ui_locally:
21+
# Port-forward web app to localhost:8080
22+
k8s_resource("chart-ui", port_forwards="8080:7680")
23+
24+
# Port forward backend UI to localhost:8081 for local web app development
25+
k8s_resource("chart-api", port_forwards="8081:8000")
26+
27+
if run_ui_locally:
28+
requirements = "images/ui-base/requirements.txt"
29+
# Run gradio app locally with hot-reloading
30+
local_resource(
31+
name="gradio-app",
32+
deps=requirements,
33+
serve_cmd="".join([
34+
"source venv/bin/activate",
35+
"&& pip install -r {}".format(requirements),
36+
"&& cd chart/web-app",
37+
"&& gradio app.py --demo-name app"
38+
])
39+
)

0 commit comments

Comments
 (0)