Skip to content

Commit

Permalink
Misc clarifications for CONTRIBUTING.md (#2401)
Browse files Browse the repository at this point in the history
* Reorder and clarify dependency installation instructions

* Clarify instructions for local development with Docker external deps vs full Docker stack

* Final words at the end of the local setup process

---------

Co-authored-by: danswer-trial <danswer-trial@danswer-trials-MacBook-Pro.local>
  • Loading branch information
trial-danswer and danswer-trial authored Sep 11, 2024
1 parent f4f2fb5 commit eab55bd
Showing 1 changed file with 43 additions and 16 deletions.
59 changes: 43 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ Danswer being a fully functional app, relies on some external software, specific


> **Note:**
> This guide provides instructions to set up the Danswer specific services outside of Docker because it's easier for
> development purposes. However, you can also use the containers and update with local changes by providing the
> `--build` flag.
> This guide provides instructions to build and run Danswer locally from source with Docker containers providing the above external software. We believe this combination is easier for
> development purposes. If you prefer to use pre-built container images, we provide instructions on running the full Danswer stack within Docker below.

### Local Set Up
Expand All @@ -68,7 +67,7 @@ If using a lower version, modifications will have to be made to the code.
If using a higher version, sometimes some libraries will not be available (i.e. we had problems with Tensorflow in the past with higher versions of python).


#### Installing Requirements
#### Backend: Python requirements
Currently, we use pip and recommend creating a virtual environment.

For convenience here's a command for it:
Expand Down Expand Up @@ -98,26 +97,24 @@ pip install -r danswer/backend/requirements/ee.txt
pip install -r danswer/backend/requirements/model_server.txt
```

Install Playwright for Python (headless browser required by the Web Connector)

Install [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for the frontend.
Once the above is done, navigate to `danswer/web` run:
In the activated Python virtualenv, install Playwright for Python by running:
```bash
npm i
playwright install
```

Install Playwright (headless browser required by the Web Connector)
You may have to deactivate and reactivate your virtualenv for `playwright` to appear on your path.

> **Note:**
> If you have just run the pip install, open a new terminal and source the python virtual-env again.
> This will pull the updated PATH to include playwright
#### Frontend: Node dependencies

Then install Playwright by running:
Install [Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for the frontend.
Once the above is done, navigate to `danswer/web` run:
```bash
playwright install
npm i
```


#### Dependent Docker Containers
#### Docker containers for external software
You will need Docker installed to run these containers.

First navigate to `danswer/deployment/docker_compose`, then start up Postgres/Vespa/Redis with:
Expand All @@ -127,7 +124,7 @@ docker compose -f docker-compose.dev.yml -p danswer-stack up -d index relational
(index refers to Vespa, relational_db refers to Postgres, and cache refers to Redis)


#### Running Danswer
#### Running Danswer locally
To start the frontend, navigate to `danswer/web` and run:
```bash
npm run dev
Expand Down Expand Up @@ -176,6 +173,36 @@ powershell -Command "
> **Note:**
> If you need finer logging, add the additional environment variable `LOG_LEVEL=DEBUG` to the relevant services.
#### Wrapping up

You should now have 4 servers running:

- Web server
- Backend API
- Model server
- Background jobs

Now, visit `http://localhost:3000` in your browser. You should see the Danswer onboarding wizard where you can connect your external LLM provider to Danswer.

You've successfully set up a local Danswer instance! 🏁

#### Running the Danswer application in a container

You can run the full Danswer application stack from pre-built images including all external software dependencies.

Navigate to `danswer/deployment/docker_compose` and run:

```bash
docker compose up
```

After Docker pulls and starts these containers, navigate to `http://localhost:3000` to use Danswer.

If you want to make changes to Danswer and run those changes in Docker, you can also build a local version of the Danswer container images that incorporates your changes like so:

```bash
docker compose up --build
```

### Formatting and Linting
#### Backend
Expand Down

0 comments on commit eab55bd

Please sign in to comment.