Spaces:
Runtime error
Runtime error
Joshua Sundance Bailey
commited on
Commit
·
b281bf3
1
Parent(s):
8f8542a
kubernetes; remove .dockerignore from .gitignore; disable check-yaml pre-commit
Browse files- .dockerignore +13 -0
- .gitignore +0 -1
- .pre-commit-config.yaml +1 -1
- kubernetes/deploy.sh +19 -0
- kubernetes/resources.yaml +84 -0
.dockerignore
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.env
|
| 2 |
+
.env-example
|
| 3 |
+
.git/
|
| 4 |
+
.github
|
| 5 |
+
.gitignore
|
| 6 |
+
.idea
|
| 7 |
+
.mypy_cache
|
| 8 |
+
.pre-commit-config.yaml
|
| 9 |
+
.ruff_cache
|
| 10 |
+
Dockerfile
|
| 11 |
+
kubernetes
|
| 12 |
+
docker-compose.yml
|
| 13 |
+
junk/
|
.gitignore
CHANGED
|
@@ -21,7 +21,6 @@
|
|
| 21 |
.coverage
|
| 22 |
.coverage.*
|
| 23 |
.dmypy.json
|
| 24 |
-
.dockerignore
|
| 25 |
.eggs/
|
| 26 |
.env
|
| 27 |
.hypothesis/
|
|
|
|
| 21 |
.coverage
|
| 22 |
.coverage.*
|
| 23 |
.dmypy.json
|
|
|
|
| 24 |
.eggs/
|
| 25 |
.env
|
| 26 |
.hypothesis/
|
.pre-commit-config.yaml
CHANGED
|
@@ -32,7 +32,7 @@ repos:
|
|
| 32 |
- id: check-docstring-first
|
| 33 |
- id: check-executables-have-shebangs
|
| 34 |
- id: check-json
|
| 35 |
-
- id: check-yaml
|
| 36 |
- id: debug-statements
|
| 37 |
- id: fix-byte-order-marker
|
| 38 |
- id: detect-private-key
|
|
|
|
| 32 |
- id: check-docstring-first
|
| 33 |
- id: check-executables-have-shebangs
|
| 34 |
- id: check-json
|
| 35 |
+
# - id: check-yaml
|
| 36 |
- id: debug-statements
|
| 37 |
- id: fix-byte-order-marker
|
| 38 |
- id: detect-private-key
|
kubernetes/deploy.sh
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
IFS=$'\n\t'
|
| 4 |
+
|
| 5 |
+
# Create a secret for environment variables
|
| 6 |
+
secretExists=$(kubectl get secret langchain-streamlit-demo-secret --ignore-not-found)
|
| 7 |
+
|
| 8 |
+
if [ -n "$secretExists" ]; then
|
| 9 |
+
echo "Secret 'langchain-streamlit-demo-secret' already exists. Deleting and recreating."
|
| 10 |
+
kubectl delete secret langchain-streamlit-demo-secret
|
| 11 |
+
else
|
| 12 |
+
echo "Secret 'langchain-streamlit-demo-secret' does not exist. Creating."
|
| 13 |
+
fi
|
| 14 |
+
|
| 15 |
+
kubectl create secret generic langchain-streamlit-demo-secret --from-env-file=.env
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
# Deploy to Kubernetes
|
| 19 |
+
kubectl apply -f resources.yaml
|
kubernetes/resources.yaml
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: apps/v1
|
| 2 |
+
kind: Deployment
|
| 3 |
+
metadata:
|
| 4 |
+
name: langchain-streamlit-demo-deployment
|
| 5 |
+
spec:
|
| 6 |
+
replicas: 1
|
| 7 |
+
selector:
|
| 8 |
+
matchLabels:
|
| 9 |
+
app: langchain-streamlit-demo
|
| 10 |
+
template:
|
| 11 |
+
metadata:
|
| 12 |
+
labels:
|
| 13 |
+
app: langchain-streamlit-demo
|
| 14 |
+
spec:
|
| 15 |
+
containers:
|
| 16 |
+
- name: langchain-streamlit-demo
|
| 17 |
+
image: joshuasundance/langchain-streamlit-demo:latest
|
| 18 |
+
imagePullPolicy: Always # get latest on restart
|
| 19 |
+
resources:
|
| 20 |
+
requests:
|
| 21 |
+
cpu: "100m"
|
| 22 |
+
memory: "200Mi"
|
| 23 |
+
limits:
|
| 24 |
+
cpu: "500m"
|
| 25 |
+
memory: "500Mi"
|
| 26 |
+
env:
|
| 27 |
+
- name: OPENAI_API_KEY
|
| 28 |
+
valueFrom:
|
| 29 |
+
secretKeyRef:
|
| 30 |
+
name: langchain-streamlit-demo-secret
|
| 31 |
+
key: OPENAI_API_KEY
|
| 32 |
+
- name: ANTHROPIC_API_KEY
|
| 33 |
+
valueFrom:
|
| 34 |
+
secretKeyRef:
|
| 35 |
+
name: langchain-streamlit-demo-secret
|
| 36 |
+
key: ANTHROPIC_API_KEY
|
| 37 |
+
- name: ANYSCALE_API_KEY
|
| 38 |
+
valueFrom:
|
| 39 |
+
secretKeyRef:
|
| 40 |
+
name: langchain-streamlit-demo-secret
|
| 41 |
+
key: ANYSCALE_API_KEY
|
| 42 |
+
- name: LANGCHAIN_API_KEY
|
| 43 |
+
valueFrom:
|
| 44 |
+
secretKeyRef:
|
| 45 |
+
name: langchain-streamlit-demo-secret
|
| 46 |
+
key: LANGCHAIN_API_KEY
|
| 47 |
+
- name: LANGCHAIN_PROJECT
|
| 48 |
+
value: "langchain-streamlit-demo"
|
| 49 |
+
securityContext:
|
| 50 |
+
runAsNonRoot: true
|
| 51 |
+
---
|
| 52 |
+
apiVersion: v1
|
| 53 |
+
kind: Service
|
| 54 |
+
metadata:
|
| 55 |
+
name: langchain-streamlit-demo-service
|
| 56 |
+
# configure on Azure and uncomment below to use a vnet
|
| 57 |
+
# annotations:
|
| 58 |
+
# service.beta.kubernetes.io/azure-load-balancer-internal: "true"
|
| 59 |
+
# service.beta.kubernetes.io/azure-load-balancer-ipv4: vnet.ip.goes.here
|
| 60 |
+
# service.beta.kubernetes.io/azure-dns-label-name: "langchain-streamlit-demo"
|
| 61 |
+
spec:
|
| 62 |
+
selector:
|
| 63 |
+
app: langchain-streamlit-demo
|
| 64 |
+
ports:
|
| 65 |
+
- protocol: TCP
|
| 66 |
+
port: 80
|
| 67 |
+
targetPort: 7860
|
| 68 |
+
type: LoadBalancer
|
| 69 |
+
---
|
| 70 |
+
apiVersion: networking.k8s.io/v1
|
| 71 |
+
kind: NetworkPolicy
|
| 72 |
+
metadata:
|
| 73 |
+
name: langchain-streamlit-demo-network-policy
|
| 74 |
+
spec:
|
| 75 |
+
podSelector:
|
| 76 |
+
matchLabels:
|
| 77 |
+
app: langchain-streamlit-demo
|
| 78 |
+
policyTypes:
|
| 79 |
+
- Ingress
|
| 80 |
+
ingress:
|
| 81 |
+
- from: [] # An empty array here means it will allow traffic from all sources.
|
| 82 |
+
ports:
|
| 83 |
+
- protocol: TCP
|
| 84 |
+
port: 7860
|