mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-18 09:02:52 +02:00
Feat/certificate (#2998)
* first pass * simplify * remove now unneeded COPY command * minor clean up * k * nit
This commit is contained in:
@ -12,7 +12,6 @@ ARG DANSWER_VERSION=0.8-dev
|
|||||||
ENV DANSWER_VERSION=${DANSWER_VERSION} \
|
ENV DANSWER_VERSION=${DANSWER_VERSION} \
|
||||||
DANSWER_RUNNING_IN_DOCKER="true"
|
DANSWER_RUNNING_IN_DOCKER="true"
|
||||||
|
|
||||||
ARG CA_CERT_CONTENT=""
|
|
||||||
|
|
||||||
RUN echo "DANSWER_VERSION: ${DANSWER_VERSION}"
|
RUN echo "DANSWER_VERSION: ${DANSWER_VERSION}"
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
@ -39,15 +38,6 @@ RUN apt-get update && \
|
|||||||
apt-get clean
|
apt-get clean
|
||||||
|
|
||||||
|
|
||||||
# Conditionally write the CA certificate and update certificates
|
|
||||||
RUN if [ -n "$CA_CERT_CONTENT" ]; then \
|
|
||||||
echo "Adding custom CA certificate"; \
|
|
||||||
echo "$CA_CERT_CONTENT" > /usr/local/share/ca-certificates/my-ca.crt && \
|
|
||||||
chmod 644 /usr/local/share/ca-certificates/my-ca.crt && \
|
|
||||||
update-ca-certificates; \
|
|
||||||
else \
|
|
||||||
echo "No custom CA certificate provided"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
# Remove py which is pulled in by retry, py is not needed and is a CVE
|
# Remove py which is pulled in by retry, py is not needed and is a CVE
|
||||||
@ -87,7 +77,6 @@ RUN apt-get update && \
|
|||||||
RUN python -c "from tokenizers import Tokenizer; \
|
RUN python -c "from tokenizers import Tokenizer; \
|
||||||
Tokenizer.from_pretrained('nomic-ai/nomic-embed-text-v1')"
|
Tokenizer.from_pretrained('nomic-ai/nomic-embed-text-v1')"
|
||||||
|
|
||||||
|
|
||||||
# Pre-downloading NLTK for setups with limited egress
|
# Pre-downloading NLTK for setups with limited egress
|
||||||
RUN python -c "import nltk; \
|
RUN python -c "import nltk; \
|
||||||
nltk.download('stopwords', quiet=True); \
|
nltk.download('stopwords', quiet=True); \
|
||||||
|
@ -114,7 +114,12 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ../../backend
|
context: ../../backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
command: /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
command: >
|
||||||
|
/bin/sh -c "
|
||||||
|
if [ -f /etc/ssl/certs/custom-ca.crt ]; then
|
||||||
|
update-ca-certificates;
|
||||||
|
fi &&
|
||||||
|
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"
|
||||||
depends_on:
|
depends_on:
|
||||||
- relational_db
|
- relational_db
|
||||||
- index
|
- index
|
||||||
@ -215,6 +220,11 @@ services:
|
|||||||
options:
|
options:
|
||||||
max-size: "50m"
|
max-size: "50m"
|
||||||
max-file: "6"
|
max-file: "6"
|
||||||
|
# Uncomment the following lines if you need to include a custom CA certificate
|
||||||
|
# Optional volume mount for CA certificate
|
||||||
|
# volumes:
|
||||||
|
# # Maps to the CA_CERT_PATH environment variable in the Dockerfile
|
||||||
|
# - ${CA_CERT_PATH:-./custom-ca.crt}:/etc/ssl/certs/custom-ca.crt:ro
|
||||||
|
|
||||||
web_server:
|
web_server:
|
||||||
image: danswer/danswer-web-server:${IMAGE_TAG:-latest}
|
image: danswer/danswer-web-server:${IMAGE_TAG:-latest}
|
||||||
@ -367,7 +377,7 @@ services:
|
|||||||
image: redis:7.4-alpine
|
image: redis:7.4-alpine
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- '6379:6379'
|
- "6379:6379"
|
||||||
# docker silently mounts /data even without an explicit volume mount, which enables
|
# docker silently mounts /data even without an explicit volume mount, which enables
|
||||||
# persistence. explicitly setting save and appendonly forces ephemeral behavior.
|
# persistence. explicitly setting save and appendonly forces ephemeral behavior.
|
||||||
command: redis-server --save "" --appendonly no
|
command: redis-server --save "" --appendonly no
|
||||||
|
@ -5,7 +5,8 @@ services:
|
|||||||
context: ../../backend
|
context: ../../backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
command: >
|
command: >
|
||||||
/bin/sh -c "alembic upgrade head &&
|
/bin/sh -c "
|
||||||
|
alembic upgrade head &&
|
||||||
echo \"Starting Danswer Api Server\" &&
|
echo \"Starting Danswer Api Server\" &&
|
||||||
uvicorn danswer.main:app --host 0.0.0.0 --port 8080"
|
uvicorn danswer.main:app --host 0.0.0.0 --port 8080"
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -29,14 +30,17 @@ services:
|
|||||||
options:
|
options:
|
||||||
max-size: "50m"
|
max-size: "50m"
|
||||||
max-file: "6"
|
max-file: "6"
|
||||||
|
|
||||||
|
|
||||||
background:
|
background:
|
||||||
image: danswer/danswer-backend:${IMAGE_TAG:-latest}
|
image: danswer/danswer-backend:${IMAGE_TAG:-latest}
|
||||||
build:
|
build:
|
||||||
context: ../../backend
|
context: ../../backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
command: /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
command: >
|
||||||
|
/bin/sh -c "
|
||||||
|
if [ -f /etc/ssl/certs/custom-ca.crt ]; then
|
||||||
|
update-ca-certificates;
|
||||||
|
fi &&
|
||||||
|
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"
|
||||||
depends_on:
|
depends_on:
|
||||||
- relational_db
|
- relational_db
|
||||||
- index
|
- index
|
||||||
@ -60,6 +64,10 @@ services:
|
|||||||
options:
|
options:
|
||||||
max-size: "50m"
|
max-size: "50m"
|
||||||
max-file: "6"
|
max-file: "6"
|
||||||
|
# Uncomment the following lines if you need to include a custom CA certificate
|
||||||
|
# volumes:
|
||||||
|
# # Maps to the CA_CERT_PATH environment variable in the Dockerfile
|
||||||
|
# - ${CA_CERT_PATH:-./custom-ca.crt}:/etc/ssl/certs/custom-ca.crt:ro
|
||||||
|
|
||||||
web_server:
|
web_server:
|
||||||
image: danswer/danswer-web-server:${IMAGE_TAG:-latest}
|
image: danswer/danswer-web-server:${IMAGE_TAG:-latest}
|
||||||
@ -86,7 +94,6 @@ services:
|
|||||||
max-size: "50m"
|
max-size: "50m"
|
||||||
max-file: "6"
|
max-file: "6"
|
||||||
|
|
||||||
|
|
||||||
relational_db:
|
relational_db:
|
||||||
image: postgres:15.2-alpine
|
image: postgres:15.2-alpine
|
||||||
command: -c 'max_connections=250'
|
command: -c 'max_connections=250'
|
||||||
@ -102,7 +109,6 @@ services:
|
|||||||
max-size: "50m"
|
max-size: "50m"
|
||||||
max-file: "6"
|
max-file: "6"
|
||||||
|
|
||||||
|
|
||||||
inference_model_server:
|
inference_model_server:
|
||||||
image: danswer/danswer-model-server:${IMAGE_TAG:-latest}
|
image: danswer/danswer-model-server:${IMAGE_TAG:-latest}
|
||||||
build:
|
build:
|
||||||
@ -129,7 +135,6 @@ services:
|
|||||||
max-size: "50m"
|
max-size: "50m"
|
||||||
max-file: "6"
|
max-file: "6"
|
||||||
|
|
||||||
|
|
||||||
indexing_model_server:
|
indexing_model_server:
|
||||||
image: danswer/danswer-model-server:${IMAGE_TAG:-latest}
|
image: danswer/danswer-model-server:${IMAGE_TAG:-latest}
|
||||||
build:
|
build:
|
||||||
@ -158,7 +163,6 @@ services:
|
|||||||
max-size: "50m"
|
max-size: "50m"
|
||||||
max-file: "6"
|
max-file: "6"
|
||||||
|
|
||||||
|
|
||||||
# This container name cannot have an underscore in it due to Vespa expectations of the URL
|
# This container name cannot have an underscore in it due to Vespa expectations of the URL
|
||||||
index:
|
index:
|
||||||
image: vespaengine/vespa:8.277.17
|
image: vespaengine/vespa:8.277.17
|
||||||
@ -174,7 +178,6 @@ services:
|
|||||||
max-size: "50m"
|
max-size: "50m"
|
||||||
max-file: "6"
|
max-file: "6"
|
||||||
|
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:1.23.4-alpine
|
image: nginx:1.23.4-alpine
|
||||||
restart: always
|
restart: always
|
||||||
@ -209,7 +212,6 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env.nginx
|
- .env.nginx
|
||||||
|
|
||||||
|
|
||||||
# follows https://pentacent.medium.com/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71
|
# follows https://pentacent.medium.com/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71
|
||||||
certbot:
|
certbot:
|
||||||
image: certbot/certbot
|
image: certbot/certbot
|
||||||
@ -224,17 +226,15 @@ services:
|
|||||||
max-file: "6"
|
max-file: "6"
|
||||||
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
||||||
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
image: redis:7.4-alpine
|
image: redis:7.4-alpine
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- '6379:6379'
|
- "6379:6379"
|
||||||
# docker silently mounts /data even without an explicit volume mount, which enables
|
# docker silently mounts /data even without an explicit volume mount, which enables
|
||||||
# persistence. explicitly setting save and appendonly forces ephemeral behavior.
|
# persistence. explicitly setting save and appendonly forces ephemeral behavior.
|
||||||
command: redis-server --save "" --appendonly no
|
command: redis-server --save "" --appendonly no
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db_volume:
|
db_volume:
|
||||||
vespa_volume:
|
vespa_volume:
|
||||||
|
@ -16,9 +16,12 @@ spec:
|
|||||||
- name: background
|
- name: background
|
||||||
image: danswer/danswer-backend:latest
|
image: danswer/danswer-backend:latest
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command: ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
command:
|
||||||
# There are some extra values since this is shared between services
|
[
|
||||||
# There are no conflicts though, extra env variables are simply ignored
|
"/usr/bin/supervisord",
|
||||||
|
"-c",
|
||||||
|
"/etc/supervisor/conf.d/supervisord.conf",
|
||||||
|
]
|
||||||
env:
|
env:
|
||||||
- name: REDIS_PASSWORD
|
- name: REDIS_PASSWORD
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@ -28,3 +31,17 @@ spec:
|
|||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: env-configmap
|
name: env-configmap
|
||||||
|
# Uncomment the following lines if you need to include a custom CA certificate
|
||||||
|
# Optional volume mount for CA certificate
|
||||||
|
# volumeMounts:
|
||||||
|
# - name: my-ca-cert-volume
|
||||||
|
# mountPath: /etc/ssl/certs/custom-ca.crt
|
||||||
|
# subPath: my-ca.crt
|
||||||
|
# Optional volume for CA certificate
|
||||||
|
# volumes:
|
||||||
|
# - name: my-cas-cert-volume
|
||||||
|
# secret:
|
||||||
|
# secretName: my-ca-cert
|
||||||
|
# items:
|
||||||
|
# - key: my-ca.crt
|
||||||
|
# path: my-ca.crt
|
||||||
|
Reference in New Issue
Block a user