mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-02-21 11:51:24 +00:00
setup+development-docs
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
## Development Environments
|
||||
|
||||
### Spin up Mongo and Redis
|
||||
|
||||
For development, only two containers are used from [docker-compose.yaml](https://github.com/arc53/DocsGPT/blob/main/deployment/docker-compose.yaml) (by deleting all services except for Redis and Mongo).
|
||||
See file [docker-compose-dev.yaml](https://github.com/arc53/DocsGPT/blob/main/deployment/docker-compose-dev.yaml).
|
||||
|
||||
Run
|
||||
|
||||
```
|
||||
docker compose -f deployment/docker-compose-dev.yaml build
|
||||
docker compose -f deployment/docker-compose-dev.yaml up -d
|
||||
```
|
||||
|
||||
### Run the Backend
|
||||
|
||||
> [!Note]
|
||||
> Make sure you have Python 3.12 installed.
|
||||
|
||||
1. Export required environment variables or prepare a `.env` file in the project folder:
|
||||
- Copy [.env-template](https://github.com/arc53/DocsGPT/blob/main/application/.env-template) and create `.env`.
|
||||
|
||||
(check out [`application/core/settings.py`](application/core/settings.py) if you want to see more config options.)
|
||||
|
||||
2. (optional) Create a Python virtual environment:
|
||||
You can follow the [Python official documentation](https://docs.python.org/3/tutorial/venv.html) for virtual environments.
|
||||
|
||||
a) On Mac OS and Linux
|
||||
|
||||
```commandline
|
||||
python -m venv venv
|
||||
. venv/bin/activate
|
||||
```
|
||||
|
||||
b) On Windows
|
||||
|
||||
```commandline
|
||||
python -m venv venv
|
||||
venv/Scripts/activate
|
||||
```
|
||||
|
||||
3. Download embedding model and save it in the `model/` folder:
|
||||
You can use the script below, or download it manually from [here](https://d3dg1063dc54p9.cloudfront.net/models/embeddings/mpnet-base-v2.zip), unzip it and save it in the `model/` folder.
|
||||
|
||||
```commandline
|
||||
wget https://d3dg1063dc54p9.cloudfront.net/models/embeddings/mpnet-base-v2.zip
|
||||
unzip mpnet-base-v2.zip -d model
|
||||
rm mpnet-base-v2.zip
|
||||
```
|
||||
|
||||
4. Install dependencies for the backend:
|
||||
|
||||
```commandline
|
||||
pip install -r application/requirements.txt
|
||||
```
|
||||
|
||||
5. Run the app using `flask --app application/app.py run --host=0.0.0.0 --port=7091`.
|
||||
6. Start worker with `celery -A application.app.celery worker -l INFO`.
|
||||
|
||||
> [!Note]
|
||||
> You can also launch the in a debugger mode in vscode by accessing SHIFT + CMD + D or SHIFT + Windows + D on windows and selecting Flask or Celery.
|
||||
|
||||
|
||||
### Start Frontend
|
||||
|
||||
> [!Note]
|
||||
> Make sure you have Node version 16 or higher.
|
||||
|
||||
1. Navigate to the [/frontend](https://github.com/arc53/DocsGPT/tree/main/frontend) folder.
|
||||
2. Install the required packages `husky` and `vite` (ignore if already installed).
|
||||
|
||||
```commandline
|
||||
npm install husky -g
|
||||
npm install vite -g
|
||||
```
|
||||
|
||||
3. Install dependencies by running `npm install --include=dev`.
|
||||
4. Run the app using `npm run dev`.
|
||||
163
docs/pages/Deploying/Development-Environment.mdx
Normal file
163
docs/pages/Deploying/Development-Environment.mdx
Normal file
@@ -0,0 +1,163 @@
|
||||
---
|
||||
title: Setting Up a Development Environment
|
||||
description: Guide to setting up a development environment for DocsGPT, including backend and frontend setup.
|
||||
---
|
||||
|
||||
# Setting Up a Development Environment
|
||||
|
||||
This guide will walk you through setting up a development environment for DocsGPT. This setup allows you to modify and test the application's backend and frontend components.
|
||||
|
||||
## 1. Spin Up MongoDB and Redis
|
||||
|
||||
For development purposes, you can quickly start MongoDB and Redis containers, which are the primary database and caching systems used by DocsGPT. We provide a dedicated Docker Compose file, `docker-compose-dev.yaml`, located in the `deployment` directory, that includes only these essential services.
|
||||
|
||||
You can find the `docker-compose-dev.yaml` file [here](https://github.com/arc53/DocsGPT/blob/main/deployment/docker-compose-dev.yaml).
|
||||
|
||||
**Steps to start MongoDB and Redis:**
|
||||
|
||||
1. Navigate to the root directory of your DocsGPT repository in your terminal.
|
||||
|
||||
2. Run the following commands to build and start the containers defined in `docker-compose-dev.yaml`:
|
||||
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose-dev.yaml build
|
||||
docker compose -f deployment/docker-compose-dev.yaml up -d
|
||||
```
|
||||
|
||||
These commands will start MongoDB and Redis in detached mode, running in the background.
|
||||
|
||||
## 2. Run the Backend
|
||||
|
||||
To run the DocsGPT backend locally, you'll need to set up a Python environment and install the necessary dependencies.
|
||||
|
||||
**Prerequisites:**
|
||||
|
||||
* **Python 3.12:** Ensure you have Python 3.12 installed on your system. You can check your Python version by running `python --version` or `python3 --version` in your terminal.
|
||||
|
||||
**Steps to run the backend:**
|
||||
|
||||
1. **Configure Environment Variables:**
|
||||
|
||||
DocsGPT backend settings are configured using environment variables. You can set these either in a `.env` file or directly in the `settings.py` file. For a comprehensive overview of all settings, please refer to the [DocsGPT Settings Guide](/Deploying/DocsGPT-Settings).
|
||||
|
||||
* **Option 1: Using a `.env` file (Recommended):**
|
||||
* If you haven't already, create a file named `.env` in the **root directory** of your DocsGPT project.
|
||||
* Modify the `.env` file to adjust settings as needed. You can find a comprehensive list of configurable options in [`application/core/settings.py`](application/core/settings.py).
|
||||
|
||||
* **Option 2: Exporting Environment Variables:**
|
||||
* Alternatively, you can export environment variables directly in your terminal. However, using a `.env` file is generally more organized for development.
|
||||
|
||||
2. **Create a Python Virtual Environment (Optional but Recommended):**
|
||||
|
||||
Using a virtual environment isolates project dependencies and avoids conflicts with system-wide Python packages.
|
||||
|
||||
* **macOS and Linux:**
|
||||
|
||||
```bash
|
||||
python -m venv venv
|
||||
. venv/bin/activate
|
||||
```
|
||||
|
||||
* **Windows:**
|
||||
|
||||
```bash
|
||||
python -m venv venv
|
||||
venv/Scripts/activate
|
||||
```
|
||||
|
||||
3. **Download Embedding Model:**
|
||||
|
||||
The backend requires an embedding model. Download the `mpnet-base-v2` model and place it in the `model/` directory within the project root. You can use the following script:
|
||||
|
||||
```bash
|
||||
wget https://d3dg1063dc54p9.cloudfront.net/models/embeddings/mpnet-base-v2.zip
|
||||
unzip mpnet-base-v2.zip -d model
|
||||
rm mpnet-base-v2.zip
|
||||
```
|
||||
|
||||
Alternatively, you can manually download the zip file from [here](https://d3dg1063dc54p9.cloudfront.net/models/embeddings/mpnet-base-v2.zip), unzip it, and place the extracted folder in `model/`.
|
||||
|
||||
4. **Install Backend Dependencies:**
|
||||
|
||||
Navigate to the root of your DocsGPT repository and install the required Python packages:
|
||||
|
||||
```bash
|
||||
pip install -r application/requirements.txt
|
||||
```
|
||||
|
||||
5. **Run the Flask App:**
|
||||
|
||||
Start the Flask backend application:
|
||||
|
||||
```bash
|
||||
flask --app application/app.py run --host=0.0.0.0 --port=7091
|
||||
```
|
||||
|
||||
This command will launch the backend server, making it accessible on `http://localhost:7091`.
|
||||
|
||||
6. **Start the Celery Worker:**
|
||||
|
||||
Open a new terminal window (and activate your virtual environment if you used one). Start the Celery worker to handle background tasks:
|
||||
|
||||
```bash
|
||||
celery -A application.app.celery worker -l INFO
|
||||
```
|
||||
|
||||
This command will start the Celery worker, which processes tasks such as document parsing and vector embedding.
|
||||
|
||||
**Running in Debugger (VSCode):**
|
||||
|
||||
For easier debugging, you can launch the Flask app and Celery worker directly from VSCode's debugger.
|
||||
|
||||
* Press <kbd>Shift</kbd> + <kbd>Cmd</kbd> + <kbd>D</kbd> (macOS) or <kbd>Shift</kbd> + <kbd>Windows</kbd> + <kbd>D</kbd> (Windows) to open the Run and Debug view.
|
||||
* You should see configurations named "Flask" and "Celery". Select the desired configuration and click the "Start Debugging" button (green play icon).
|
||||
|
||||
## 3. Start the Frontend
|
||||
|
||||
To run the DocsGPT frontend locally, you'll need Node.js and npm (Node Package Manager).
|
||||
|
||||
**Prerequisites:**
|
||||
|
||||
* **Node.js version 16 or higher:** Ensure you have Node.js version 16 or greater installed. You can check your Node.js version by running `node -v` in your terminal. npm is usually bundled with Node.js.
|
||||
|
||||
**Steps to start the frontend:**
|
||||
|
||||
1. **Navigate to the Frontend Directory:**
|
||||
|
||||
In your terminal, change the current directory to the `frontend` folder within your DocsGPT repository:
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
```
|
||||
|
||||
2. **Install Global Packages (If Needed):**
|
||||
|
||||
If you don't have `husky` and `vite` installed globally, you can install them:
|
||||
|
||||
```bash
|
||||
npm install husky -g
|
||||
npm install vite -g
|
||||
```
|
||||
You can skip this step if you already have these packages installed or prefer to use local installations (though global installation simplifies running the commands in this guide).
|
||||
|
||||
3. **Install Frontend Dependencies:**
|
||||
|
||||
Install the project's frontend dependencies using npm:
|
||||
|
||||
```bash
|
||||
npm install --include=dev
|
||||
```
|
||||
|
||||
This command reads the `package.json` file in the `frontend` directory and installs all listed dependencies, including development dependencies.
|
||||
|
||||
4. **Run the Frontend App:**
|
||||
|
||||
Start the frontend development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
This command will start the Vite development server. The frontend application will typically be accessible at [http://localhost:5173/](http://localhost:5173/). The terminal will display the exact URL where the frontend is running.
|
||||
|
||||
With both the backend and frontend running, you should now have a fully functional DocsGPT development environment. You can access the application in your browser at [http://localhost:5173/](http://localhost:5173/) and start developing!
|
||||
135
docs/pages/Deploying/Docker-Deploying.mdx
Normal file
135
docs/pages/Deploying/Docker-Deploying.mdx
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
title: Docker Deployment of DocsGPT
|
||||
description: Deploy DocsGPT using Docker and Docker Compose for easy setup and management.
|
||||
---
|
||||
|
||||
# Docker Deployment of DocsGPT
|
||||
|
||||
Docker is the recommended method for deploying DocsGPT, providing a consistent and isolated environment for the application to run. This guide will walk you through deploying DocsGPT using Docker and Docker Compose.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* **Docker Engine:** You need to have Docker Engine installed on your system.
|
||||
* **macOS:** [Docker Desktop for Mac](https://docs.docker.com/desktop/install/mac-install/)
|
||||
* **Linux:** [Docker Engine Installation Guide](https://docs.docker.com/engine/install/) (follow instructions for your specific distribution)
|
||||
* **Windows:** [Docker Desktop for Windows](https://docs.docker.com/desktop/install/windows-install/) (requires WSL 2 backend, see notes below)
|
||||
* **Docker Compose:** Docker Compose is usually included with Docker Desktop. If you are using Docker Engine separately, ensure you have Docker Compose V2 installed.
|
||||
|
||||
**Important Note for Windows Users:** Docker Desktop on Windows generally requires the WSL 2 backend to function correctly, especially when using features like host networking which are utilized in DocsGPT's Docker Compose setup. Ensure WSL 2 is enabled and configured in Docker Desktop settings.
|
||||
|
||||
## Quickest Setup: Using DocsGPT Public API
|
||||
|
||||
The fastest way to try out DocsGPT is by using the public API endpoint. This requires minimal configuration and no local LLM setup.
|
||||
|
||||
1. **Clone the DocsGPT Repository (if you haven't already):**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/arc53/DocsGPT.git
|
||||
cd DocsGPT
|
||||
```
|
||||
|
||||
2. **Create a `.env` file:**
|
||||
|
||||
In the root directory of your DocsGPT repository, create a file named `.env`.
|
||||
|
||||
3. **Add Public API Configuration to `.env`:**
|
||||
|
||||
Open the `.env` file and add the following lines:
|
||||
|
||||
```
|
||||
LLM_NAME=docsgpt
|
||||
VITE_API_STREAMING=true
|
||||
```
|
||||
|
||||
This minimal configuration tells DocsGPT to use the public API. For more advanced settings and other LLM options, refer to the [DocsGPT Settings Guide](/Deploying/DocsGPT-Settings).
|
||||
|
||||
4. **Launch DocsGPT with Docker Compose:**
|
||||
|
||||
Navigate to the root directory of the DocsGPT repository in your terminal and run:
|
||||
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml up -d
|
||||
```
|
||||
|
||||
The `-d` flag runs Docker Compose in detached mode (in the background).
|
||||
|
||||
5. **Access DocsGPT in your browser:**
|
||||
|
||||
Once the containers are running, open your web browser and go to [http://localhost:5173/](http://localhost:5173/).
|
||||
|
||||
6. **Stopping DocsGPT:**
|
||||
|
||||
To stop the application, navigate to the same directory in your terminal and run:
|
||||
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml down
|
||||
```
|
||||
|
||||
## Optional Ollama Setup (Local Models)
|
||||
|
||||
DocsGPT provides optional Docker Compose files to easily integrate with [Ollama](https://ollama.com/) for running local models. These files add an official Ollama container to your Docker Compose setup. These files are located in the `deployment/optional/` directory.
|
||||
|
||||
There are two Ollama optional files:
|
||||
|
||||
* **`docker-compose.optional.ollama-cpu.yaml`**: For running Ollama on CPU.
|
||||
* **`docker-compose.optional.ollama-gpu.yaml`**: For running Ollama on GPU (requires Docker to be configured for GPU usage).
|
||||
|
||||
### Launching with Ollama and Pulling a Model
|
||||
|
||||
1. **Clone the DocsGPT Repository and Create `.env` (as described above).**
|
||||
|
||||
2. **Launch DocsGPT with Ollama Docker Compose:**
|
||||
|
||||
Choose the appropriate Ollama Compose file (CPU or GPU) and launch DocsGPT:
|
||||
|
||||
**CPU:**
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml -f deployment/optional/docker-compose.optional.ollama-cpu.yaml up -d
|
||||
```
|
||||
**GPU:**
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml -f deployment/optional/docker-compose.optional.ollama-gpu.yaml up -d
|
||||
```
|
||||
|
||||
3. **Pull the Ollama Model:**
|
||||
|
||||
**Crucially, after launching with Ollama, you need to pull the desired model into the Ollama container.** Find the `MODEL_NAME` you configured in your `.env` file (e.g., `llama3.2:1b`). Then execute the following command to pull the model *inside* the running Ollama container:
|
||||
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml -f deployment/optional/docker-compose.optional.ollama-cpu.yaml exec -it ollama ollama pull <MODEL_NAME>
|
||||
```
|
||||
or (for GPU):
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml -f deployment/optional/docker-compose.optional.ollama-gpu.yaml exec -it ollama ollama pull <MODEL_NAME>
|
||||
```
|
||||
Replace `<MODEL_NAME>` with the actual model name from your `.env` file.
|
||||
|
||||
4. **Access DocsGPT in your browser:**
|
||||
|
||||
Once the model is pulled and containers are running, open your web browser and go to [http://localhost:5173/](http://localhost:5173/).
|
||||
|
||||
5. **Stopping Ollama Setup:**
|
||||
|
||||
To stop a DocsGPT setup launched with Ollama optional files, use `docker compose down` and include all the compose files used during the `up` command:
|
||||
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml -f deployment/optional/docker-compose.optional.ollama-cpu.yaml down
|
||||
```
|
||||
or
|
||||
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml -f deployment/optional/docker-compose.optional.ollama-gpu.yaml down
|
||||
```
|
||||
|
||||
**Important for GPU Usage:**
|
||||
|
||||
* **NVIDIA Container Toolkit (for NVIDIA GPUs):** If you are using NVIDIA GPUs, you need to have the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) installed and configured on your system for Docker to access your GPU.
|
||||
* **Docker GPU Configuration:** Ensure Docker is configured to utilize your GPU. Refer to the [Ollama Docker Hub page](https://hub.docker.com/r/ollama/ollama) and Docker documentation for GPU setup instructions specific to your GPU type (NVIDIA, AMD, Intel).
|
||||
|
||||
## Restarting After Configuration Changes
|
||||
|
||||
Whenever you modify the `.env` file or any Docker Compose files, you need to restart the Docker containers for the changes to be applied. Use the same `docker compose down` and `docker compose up -d` commands you used to launch DocsGPT, ensuring you include all relevant `-f` flags for optional files if you are using them.
|
||||
|
||||
## Further Configuration
|
||||
|
||||
This guide covers the basic Docker deployment of DocsGPT. For detailed information on configuring various aspects of DocsGPT, such as LLM providers, models, vector stores, and more, please refer to the comprehensive [DocsGPT Settings Guide](/Deploying/DocsGPT-Settings).
|
||||
107
docs/pages/Deploying/DocsGPT-Settings.md
Normal file
107
docs/pages/Deploying/DocsGPT-Settings.md
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
title: DocsGPT Settings
|
||||
description: Configure your DocsGPT application by understanding the basic settings.
|
||||
---
|
||||
|
||||
# DocsGPT Settings
|
||||
|
||||
DocsGPT is highly configurable, allowing you to tailor it to your specific needs and preferences. You can control various aspects of the application, from choosing the Large Language Model (LLM) provider to selecting embedding models and vector stores.
|
||||
|
||||
This document will guide you through the basic settings you can configure in DocsGPT. These settings determine how DocsGPT interacts with LLMs and processes your data.
|
||||
|
||||
## Configuration Methods
|
||||
|
||||
There are two primary ways to configure DocsGPT settings:
|
||||
|
||||
### 1. Configuration via `.env` file (Recommended)
|
||||
|
||||
The easiest and recommended way to configure basic settings is by using a `.env` file. This file should be located in the **root directory** of your DocsGPT project (the same directory where `setup.sh` is located).
|
||||
|
||||
**Example `.env` file structure:**
|
||||
|
||||
```
|
||||
LLM_NAME=openai
|
||||
API_KEY=YOUR_OPENAI_API_KEY
|
||||
MODEL_NAME=gpt-4o
|
||||
```
|
||||
|
||||
### 2. Configuration via `settings.py` file (Advanced)
|
||||
|
||||
For more advanced configurations or if you prefer to manage settings directly in code, you can modify the `settings.py` file. This file is located in the `application/core` directory of your DocsGPT project.
|
||||
|
||||
While modifying `settings.py` offers more flexibility, it's generally recommended to use the `.env` file for basic settings and reserve `settings.py` for more complex adjustments or when you need to configure settings programmatically.
|
||||
|
||||
**Location of `settings.py`:** `application/core/settings.py`
|
||||
|
||||
## Basic Settings Explained
|
||||
|
||||
Here are some of the most fundamental settings you'll likely want to configure:
|
||||
|
||||
- **`LLM_NAME`**: This setting determines which Large Language Model (LLM) provider DocsGPT will use. It tells DocsGPT which API to interact with.
|
||||
|
||||
- **Common values:**
|
||||
- `docsgpt`: Use the DocsGPT Public API Endpoint (simple and free, as offered in `setup.sh` option 1).
|
||||
- `openai`: Use OpenAI's API (requires an API key).
|
||||
- `google`: Use Google's Vertex AI or Gemini models.
|
||||
- `anthropic`: Use Anthropic's Claude models.
|
||||
- `groq`: Use Groq's models.
|
||||
- `huggingface`: Use HuggingFace Inference API.
|
||||
- `azure_openai`: Use Azure OpenAI Service.
|
||||
- `openai` (when using local inference engines like Ollama, Llama.cpp, TGI, etc.): This signals DocsGPT to use an OpenAI-compatible API format, even if the actual LLM is running locally.
|
||||
|
||||
- **`MODEL_NAME`**: Specifies the specific model to use from the chosen LLM provider. The available models depend on the `LLM_NAME` you've selected.
|
||||
|
||||
- **Examples:**
|
||||
- For `LLM_NAME=openai`: `gpt-4o`
|
||||
- For `LLM_NAME=google`: `gemini-2.0-flash`
|
||||
- For local models (e.g., Ollama): `llama3.2:1b` (or any model name available in your setup).
|
||||
|
||||
- **`EMBEDDINGS_NAME`**: This setting defines which embedding model DocsGPT will use to generate vector embeddings for your documents. Embeddings are numerical representations of text that allow DocsGPT to understand the semantic meaning of your documents for efficient search and retrieval.
|
||||
|
||||
- **Default value:** `huggingface_sentence-transformers/all-mpnet-base-v2` (a good general-purpose embedding model).
|
||||
- **Other options:** You can explore other embedding models from Hugging Face Sentence Transformers or other providers if needed.
|
||||
|
||||
- **`API_KEY`**: Required for most cloud-based LLM providers. This is your authentication key to access the LLM provider's API. You'll need to obtain this key from your chosen provider's platform.
|
||||
|
||||
- **`OPENAI_BASE_URL`**: Specifically used when `LLM_NAME` is set to `openai` but you are connecting to a local inference engine (like Ollama, Llama.cpp, etc.) that exposes an OpenAI-compatible API. This setting tells DocsGPT where to find your local LLM server.
|
||||
|
||||
## Configuration Examples
|
||||
|
||||
Let's look at some concrete examples of how to configure these settings in your `.env` file.
|
||||
|
||||
### Example for Cloud API Provider (OpenAI)
|
||||
|
||||
To use OpenAI's `gpt-4o` model, you would configure your `.env` file like this:
|
||||
|
||||
```
|
||||
LLM_NAME=openai
|
||||
API_KEY=YOUR_OPENAI_API_KEY # Replace with your actual OpenAI API key
|
||||
MODEL_NAME=gpt-4o
|
||||
```
|
||||
|
||||
Make sure to replace `YOUR_OPENAI_API_KEY` with your actual OpenAI API key.
|
||||
|
||||
### Example for Local Deployment
|
||||
|
||||
To use a local Ollama server with the `llama3.2:1b` model, you would configure your `.env` file like this:
|
||||
|
||||
```
|
||||
LLM_NAME=openai # Using OpenAI compatible API format for local models
|
||||
API_KEY=None # API Key is not needed for local Ollama
|
||||
MODEL_NAME=llama3.2:1b
|
||||
OPENAI_BASE_URL=http://host.docker.internal:11434/v1 # Default Ollama API URL within Docker
|
||||
EMBEDDINGS_NAME=huggingface_sentence-transformers/all-mpnet-base-v2 # You can also run embeddings locally if needed
|
||||
```
|
||||
|
||||
In this case, even though you are using Ollama locally, `LLM_NAME` is set to `openai` because Ollama (and many other local inference engines) are designed to be API-compatible with OpenAI. `OPENAI_BASE_URL` points DocsGPT to the local Ollama server.
|
||||
|
||||
## Exploring More Settings
|
||||
|
||||
These are just the basic settings to get you started. The `settings.py` file contains many more advanced options that you can explore to further customize DocsGPT, such as:
|
||||
|
||||
- Vector store configuration (`VECTOR_STORE`, Qdrant, Milvus, LanceDB settings)
|
||||
- Retriever settings (`RETRIEVERS_ENABLED`)
|
||||
- Cache settings (`CACHE_REDIS_URL`)
|
||||
- And many more!
|
||||
|
||||
For a complete list of available settings and their descriptions, refer to the `settings.py` file in `application/core`. Remember to restart your Docker containers after making changes to your `.env` file or `settings.py` for the changes to take effect.
|
||||
@@ -1,4 +1,10 @@
|
||||
# Self-hosting DocsGPT on Kubernetes
|
||||
---
|
||||
title: Deploying DocsGPT on Kubernetes
|
||||
description: Learn how to self-host DocsGPT on a Kubernetes cluster for scalable and robust deployments.
|
||||
---
|
||||
|
||||
# Self-hosting DocsGPT
|
||||
on Kubernetes
|
||||
|
||||
This guide will walk you through deploying DocsGPT on Kubernetes.
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
## Launching Web App
|
||||
**Note**: Make sure you have Docker installed
|
||||
|
||||
**On macOS or Linux:**
|
||||
Just run the following command:
|
||||
|
||||
```bash
|
||||
./setup.sh
|
||||
```
|
||||
|
||||
This command will install all the necessary dependencies and provide you with an option to use our LLM API, download the local model or use OpenAI.
|
||||
|
||||
If you prefer to follow manual steps, refer to this guide:
|
||||
|
||||
1. Open and download this repository with
|
||||
```bash
|
||||
git clone https://github.com/arc53/DocsGPT.git
|
||||
cd DocsGPT
|
||||
```
|
||||
2. Create a `.env` file in your root directory and set the env variables.
|
||||
It should look like this inside:
|
||||
|
||||
```
|
||||
LLM_NAME=[docsgpt or openai or others]
|
||||
API_KEY=[if LLM_NAME is openai]
|
||||
```
|
||||
|
||||
See optional environment variables in the [/application/.env_sample](https://github.com/arc53/DocsGPT/blob/main/application/.env_sample) file.
|
||||
|
||||
3. Run the following commands:
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml up
|
||||
```
|
||||
4. Navigate to http://localhost:5173/.
|
||||
|
||||
To stop, simply press **Ctrl + C**.
|
||||
|
||||
**For WINDOWS:**
|
||||
|
||||
1. Open and download this repository with
|
||||
```bash
|
||||
git clone https://github.com/arc53/DocsGPT.git
|
||||
cd DocsGPT
|
||||
```
|
||||
|
||||
2. Create a `.env` file in your root directory and set the env variables.
|
||||
It should look like this inside:
|
||||
|
||||
```
|
||||
LLM_NAME=[docsgpt or openai or others]
|
||||
API_KEY=[if LLM_NAME is openai]
|
||||
```
|
||||
|
||||
See optional environment variables in the [/application/.env_sample](https://github.com/arc53/DocsGPT/blob/main/application/.env_sample) file.
|
||||
|
||||
3. Run the following command:
|
||||
|
||||
```bash
|
||||
docker compose -f deployment/docker-compose.yaml up
|
||||
```
|
||||
4. Navigate to http://localhost:5173/.
|
||||
5. To stop the setup, just press **Ctrl + C** in the WSL terminal
|
||||
|
||||
**Important:** Ensure that Docker is installed and properly configured on your Windows system for these steps to work.
|
||||
@@ -1,254 +0,0 @@
|
||||
|
||||
# Self-hosting DocsGPT on Railway
|
||||
|
||||
|
||||
|
||||
Here's a step-by-step guide on how to host DocsGPT on Railway App.
|
||||
|
||||
|
||||
|
||||
At first Clone and set up the project locally to run , test and Modify.
|
||||
|
||||
|
||||
|
||||
### 1. Clone and GitHub SetUp
|
||||
|
||||
a. Open Terminal (Windows Shell or Git bash(recommended)).
|
||||
|
||||
|
||||
|
||||
b. Type `git clone https://github.com/arc53/DocsGPT.git`
|
||||
|
||||
|
||||
|
||||
#### Download the package information
|
||||
|
||||
|
||||
|
||||
Once it has finished cloning the repository, it is time to download the package information from all sources. To do so, simply enter the following command:
|
||||
|
||||
|
||||
|
||||
`sudo apt update`
|
||||
|
||||
|
||||
|
||||
#### Install Docker and Docker Compose
|
||||
|
||||
|
||||
|
||||
DocsGPT backend and worker use Python, Frontend is written on React and the whole application is containerized using Docker. To install Docker and Docker Compose, enter the following commands:
|
||||
|
||||
|
||||
|
||||
`sudo apt install docker.io`
|
||||
|
||||
|
||||
|
||||
And now install docker-compose:
|
||||
|
||||
|
||||
|
||||
`sudo apt install docker-compose`
|
||||
|
||||
|
||||
|
||||
#### Access the DocsGPT Folder
|
||||
|
||||
|
||||
|
||||
Enter the following command to access the folder in which the DocsGPT docker-compose file is present.
|
||||
|
||||
|
||||
|
||||
`cd DocsGPT/`
|
||||
|
||||
|
||||
|
||||
#### Prepare the Environment
|
||||
|
||||
|
||||
|
||||
Inside the DocsGPT folder create a `.env` file and copy the contents of `.env_sample` into it.
|
||||
|
||||
|
||||
|
||||
`nano .env`
|
||||
|
||||
|
||||
|
||||
Make sure your `.env` file looks like this:
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
OPENAI_API_KEY=(Your OpenAI API key)
|
||||
|
||||
VITE_API_STREAMING=true
|
||||
|
||||
SELF_HOSTED_MODEL=false
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
To save the file, press CTRL+X, then Y, and then ENTER.
|
||||
|
||||
|
||||
|
||||
Next, set the correct IP for the Backend by opening the docker-compose.yaml file:
|
||||
|
||||
|
||||
|
||||
`nano deployment/docker-compose.yaml`
|
||||
|
||||
|
||||
|
||||
And Change line 7 to: `VITE_API_HOST=http://localhost:7091`
|
||||
|
||||
to this `VITE_API_HOST=http://<your instance public IP>:7091`
|
||||
|
||||
|
||||
|
||||
This will allow the frontend to connect to the backend.
|
||||
|
||||
|
||||
|
||||
#### Running the Application
|
||||
|
||||
|
||||
|
||||
You're almost there! Now that all the necessary bits and pieces have been installed, it is time to run the application. To do so, use the following command:
|
||||
|
||||
|
||||
|
||||
`sudo docker compose -f deployment/docker-compose.yaml up -d`
|
||||
|
||||
|
||||
|
||||
Launching it for the first time will take a few minutes to download all the necessary dependencies and build.
|
||||
|
||||
|
||||
|
||||
Once this is done you can go ahead and close the terminal window.
|
||||
|
||||
|
||||
|
||||
### 2. Pushing it to your own Repository
|
||||
|
||||
|
||||
|
||||
a. Create a Repository on your GitHub.
|
||||
|
||||
|
||||
|
||||
b. Open Terminal in the same directory of the Cloned project.
|
||||
|
||||
|
||||
|
||||
c. Type `git init`
|
||||
|
||||
|
||||
|
||||
d. `git add .`
|
||||
|
||||
|
||||
|
||||
e. `git commit -m "first-commit"`
|
||||
|
||||
|
||||
|
||||
f. `git remote add origin <your repository link>`
|
||||
|
||||
|
||||
|
||||
g. `git push git push --set-upstream origin master`
|
||||
|
||||
Your local files will now be pushed to your GitHub Account. :)
|
||||
|
||||
|
||||
### 3. Create a Railway Account:
|
||||
|
||||
|
||||
|
||||
If you haven't already, create or log in to your railway account do it by visiting [Railway](https://railway.app/)
|
||||
|
||||
|
||||
|
||||
Signup via **GitHub** [Recommended].
|
||||
|
||||
|
||||
|
||||
### 4. Start New Project:
|
||||
|
||||
|
||||
|
||||
a. Open Railway app and Click on "Start New Project."
|
||||
|
||||
|
||||
|
||||
b. Choose any from the list of options available (Recommended "**Deploy from GitHub Repo**")
|
||||
|
||||
|
||||
|
||||
c. Choose the required Repository from your GitHub.
|
||||
|
||||
|
||||
|
||||
d. Configure and allow access to modify your GitHub content from the pop-up window.
|
||||
|
||||
|
||||
|
||||
e. Agree to all the terms and conditions.
|
||||
|
||||
|
||||
|
||||
PS: It may take a few minutes for the account setup to complete.
|
||||
|
||||
|
||||
|
||||
#### You will get A free trial of $5 (use it for trial and then purchase if satisfied and needed)
|
||||
|
||||
|
||||
|
||||
### 5. Connecting to Your newly Railway app with GitHub
|
||||
|
||||
|
||||
|
||||
a. Choose DocsGPT repo from the list of your GitHub repository that you want to deploy now.
|
||||
|
||||
|
||||
|
||||
b. Click on Deploy now.
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
c. Select Variables Tab.
|
||||
|
||||
|
||||
|
||||
d. Upload the env file here that you used for local setup.
|
||||
|
||||
|
||||
|
||||
e. Go to Settings Tab now.
|
||||
|
||||
|
||||
|
||||
f. Go to "Networking" and click on Generate Domain Name, to get the URL of your hosted project.
|
||||
|
||||
|
||||
|
||||
g. You can update the Root directory, build command, installation command as per need.
|
||||
|
||||
*[However recommended not the disturb these options and leave them as default if not that needed.]*
|
||||
|
||||
|
||||
|
||||
|
||||
Your own DocsGPT is now available at the Generated domain URl. :)
|
||||
@@ -1,22 +1,22 @@
|
||||
{
|
||||
"Hosting-the-app": {
|
||||
"title": "☁️ Hosting DocsGPT",
|
||||
"href": "/Deploying/Hosting-the-app"
|
||||
"DocsGPT-Settings": {
|
||||
"title": "⚙️ App Configuration",
|
||||
"href": "/Deploying/DocsGPT-Settings"
|
||||
},
|
||||
"Quickstart": {
|
||||
"title": "⚡️Quickstart",
|
||||
"href": "/Deploying/Quickstart"
|
||||
"Docker-Deploying": {
|
||||
"title": "🛳️ Docker Setup",
|
||||
"href": "/Deploying/Docker-Deploying"
|
||||
},
|
||||
"Development-Environment": {
|
||||
"title": "🛠️Development Environment",
|
||||
"href": "/Deploying/Development-Environment"
|
||||
},
|
||||
"Railway-Deploying": {
|
||||
"title": "🚂Deploying on Railway",
|
||||
"href": "/Deploying/Railway-Deploying"
|
||||
},
|
||||
"Kubernetes-Deploying": {
|
||||
"title": "☸️Deploying on Kubernetes",
|
||||
"title": "☸️ Deploying on Kubernetes",
|
||||
"href": "/Deploying/Kubernetes-Deploying"
|
||||
},
|
||||
"Hosting-the-app": {
|
||||
"title": "☁️ Hosting DocsGPT",
|
||||
"href": "/Deploying/Hosting-the-app"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user