perf: add POSTGRES_MAX_CONNECTIONS env.

This commit is contained in:
liqiang-fit2cloud 2024-12-27 09:55:09 +08:00
parent 68897b9ebf
commit a0b03d3433
3 changed files with 4 additions and 2 deletions

View File

@ -111,7 +111,7 @@ class Config(dict):
"ENGINE": self.get('DB_ENGINE'),
"POOL_OPTIONS": {
"POOL_SIZE": 20,
"MAX_OVERFLOW": 80
"MAX_OVERFLOW": self.get('DB_MAX_OVERFLOW')
}
}

View File

@ -40,6 +40,7 @@ ENV MAXKB_VERSION="${DOCKER_IMAGE_TAG} (build at ${BUILD_AT}, commit: ${GITHUB_C
MAXKB_DB_PORT=5432 \
MAXKB_DB_USER=root \
MAXKB_DB_PASSWORD=Password123@postgres \
MAXKB_DB_MAX_OVERFLOW=80 \
MAXKB_EMBEDDING_MODEL_NAME=/opt/maxkb/model/embedding/shibing624_text2vec-base-chinese \
MAXKB_EMBEDDING_MODEL_PATH=/opt/maxkb/model/embedding \
MAXKB_SANDBOX=1 \
@ -47,6 +48,7 @@ ENV MAXKB_VERSION="${DOCKER_IMAGE_TAG} (build at ${BUILD_AT}, commit: ${GITHUB_C
PATH=/opt/py3/bin:$PATH \
POSTGRES_USER=root \
POSTGRES_PASSWORD=Password123@postgres \
POSTGRES_MAX_CONNECTIONS=1000 \
PIP_TARGET=/opt/maxkb/app/sandbox/python-packages \
PYTHONPATH=/opt/maxkb/app/sandbox/python-packages \
PYTHONUNBUFFERED=1

View File

@ -1,7 +1,7 @@
#!/bin/bash
rm -f /opt/maxkb/app/tmp/*.pid
# Start postgresql
docker-entrypoint.sh postgres &
docker-entrypoint.sh postgres -c max_connections=${POSTGRES_MAX_CONNECTIONS} &
sleep 10
# Wait postgresql
until pg_isready --host=127.0.0.1; do sleep 1 && echo "waiting for postgres"; done