mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
78 lines
2.4 KiB
Markdown
78 lines
2.4 KiB
Markdown
## 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`. |