From fce7d3417146e36d29efbfd6928bc763685512b3 Mon Sep 17 00:00:00 2001 From: Levente Csoke Date: Thu, 15 Jun 2023 17:02:52 +0200 Subject: [PATCH] Improve dev setup in README Add needed packages in for dev setup in requirements.txt --- README.md | 54 ++++++++++++++++++++++++------------ application/requirements.txt | 3 ++ 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f2b8ef65..eb4036e0 100644 --- a/README.md +++ b/README.md @@ -73,30 +73,50 @@ To stop just run Ctrl + C ## Development environments -Spin up only 2 containers from docker-compose.yaml (by deleting all services except for redis and mongo) +### Spin up mongo and redis +For development only 2 containers are used from docker-compose.yaml (by deleting all services except for redis and mongo). +See file [docker-compose-dev.yaml](./docker-compose-dev.yaml). -Make sure you have python 3.10 or 3.11 installed +Run +``` +docker compose -f docker-compose-dev.yaml build +docker compose -f docker-compose-dev.yaml up -d +``` -1. Navigate to `/application` folder -2. Run `docker-compose -f docker-compose-dev.yaml build && docker-compose -f docker-compose-dev.yaml up -d` -3. Export required variables -`export CELERY_BROKER_URL=redis://localhost:6379/0` -`export CELERY_RESULT_BACKEND=redis://localhost:6379/1` -`export MONGO_URI=mongodb://localhost:27017/docsgpt` -4. Install dependencies -`pip install -r requirements.txt` -5. Prepare .env file -Copy .env_sample and create .env with your openai api token -6. Run the app +### Run the backend + +Make sure you have Python 3.10 or 3.11 installed. + +1. Export required environment variables +```commandline +export CELERY_BROKER_URL=redis://localhost:6379/0 +export CELERY_RESULT_BACKEND=redis://localhost:6379/1 +export MONGO_URI=mongodb://localhost:27017/docsgpt +``` +2. Prepare .env file +Copy `.env_sample` and create `.env` with your OpenAI API token +3. (optional) Create a python virtual environment +```commandline +python -m venv venv +. venv/bin/activate +``` +4. Change to `application/` subdir and install dependencies for the backend +```commandline +cd application/ +pip install -r requirements.txt +``` +5 . Run the app `python wsgi.py` -7. Start worker with `celery -A app.celery worker -l INFO` +6. Start worker with `celery -A app.celery worker -l INFO` + +### Start frontend +Make sure you have Node version 14+ -To start frontend 1. Navigate to `/frontend` folder 2. Install dependencies `npm install` -3. Run the app -4. `npm run dev` +3. Run the app +`npm run dev` [How to install the Chrome extension](https://github.com/arc53/docsgpt/wiki#launch-chrome-extension) diff --git a/application/requirements.txt b/application/requirements.txt index f6ff97b5..dda008c0 100644 --- a/application/requirements.txt +++ b/application/requirements.txt @@ -10,6 +10,7 @@ billiard==3.6.4.0 blobfile==2.0.1 boto3==1.26.102 botocore==1.29.102 +celery cffi==1.15.1 charset-normalizer==3.1.0 click==8.1.3 @@ -52,6 +53,7 @@ multidict==6.0.4 multiprocess==0.70.14 mypy-extensions==1.0.0 networkx==3.0 +npx nltk==3.8.1 numcodecs==0.11.0 numpy==1.24.2 @@ -93,6 +95,7 @@ SQLAlchemy==1.4.46 sympy==1.11.1 tenacity==8.2.2 threadpoolctl==3.1.0 +tiktoken torch==2.0.0 torchvision==0.15.1 tqdm==4.65.0