Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s deployment #1825

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9770bc8
Merge pull request #1 from SciPhi-AI/main
rajangoswamiTWS Sep 20, 2024
8392a6f
Merge pull request #2 from SciPhi-AI/main
rajangoswamiTWS Sep 23, 2024
7117515
Merge pull request #4 from SciPhi-AI/main
rajangoswamiTWS Sep 24, 2024
472a0f3
Merge pull request #5 from SciPhi-AI/main
rajangoswamiTWS Sep 24, 2024
561bb4a
Merge branch 'SciPhi-AI:main' into main
rajangoswamiTWS Oct 11, 2024
a2a9232
Merge branch 'SciPhi-AI:main' into main
rajangoswamiTWS Oct 16, 2024
ea1c7e7
Merge branch 'SciPhi-AI:main' into main
rajangoswamiTWS Oct 21, 2024
95d2210
k8s files added
rajangoswamiTWS Nov 13, 2024
e165027
azure llm
rajangoswamiTWS Nov 13, 2024
9ec5138
Update pv.yaml
rajangoswamiTWS Nov 13, 2024
27d985e
argocd yaml added
rajangoswamiTWS Nov 13, 2024
755c78f
azure_llm added
rajangoswamiTWS Nov 13, 2024
1cc4f20
Update r2r.yaml
rajangoswamiTWS Nov 13, 2024
af999b9
Update azure_llm.toml
rajangoswamiTWS Nov 14, 2024
ed810bc
Update full_azure_llm.toml
rajangoswamiTWS Nov 14, 2024
37766d9
sealed secret added
rajangoswamiTWS Nov 19, 2024
e1f8c44
Update ingress.yaml
rajangoswamiTWS Dec 3, 2024
4a4f994
Update ingress.yaml
rajangoswamiTWS Dec 6, 2024
f2770bb
external postgres db used
rajangoswamiTWS Jan 3, 2025
76ee1bf
config pvc commented
rajangoswamiTWS Jan 3, 2025
8db2d4f
Update r2r.yaml
rajangoswamiTWS Jan 3, 2025
edd340f
r2r sealed secret commented, postgres secrets updated
rajangoswamiTWS Jan 3, 2025
02236ad
sealed secrets added back. r2r toml reverted
rajangoswamiTWS Jan 3, 2025
244fc68
Update r2r.toml
rajangoswamiTWS Jan 3, 2025
81441df
ongc gitops added
rajangoswamiTWS Jan 6, 2025
e254560
azure api base variable updated
rajangoswamiTWS Jan 6, 2025
dd9d839
Update sealed-secret.yaml
rajangoswamiTWS Jan 7, 2025
dc45d9e
r2r service type updated
rajangoswamiTWS Jan 8, 2025
1e6686e
Update r2r.yaml
rajangoswamiTWS Jan 13, 2025
2f72def
postgres pod commented
rajangoswamiTWS Jan 14, 2025
11293bf
k8s deployment refactoring
rajangoswamiTWS Jan 14, 2025
fecffa3
idea files removed
rajangoswamiTWS Jan 14, 2025
d1dbe17
Merge branch 'main' into k8s-deployment
rajangoswamiTWS Jan 14, 2025
aedd020
Update secret.yaml
rajangoswamiTWS Jan 14, 2025
df79309
Merge branch 'k8s-deployment' of https://github.com/thoughtswinsystem…
rajangoswamiTWS Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ dist/
*.test
go.work
go.work.sum

.idea
24 changes: 24 additions & 0 deletions py/argocd/dev-autosync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: dev-r2r-stack
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/SciPhi-AI/R2R.git
targetRevision: k8s-deployment
path: py/k8s/dev/azure
directory:
recurse: true
destination:
server: https://kubernetes.default.svc
namespace: r2r-dev

syncPolicy:
syncOptions:
- CreateNamespace=true

automated:
selfHeal: true
prune: true
7 changes: 7 additions & 0 deletions py/k8s/dev/azure/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: r2r-dev
labels:
name: r2r-dev
95 changes: 95 additions & 0 deletions py/k8s/dev/azure/pg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
namespace: r2r-dev
labels:
app: r2r
data:
POSTGRES_USER: cG9zdGdyZXM=
rajangoswamiTWS marked this conversation as resolved.
Show resolved Hide resolved
POSTGRES_PASSWORD: cG9zdGdyZXM=

---
apiVersion: v1
data:
POSTGRES_HOST: postgres
POSTGRES_PORT: "5432"
POSTGRES_DBNAME: postgres
POSTGRES_MAX_CONNECTIONS: "1024"
kind: ConfigMap
metadata:
labels:
app: r2r
name: postgres-config
namespace: r2r-dev

# Deployment and Service for PostgreSQL
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: r2r-dev
labels:
app: r2r
spec:
replicas: 1
selector:
matchLabels:
app: postgres
strategy:
type: Recreate
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
envFrom:
- configMapRef:
name: postgres-config
- secretRef:
name: postgres-secret
# command:
# - postgres
# - -c
# - max_connections=1024
image: pgvector/pgvector:pg16
ports:
- containerPort: 5432
protocol: TCP
# readinessProbe:
# exec:
# command: [ "pg_isready", "-U", "${R2R_POSTGRES_USER:-postgres}" ]
# initialDelaySeconds: 15
# timeoutSeconds: 2
# livenessProbe:
# exec:
# command: [ "pg_isready", "-U", "${R2R_POSTGRES_USER:-postgres}" ]
# initialDelaySeconds: 15
# timeoutSeconds: 2
# periodSeconds: 10
volumeMounts:
- mountPath: /data
name: postgres-volume-mount
restartPolicy: Always
volumes:
- name: postgres-volume-mount
persistentVolumeClaim:
claimName: postgres-pvc

---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: r2r-dev
spec:
ports:
- protocol: TCP
port: 5432
targetPort: 5432
selector:
app: postgres
29 changes: 29 additions & 0 deletions py/k8s/dev/azure/pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
namespace: r2r-dev
labels:
app: r2r
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 256Gi

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-r2r-config-blob
namespace: r2r-dev
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 256Mi
volumeName: pv-r2r-config-blob
storageClassName: azureblob-nfs-premium
40 changes: 40 additions & 0 deletions py/k8s/dev/azure/r2r-dashboard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Deployment and Service for Unstructured
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: r2r-dashboard
namespace: r2r-dev
spec:
replicas: 1
selector:
matchLabels:
app: r2r-dashboard
template:
metadata:
labels:
app: r2r-dashboard
spec:
containers:
- name: r2r-dashboard
image: emrgntcmplxty/r2r-dashboard:latest
env:
- name: NEXT_PUBLIC_R2R_DEPLOYMENT_URL
value: http://4.174.219.49:7272
ports:
- containerPort: 3000

---
apiVersion: v1
kind: Service
metadata:
name: r2r-dashboard
namespace: r2r-dev
spec:
ports:
- protocol: TCP
port: 7273
targetPort: 3000
type: LoadBalancer
selector:
app: r2r-dashboard
98 changes: 98 additions & 0 deletions py/k8s/dev/azure/r2r.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Config Map, Secret, Deployment and Service for R2R
---
apiVersion: v1
data:
PYTHONUNBUFFERED: "1"
R2R_PORT: "7272"
R2R_HOST: "0.0.0.0"
R2R_PROJECT_NAME: r2r_default
R2R_CONFIG_NAME: azure_llm

R2R_POSTGRES_HOST: postgres
R2R_POSTGRES_PORT: "5432"
R2R_POSTGRES_DBNAME: postgres
R2R_POSTGRES_MAX_CONNECTIONS: "1024"

R2R_POSTGRES_PROJECT_NAME: r2r_default

# OLLAMA_API_BASE: http://ollama:11434
UNSTRUCTURED_LOCAL_URL: http://unstructured.r2r-dev:7275
UNSTRUCTURED_NUM_WORKERS: "10"
# HATCHET_CLIENT_TLS_STRATEGY: "none"
# HATCHET_CLIENT_GRPC_MAX_RECV_MESSAGE_LENGTH: "134217728"
# HATCHET_CLIENT_GRPC_MAX_SEND_MESSAGE_LENGTH: "134217728"

AZURE_API_VERSION: "2024-02-01"

kind: ConfigMap
metadata:
labels:
app: r2r
name: r2r-config
namespace: r2r-dev

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: r2r
namespace: r2r-dev
spec:
replicas: 4
selector:
matchLabels:
app: r2r
template:
metadata:
labels:
app: r2r
spec:
containers:
- name: r2r
command:
- /bin/sh
- -c
- |
exec uvicorn core.main.app_entry:app --host $${R2R_HOST} --port $${R2R_PORT}
image: leesw0924/r2r
imagePullPolicy: Always
envFrom:
- configMapRef:
name: r2r-config
- secretRef:
name: r2r-secret
ports:
- containerPort: 7272
readinessProbe:
httpGet:
port: 7272
path: /v2/health
initialDelaySeconds: 15
livenessProbe:
httpGet:
port: 7272
path: /v2/health
initialDelaySeconds: 15
periodSeconds: 10
# volumeMounts:
# - mountPath: /mnt/r2r-config
# name: r2r-config-mount
restartPolicy: Always
# volumes:
# - name: r2r-config-mount
# persistentVolumeClaim:
# claimName: pvc-r2r-config-blob
---
apiVersion: v1
kind: Service
metadata:
name: r2r
namespace: r2r-dev
spec:
ports:
- protocol: TCP
port: 7272
targetPort: 7272
type: LoadBalancer
selector:
app: r2r
12 changes: 12 additions & 0 deletions py/k8s/dev/azure/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: Secret
metadata:
name: r2r-secret
namespace: r2r-dev
labels:
app: r2r
data:
R2R_POSTGRES_USER: cG9zdGdyZXM=
R2R_POSTGRES_PASSWORD: cG9zdGdyZXM=
AZURE_API_KEY: <Put Azure OpenAPI Key>
rajangoswamiTWS marked this conversation as resolved.
Show resolved Hide resolved
36 changes: 36 additions & 0 deletions py/k8s/dev/azure/unstructured.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Deployment and Service for Unstructured
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: unstructured
namespace: r2r-dev
spec:
replicas: 4
selector:
matchLabels:
app: unstructured
template:
metadata:
labels:
app: unstructured
spec:
containers:
- name: unstructured
image: ragtoriches/unst-prod
ports:
- containerPort: 7275

---
apiVersion: v1
kind: Service
metadata:
name: unstructured
namespace: r2r-dev
spec:
ports:
- protocol: TCP
port: 7275
targetPort: 7275
selector:
app: unstructured