Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Dec 2, 2024
1 parent 019e681 commit 41ed5ba
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pr-integration-tests-parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ jobs:
run: |
echo "Running integration tests..."
docker run \
-e PYTHONPATH=/app \
-v /var/run/docker.sock:/var/run/docker.sock \
--network host \
danswer/danswer-integration:test \
/usr/local/bin/python /app/tests/integration/run.py
# allow container to start docker containers
python /app/tests/integration/run.py
continue-on-error: true
id: run_tests

Expand Down
4 changes: 2 additions & 2 deletions backend/requirements/model_server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cohere==5.6.1
fastapi==0.109.2
google-cloud-aiplatform==1.58.0
numpy==1.26.4
openai==1.52.2
openai==1.55.3
pydantic==2.8.2
retry==0.9.2
safetensors==0.4.2
Expand All @@ -12,5 +12,5 @@ torch==2.2.0
transformers==4.39.2
uvicorn==0.21.1
voyageai==0.2.3
litellm==1.50.2
litellm==1.53.1
sentry-sdk[fastapi,celery,starlette]==2.14.0
45 changes: 23 additions & 22 deletions backend/tests/integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ FROM python:3.11.7-slim-bookworm
# Currently needs all dependencies, since the ITs use some of the Danswer
# backend code.

# Add Docker's official GPG key and repository for Debian
RUN apt-get update && \
apt-get install -y ca-certificates curl && \
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update


# Install system dependencies
# cmake needed for psycopg (postgres)
# libpq-dev needed for psycopg (postgres)
Expand All @@ -15,6 +28,9 @@ RUN apt-get update && \
curl \
zip \
ca-certificates \
postgresql-client \
# Install Docker for DinD
docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin \
libgnutls30=3.7.9-2+deb12u3 \
libblkid1=2.38.1-5+deb12u1 \
libmount1=2.38.1-5+deb12u1 \
Expand All @@ -29,37 +45,19 @@ RUN apt-get update && \
# Install Python dependencies
# Remove py which is pulled in by retry, py is not needed and is a CVE
COPY ./requirements/default.txt /tmp/requirements.txt
COPY ./requirements/model_server.txt /tmp/model_server-requirements.txt
COPY ./requirements/ee.txt /tmp/ee-requirements.txt
RUN pip install --no-cache-dir --upgrade \
--retries 5 \
--timeout 30 \
-r /tmp/requirements.txt \
-r /tmp/model_server-requirements.txt \
-r /tmp/ee-requirements.txt && \
pip uninstall -y py && \
playwright install chromium && \
playwright install-deps chromium && \
ln -s /usr/local/bin/supervisord /usr/bin/supervisord

# Cleanup for CVEs and size reduction
# https://github.com/tornadoweb/tornado/issues/3107
# xserver-common and xvfb included by playwright installation but not needed after
# perl-base is part of the base Python Debian image but not needed for Danswer functionality
# perl-base could only be removed with --allow-remove-essential
RUN apt-get update && \
apt-get remove -y --allow-remove-essential \
perl-base \
xserver-common \
xvfb \
cmake \
libldap-2.5-0 \
libxmlsec1-dev \
pkg-config \
gcc && \
apt-get install -y libxmlsec1-openssl && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* && \
rm -f /usr/local/lib/python3.11/site-packages/tornado/test/test.key

# Set up application files
WORKDIR /app

Expand All @@ -75,6 +73,9 @@ COPY ./alembic.ini /app/alembic.ini
COPY ./pytest.ini /app/pytest.ini
COPY supervisord.conf /usr/etc/supervisord.conf

# need to copy over model server as well, since we're running it in the same container
COPY ./model_server /app/model_server

# Integration test stuff
COPY ./requirements/dev.txt /tmp/dev-requirements.txt
RUN pip install --no-cache-dir --upgrade \
Expand All @@ -83,5 +84,5 @@ COPY ./tests/integration /app/tests/integration

ENV PYTHONPATH=/app

ENTRYPOINT ["pytest", "-s"]
CMD ["/app/tests/integration", "--ignore=/app/tests/integration/multitenant_tests"]
ENTRYPOINT []
CMD ["pytest", "-s", "/app/tests/integration", "--ignore=/app/tests/integration/multitenant_tests"]

0 comments on commit 41ed5ba

Please sign in to comment.