diff --git a/docs/pages/Deploying/Kubernetes-Deploying.md b/docs/pages/Deploying/Kubernetes-Deploying.md new file mode 100644 index 000000000..d7607bff6 --- /dev/null +++ b/docs/pages/Deploying/Kubernetes-Deploying.md @@ -0,0 +1,108 @@ +# Self-hosting DocsGPT on Kubernetes + +This guide will walk you through deploying DocsGPT on Kubernetes. + +## Prerequisites + +Ensure you have the following installed before proceeding: + +- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) +- Access to a Kubernetes cluster + +## Folder Structure + +The `k8s` folder contains the necessary deployment and service configuration files: + +- `deployments/` +- `services/` +- `docsgpt-secrets.yaml` + +## Deployment Instructions + +1. **Clone the Repository** + + ```sh + git clone https://github.com/arc53/DocsGPT.git + cd docsgpt/k8s + ``` + +2. **Configure Secrets (optional)** + + Ensure that you have all the necessary secrets in `docsgpt-secrets.yaml`. Update it with your secrets before applying if you want. By default we will use qdrant as a vectorstore and public docsgpt llm as llm for inference. + +3. **Apply Kubernetes Deployments** + + Deploy your DocsGPT resources using the following commands: + + ```sh + kubectl apply -f deployments/ + ``` + +4. **Apply Kubernetes Services** + + Set up your services using the following commands: + + ```sh + kubectl apply -f services/ + ``` + +5. **Apply Secrets** + + Apply the secret configurations: + + ```sh + kubectl apply -f docsgpt-secrets.yaml + ``` + +6. **Substitute API URL** + + After deploying the services, you need to update the environment variable `VITE_API_HOST` in your deployment file `deployments/docsgpt-deploy.yaml` with the actual endpoint URL created by your `docsgpt-api-service`. + + You can get the value of the `docsgpt-api-service` by running: + + ```sh + kubectl get services/docsgpt-api-service | awk 'NR>1 {print $4}' + ``` + + Update the `` field with your API endpoint URL by running this command and pasting endpoint from previous command: + + ```sh + read -p "Enter the API endpoint: " api_endpoint && sed -i "s||$api_endpoint|g" deployments/docsgpt-deploy.yaml + ``` + +7. **Rerun Deployment** + + After making the changes, reapply the deployment configuration to update the environment variables: + + ```sh + kubectl apply -f deployments/ + ``` + +## Verifying the Deployment + +To verify if everything is set up correctly, you can run the following: + +```sh +kubectl get pods +kubectl get services +``` + +Ensure that the pods are running and the services are available. + +## Accessing DocsGPT + +To access DocsGPT, you need to find the external IP address of the frontend service. You can do this by running: + +```sh +kubectl get services/docsgpt-frontend-service | awk 'NR>1 {print "http://" $4}' +``` + +## Troubleshooting + +If you encounter any issues, you can check the logs of the pods for more details: + +```sh +kubectl logs +``` + +Replace `` with the actual name of your DocsGPT pod. \ No newline at end of file diff --git a/docs/pages/Deploying/_meta.json b/docs/pages/Deploying/_meta.json index 6d523a6d9..2aec988e1 100644 --- a/docs/pages/Deploying/_meta.json +++ b/docs/pages/Deploying/_meta.json @@ -10,5 +10,9 @@ "Railway-Deploying": { "title": "🚂Deploying on Railway", "href": "/Deploying/Railway-Deploying" + }, + "Kubernetes-Deploying": { + "title": "🚀Deploying on Kubernetes", + "href": "/Deploying/Kubernetes-Deploying" } } diff --git a/k8s/deployments/docsgpt-deploy.yaml b/k8s/deployments/docsgpt-deploy.yaml index 1d0b86a37..815ff47fe 100644 --- a/k8s/deployments/docsgpt-deploy.yaml +++ b/k8s/deployments/docsgpt-deploy.yaml @@ -63,7 +63,7 @@ spec: name: docsgpt-secrets env: - name: API_URL - value: "BACKEND-URL" + value: "http://" --- apiVersion: apps/v1 kind: Deployment @@ -93,6 +93,6 @@ spec: cpu: "100m" env: - name: VITE_API_HOST - value: "BACKEND-URL" + value: "http://" - name: VITE_API_STREAMING value: "true" \ No newline at end of file diff --git a/k8s/docsgpt-secrets.yaml b/k8s/docsgpt-secrets.yaml index 45a009738..783b9b017 100644 --- a/k8s/docsgpt-secrets.yaml +++ b/k8s/docsgpt-secrets.yaml @@ -11,5 +11,6 @@ data: QDRANT_URL: cmVkaXM6Ly9yZWRpcy1zZXJ2aWNlOjYzNzkvMA== QDRANT_PORT: NjM3OQ== MONGO_URI: bW9uZ29kYjovL21vbmdvZGItc2VydmljZToyNzAxNy9kb2NzZ3B0P3JldHJ5V3JpdGVzPXRydWUmdz1tYWpvcml0eQ== + VECTOR_STORE: cWRyYW50 mongo-user: bW9uZ28tdXNlcg== mongo-password: bW9uZ28tcGFzc3dvcmQ= \ No newline at end of file