Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit f8c5834

Browse files
authored
Merge pull request #55 from mindvalley/chore/merge-upstream-2024091301
chore/merge upstream 2024091301
2 parents 14cc570 + 8a9b16f commit f8c5834

File tree

340 files changed

+12016
-4178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+12016
-4178
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 'Build and Push Docker Image with Retry'
2+
description: 'Attempts to build and push a Docker image, with a retry on failure'
3+
inputs:
4+
context:
5+
description: 'Build context'
6+
required: true
7+
file:
8+
description: 'Dockerfile location'
9+
required: true
10+
platforms:
11+
description: 'Target platforms'
12+
required: true
13+
pull:
14+
description: 'Always attempt to pull a newer version of the image'
15+
required: false
16+
default: 'true'
17+
push:
18+
description: 'Push the image to registry'
19+
required: false
20+
default: 'true'
21+
load:
22+
description: 'Load the image into Docker daemon'
23+
required: false
24+
default: 'true'
25+
tags:
26+
description: 'Image tags'
27+
required: true
28+
cache-from:
29+
description: 'Cache sources'
30+
required: false
31+
cache-to:
32+
description: 'Cache destinations'
33+
required: false
34+
retry-wait-time:
35+
description: 'Time to wait before retry in seconds'
36+
required: false
37+
default: '5'
38+
39+
runs:
40+
using: "composite"
41+
steps:
42+
- name: Build and push Docker image (First Attempt)
43+
id: buildx1
44+
uses: docker/build-push-action@v5
45+
continue-on-error: true
46+
with:
47+
context: ${{ inputs.context }}
48+
file: ${{ inputs.file }}
49+
platforms: ${{ inputs.platforms }}
50+
pull: ${{ inputs.pull }}
51+
push: ${{ inputs.push }}
52+
load: ${{ inputs.load }}
53+
tags: ${{ inputs.tags }}
54+
cache-from: ${{ inputs.cache-from }}
55+
cache-to: ${{ inputs.cache-to }}
56+
57+
- name: Wait to retry
58+
if: steps.buildx1.outcome != 'success'
59+
run: |
60+
echo "First attempt failed. Waiting ${{ inputs.retry-wait-time }} seconds before retry..."
61+
sleep ${{ inputs.retry-wait-time }}
62+
shell: bash
63+
64+
- name: Build and push Docker image (Retry Attempt)
65+
if: steps.buildx1.outcome != 'success'
66+
uses: docker/build-push-action@v5
67+
with:
68+
context: ${{ inputs.context }}
69+
file: ${{ inputs.file }}
70+
platforms: ${{ inputs.platforms }}
71+
pull: ${{ inputs.pull }}
72+
push: ${{ inputs.push }}
73+
load: ${{ inputs.load }}
74+
tags: ${{ inputs.tags }}
75+
cache-from: ${{ inputs.cache-from }}
76+
cache-to: ${{ inputs.cache-to }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This workflow is intentionally disabled while we're still working on it
2+
# It's close to ready, but a race condition needs to be fixed with
3+
# API server and Vespa startup, and it needs to have a way to build/test against
4+
# local containers
5+
6+
name: Helm - Lint and Test Charts
7+
8+
on:
9+
merge_group:
10+
pull_request:
11+
branches: [ main ]
12+
13+
jobs:
14+
lint-test:
15+
runs-on: Amd64
16+
17+
# fetch-depth 0 is required for helm/chart-testing-action
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up Helm
25+
uses: azure/[email protected]
26+
with:
27+
version: v3.14.4
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: '3.11'
33+
cache: 'pip'
34+
cache-dependency-path: |
35+
backend/requirements/default.txt
36+
backend/requirements/dev.txt
37+
backend/requirements/model_server.txt
38+
- run: |
39+
python -m pip install --upgrade pip
40+
pip install -r backend/requirements/default.txt
41+
pip install -r backend/requirements/dev.txt
42+
pip install -r backend/requirements/model_server.txt
43+
44+
- name: Set up chart-testing
45+
uses: helm/[email protected]
46+
47+
- name: Run chart-testing (list-changed)
48+
id: list-changed
49+
run: |
50+
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
51+
if [[ -n "$changed" ]]; then
52+
echo "changed=true" >> "$GITHUB_OUTPUT"
53+
fi
54+
55+
- name: Run chart-testing (lint)
56+
# if: steps.list-changed.outputs.changed == 'true'
57+
run: ct lint --all --config ct.yaml --target-branch ${{ github.event.repository.default_branch }}
58+
59+
- name: Create kind cluster
60+
# if: steps.list-changed.outputs.changed == 'true'
61+
uses: helm/[email protected]
62+
63+
- name: Run chart-testing (install)
64+
# if: steps.list-changed.outputs.changed == 'true'
65+
run: ct install --all --config ct.yaml
66+
# run: ct install --target-branch ${{ github.event.repository.default_branch }}
67+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Connector Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
schedule:
7+
# This cron expression runs the job daily at 16:00 UTC (9am PT)
8+
- cron: "0 16 * * *"
9+
10+
env:
11+
# Confluence
12+
CONFLUENCE_TEST_SPACE_URL: ${{ secrets.CONFLUENCE_TEST_SPACE_URL }}
13+
CONFLUENCE_TEST_SPACE: ${{ secrets.CONFLUENCE_TEST_SPACE }}
14+
CONFLUENCE_IS_CLOUD: ${{ secrets.CONFLUENCE_IS_CLOUD }}
15+
CONFLUENCE_TEST_PAGE_ID: ${{ secrets.CONFLUENCE_TEST_PAGE_ID }}
16+
CONFLUENCE_USER_NAME: ${{ secrets.CONFLUENCE_USER_NAME }}
17+
CONFLUENCE_ACCESS_TOKEN: ${{ secrets.CONFLUENCE_ACCESS_TOKEN }}
18+
19+
jobs:
20+
connectors-check:
21+
runs-on: ubuntu-latest
22+
23+
env:
24+
PYTHONPATH: ./backend
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: "3.11"
34+
cache: "pip"
35+
cache-dependency-path: |
36+
backend/requirements/default.txt
37+
backend/requirements/dev.txt
38+
39+
- name: Install Dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install -r backend/requirements/default.txt
43+
pip install -r backend/requirements/dev.txt
44+
45+
- name: Run Tests
46+
shell: script -q -e -c "bash --noprofile --norc -eo pipefail {0}"
47+
run: py.test -o junit_family=xunit2 -xv --ff backend/tests/daily/connectors
48+
49+
- name: Alert on Failure
50+
if: failure() && github.event_name == 'schedule'
51+
env:
52+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
53+
run: |
54+
curl -X POST \
55+
-H 'Content-type: application/json' \
56+
--data '{"text":"Scheduled Connector Tests failed! Check the run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' \
57+
$SLACK_WEBHOOK

.github/workflows/run-it.yml

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,60 +28,44 @@ jobs:
2828
username: ${{ secrets.DOCKER_USERNAME }}
2929
password: ${{ secrets.DOCKER_TOKEN }}
3030

31-
- name: Build Web Docker image
32-
uses: docker/build-push-action@v5
33-
with:
34-
context: ./web
35-
file: ./web/Dockerfile
36-
platforms: linux/arm64
37-
pull: true
38-
push: true
39-
load: true
40-
tags: danswer/danswer-web-server:it
41-
cache-from: type=registry,ref=danswer/danswer-web-server:it
42-
cache-to: |
43-
type=registry,ref=danswer/danswer-web-server:it,mode=max
44-
type=inline
31+
# NOTE: we don't need to build the Web Docker image since it's not used
32+
# during the IT for now. We have a separate action to verify it builds
33+
# succesfully
34+
- name: Pull Web Docker image
35+
run: |
36+
docker pull danswer/danswer-web-server:latest
37+
docker tag danswer/danswer-web-server:latest danswer/danswer-web-server:it
4538
4639
- name: Build Backend Docker image
47-
uses: docker/build-push-action@v5
40+
uses: ./.github/actions/custom-build-and-push
4841
with:
4942
context: ./backend
5043
file: ./backend/Dockerfile
5144
platforms: linux/arm64
52-
pull: true
53-
push: true
54-
load: true
5545
tags: danswer/danswer-backend:it
5646
cache-from: type=registry,ref=danswer/danswer-backend:it
5747
cache-to: |
5848
type=registry,ref=danswer/danswer-backend:it,mode=max
5949
type=inline
6050
6151
- name: Build Model Server Docker image
62-
uses: docker/build-push-action@v5
52+
uses: ./.github/actions/custom-build-and-push
6353
with:
6454
context: ./backend
6555
file: ./backend/Dockerfile.model_server
6656
platforms: linux/arm64
67-
pull: true
68-
push: true
69-
load: true
7057
tags: danswer/danswer-model-server:it
7158
cache-from: type=registry,ref=danswer/danswer-model-server:it
7259
cache-to: |
7360
type=registry,ref=danswer/danswer-model-server:it,mode=max
7461
type=inline
7562
7663
- name: Build integration test Docker image
77-
uses: docker/build-push-action@v5
64+
uses: ./.github/actions/custom-build-and-push
7865
with:
7966
context: ./backend
8067
file: ./backend/tests/integration/Dockerfile
8168
platforms: linux/arm64
82-
pull: true
83-
push: true
84-
load: true
8569
tags: danswer/integration-test-runner:it
8670
cache-from: type=registry,ref=danswer/integration-test-runner:it
8771
cache-to: |
@@ -92,8 +76,11 @@ jobs:
9276
run: |
9377
cd deployment/docker_compose
9478
ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=true \
79+
AUTH_TYPE=basic \
80+
REQUIRE_EMAIL_VERIFICATION=false \
81+
DISABLE_TELEMETRY=true \
9582
IMAGE_TAG=it \
96-
docker compose -f docker-compose.dev.yml -p danswer-stack up -d --build
83+
docker compose -f docker-compose.dev.yml -p danswer-stack up -d
9784
id: start_docker
9885

9986
- name: Wait for service to be ready
@@ -137,6 +124,7 @@ jobs:
137124
-e POSTGRES_PASSWORD=password \
138125
-e POSTGRES_DB=postgres \
139126
-e VESPA_HOST=index \
127+
-e REDIS_HOST=cache \
140128
-e API_SERVER_HOST=api_server \
141129
-e OPENAI_API_KEY=${OPENAI_API_KEY} \
142130
danswer/integration-test-runner:it

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
.idea
66
.python-version
77
/deployment/data/nginx/app.conf
8-
.vscode/launch.json
8+
.vscode/
99
*.sw?
1010
/backend/tests/regression/answer_quality/search_test_config.yaml

.vscode/env_template.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Copy this file to .env at the base of the repo and fill in the <REPLACE THIS> values
2-
# This will help with development iteration speed and reduce repeat tasks for dev
1+
# Copy this file to .env in the .vscode folder
2+
# Fill in the <REPLACE THIS> values as needed, it is recommended to set the GEN_AI_API_KEY value to avoid having to set up an LLM in the UI
33
# Also check out danswer/backend/scripts/restart_containers.sh for a script to restart the containers which Danswer relies on outside of VSCode/Cursor processes
44

55
# For local dev, often user Authentication is not needed
@@ -15,7 +15,7 @@ LOG_LEVEL=debug
1515

1616
# This passes top N results to LLM an additional time for reranking prior to answer generation
1717
# This step is quite heavy on token usage so we disable it for dev generally
18-
DISABLE_LLM_DOC_RELEVANCE=True
18+
DISABLE_LLM_DOC_RELEVANCE=False
1919

2020

2121
# Useful if you want to toggle auth on/off (google_oauth/OIDC specifically)
@@ -27,9 +27,9 @@ REQUIRE_EMAIL_VERIFICATION=False
2727

2828
# Set these so if you wipe the DB, you don't end up having to go through the UI every time
2929
GEN_AI_API_KEY=<REPLACE THIS>
30-
# If answer quality isn't important for dev, use 3.5 turbo due to it being cheaper
31-
GEN_AI_MODEL_VERSION=gpt-3.5-turbo
32-
FAST_GEN_AI_MODEL_VERSION=gpt-3.5-turbo
30+
# If answer quality isn't important for dev, use gpt-4o-mini since it's cheaper
31+
GEN_AI_MODEL_VERSION=gpt-4o
32+
FAST_GEN_AI_MODEL_VERSION=gpt-4o
3333

3434
# For Danswer Slack Bot, overrides the UI values so no need to set this up via UI every time
3535
# Only needed if using DanswerBot
@@ -38,7 +38,7 @@ FAST_GEN_AI_MODEL_VERSION=gpt-3.5-turbo
3838

3939

4040
# Python stuff
41-
PYTHONPATH=./backend
41+
PYTHONPATH=../backend
4242
PYTHONUNBUFFERED=1
4343

4444

@@ -49,4 +49,3 @@ BING_API_KEY=<REPLACE THIS>
4949
# Enable the full set of Danswer Enterprise Edition features
5050
# NOTE: DO NOT ENABLE THIS UNLESS YOU HAVE A PAID ENTERPRISE LICENSE (or if you are using this for local testing/development)
5151
ENABLE_PAID_ENTERPRISE_EDITION_FEATURES=False
52-

0 commit comments

Comments
 (0)