Skip to content

Commit

Permalink
👻 Update compose DB image
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Montleon <jmontleo@redhat.com>
  • Loading branch information
jmontleon committed Aug 19, 2024
1 parent 5af1d3b commit ad38492
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# If we are using podman or docker compose use the repo config.toml
if [[ -f /podman_compose/kai/config.toml ]]; then
cp /podman_compose/kai/config.toml /kai/kai/config.toml
sed -i "s/^host =.*/host = \"${POSTGRES_HOST}\"/g" /kai/kai/config.toml
sed -i "s/^database =.*/database = \"${POSTGRES_DB}\"/g" /kai/kai/config.toml
sed -i "s/^user =.*/user = \"${POSTGRES_USER}\"/g" /kai/kai/config.toml
sed -i "s/^password =.*/password =\"${POSTGRES_PASSWORD}\"/g" /kai/kai/config.toml
sed -i "s/^host =.*/host = \"${POSTGRESQL_HOST}\"/g" /kai/kai/config.toml
sed -i "s/^database =.*/database = \"${POSTGRESQL_DATABASE}\"/g" /kai/kai/config.toml
sed -i "s/^user =.*/user = \"${POSTGRESQL_USER}\"/g" /kai/kai/config.toml
sed -i "s/^password =.*/password =\"${POSTGRESQL_PASSWORD}\"/g" /kai/kai/config.toml
fi

until PGPASSWORD="${POSTGRES_PASSWORD}" pg_isready -q -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -d "${POSTGRES_DB}"; do
until PGPASSWORD="${POSTGRESQL_PASSWORD}" pg_isready -q -h "${POSTGRESQL_HOST}" -U "${POSTGRESQL_USER}" -d "${POSTGRESQL_DATABASE}"; do
sleep 1
done

Expand All @@ -19,7 +19,7 @@ if [[ ${MODE} != "importer" ]]; then
SQL_EXISTS=$(printf "\dt %s" "${TABLE}")
STDERR="Did not find any relation"
# trunk-ignore(shellcheck/SC2312)
if PGPASSWORD="${POSTGRES_PASSWORD}" psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -c "${SQL_EXISTS}" 2>&1 | grep -q -v "${STDERR}"; then
if PGPASSWORD="${POSTGRESQL_PASSWORD}" psql -h "${POSTGRESQL_HOST}" -U "${POSTGRESQL_USER}" -d "${POSTGRESQL_DATABASE}" -c "${SQL_EXISTS}" 2>&1 | grep -q -v "${STDERR}"; then
echo "################################################"
echo "load-data has run already run, starting server.#"
echo "################################################"
Expand Down
10 changes: 5 additions & 5 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ x-kai-variables: &kai-variables
USE_HUB_IMPORTER: ${USE_HUB_IMPORTER:-False}

x-db-variables: &db-variables
POSTGRES_DB: kai
POSTGRES_PASSWORD: dog8code
POSTGRES_USER: kai
POSTGRES_HOST: kai_db
POSTGRESQL_DATABASE: kai
POSTGRESQL_PASSWORD: dog8code
POSTGRESQL_USER: kai
POSTGRESQL_HOST: kai_db

services:
kai:
Expand Down Expand Up @@ -47,7 +47,7 @@ services:
profiles:
- use_hub_importer
kai_db:
image: docker.io/pgvector/pgvector:pg15
image: quay.io/sclorg/postgresql-15-c9s:latest
environment:
<<: *db-variables
volumes:
Expand Down

0 comments on commit ad38492

Please sign in to comment.