Skip to content

Commit

Permalink
Add ingress, change root path in deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
cornzz committed Aug 13, 2024
1 parent 32b8e92 commit 1967b8d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
2 changes: 2 additions & 0 deletions kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ spec:
- name: flagged-data
mountPath: /demo/flagged
env:
- name: APP_PATH
value: /compress
- name: LLM_ENDPOINT
valueFrom:
secretKeyRef:
Expand Down
24 changes: 24 additions & 0 deletions kubernetes/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: llmlingua-demo-ingress
namespace: cornelius-ns
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
tls:
- hosts:
- misc.llm.scads.ai
secretName: misc.llm.scads.ai-tls
rules:
- host: misc.llm.scads.ai
http:
paths:
- path: /compress
pathType: Prefix
backend:
service:
name: llmlingua-demo-service
port:
number: 80
4 changes: 1 addition & 3 deletions kubernetes/service.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: llmlingua-demo-nodeport
name: llmlingua-demo-service
namespace: cornelius-ns
spec:
type: NodePort
ports:
- port: 80
targetPort: 8000
nodePort: 30007
protocol: TCP
selector:
app: llmlingua-demo
3 changes: 2 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
start_load = time.time()
load_dotenv()

APP_PATH = os.getenv("APP_PATH") or "/"
LLM_ENDPOINT = os.getenv("LLM_ENDPOINT")
LLM_TOKEN = os.getenv("LLM_TOKEN")
LLM_LIST = [
Expand Down Expand Up @@ -362,5 +363,5 @@ def flag(prompt, context, compr_prompt, rate, metrics, res_a_obj, res_b_obj, fla
flag_b.click(flag, inputs=FLAG_COMPONENTS + [flag_b], outputs=[flag_a, flag_n, flag_b], preprocess=False)


app = gr.mount_gradio_app(app, demo, path="/")
app = gr.mount_gradio_app(app, demo, path=APP_PATH)
print(f"Ready! Loaded in {time.time() - start_load:.2f}s")

0 comments on commit 1967b8d

Please sign in to comment.