Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 16/Dockerfile.c10s
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN INSTALL_PKGS="rsync tar gettext-envsubst nss_wrapper-libs glibc-locale-source xz" && \
PSQL_PKGS="postgresql16-server postgresql16-contrib postgresql16-upgrade" && \
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
PSQL_PKGS="$PSQL_PKGS postgresql16-pgvector" && \
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS $PSQL_PKGS && \
rpm -V $INSTALL_PKGS postgresql-server postgresql-contrib postgresql-upgrade && \
rpm -V $INSTALL_PKGS postgresql-server postgresql-contrib postgresql-upgrade pgvector && \
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
yum -y clean all --enablerepo='*' && \
localedef -f UTF-8 -i en_US en_US.UTF-8 && \
Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile.c9s
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ RUN { yum -y module enable postgresql:16 || :; } && \
INSTALL_PKGS="rsync tar gettext nss_wrapper-libs postgresql-server postgresql-contrib" && \
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
INSTALL_PKGS="$INSTALL_PKGS pgvector" && \
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
Expand Down
4 changes: 2 additions & 2 deletions 16/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/fedora/s2i-core:40
FROM quay.io/fedora/s2i-core:41

# PostgreSQL image for OpenShift.
# Volumes:
Expand Down Expand Up @@ -47,7 +47,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN INSTALL_PKGS="rsync tar gettext postgresql-server postgresql-contrib nss_wrapper " && \
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
INSTALL_PKGS+=" findutils xz" && \
INSTALL_PKGS+=" pgaudit" && \
INSTALL_PKGS+=" pgaudit pgvector" && \
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile.rhel10
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ RUN INSTALL_PKGS="rsync tar gettext-envsubst nss_wrapper-libs glibc-locale-sourc
PSQL_PKGS="postgresql16-server postgresql16-contrib" && \
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
PSQL_PKGS="$PSQL_PKGS postgresql16-pgvector" && \
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS $PSQL_PKGS && \
rpm -V $INSTALL_PKGS && \
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ RUN { yum -y module enable postgresql:16 || :; } && \
INSTALL_PKGS="rsync tar gettext bind9.18-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
INSTALL_PKGS="$INSTALL_PKGS pgvector" && \
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
Expand Down
17 changes: 17 additions & 0 deletions examples/pgvector/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Open-source vector similarity search for Postgres

Store your vectors with the rest of your data. Supports:

exact and approximate nearest neighbor search
single-precision, half-precision, binary, and sparse vectors
L2 distance, inner product, cosine distance, L1 distance, Hamming distance, and Jaccard distance
any language with a Postgres client


Bind-mount this directory under /opt/app-root/src in the container, and all the
*.conf files from postgresql-cfg/ files will be included to postgresql.conf.

This config file enables the pgvector extensions that is available in the container
image, but needs to be enabled.

More about pgvector extension at https://github.com/pgvector/pgvector.
1 change: 1 addition & 0 deletions examples/pgvector/postgresql-cfg/10_pgvector.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shared_preload_libraries = 'vector'
15 changes: 13 additions & 2 deletions specs/multispec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ specs:
img_name: "{{ spec.org }}/postgresql-{{ spec.short }}-{{ spec.prod }}"
pkgs: "postgresql-server postgresql-contrib"

fedora41:
distros:
- fedora-41-x86_64
s2i_base: quay.io/fedora/s2i-core
org: "fedora"
prod: "fedora"
openshift_tags: "database,postgresql,postgresql{{ spec.short }},postgresql-{{ spec.short }}"
redhat_component: "postgresql-{{ spec.short }}-container"
img_name: "{{ spec.org }}/postgresql-{{ spec.short }}-{{ spec.prod }}"
pkgs: "postgresql-server postgresql-contrib"

rhel8:
distros:
- rhel-8-x86_64
Expand Down Expand Up @@ -85,7 +96,7 @@ specs:
redhat_component: "postgresql-{{ spec.short }}-container"
img_name: "{{ spec.org }}/postgresql-{{ spec.short }}-{{ spec.prod }}"
pkgs: "postgresql{{ spec.short }}-server postgresql{{ spec.short }}-contrib postgresql{{ spec.short }}-upgrade"
check_pkgs: "postgresql-server postgresql-contrib postgresql-upgrade"
check_pkgs: "postgresql-server postgresql-contrib postgresql-upgrade pgvector"

version:
"12":
Expand Down Expand Up @@ -149,6 +160,6 @@ matrix:
- rhel-8-x86_64
- rhel-9-x86_64
- centos-stream-9-x86_64
- fedora-40-x86_64
- fedora-41-x86_64
- centos-stream-10-x86_64
- rhel-10-x86_64
8 changes: 8 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ RUN {{ spec.environment_setup }}
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
{% endif %}
{% endif %}
{% if spec.version == "16" %}
{% if spec.prod in ["c9s", "rhel9"] %}
INSTALL_PKGS="$INSTALL_PKGS pgvector" && \
{% endif %}
{% if spec.prod in ["c10s", "rhel10" ] %}
PSQL_PKGS="$PSQL_PKGS postgresql16-pgvector" && \
{% endif %}
{% endif %}
{% if spec.prod == "c10s" or spec.prod == "rhel10" %}
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS $PSQL_PKGS && \
rpm -V $INSTALL_PKGS {{ spec.check_pkgs }} && \
Expand Down
8 changes: 4 additions & 4 deletions src/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if spec.version == "16" or spec.version == "15" %}
FROM quay.io/fedora/s2i-core:40
{% if spec.version == "16" %}
FROM quay.io/fedora/s2i-core:41
{% else %}
FROM quay.io/fedora/s2i-core:38
FROM quay.io/fedora/s2i-core:40
{% endif %}

# PostgreSQL image for OpenShift.
Expand Down Expand Up @@ -56,7 +56,7 @@ RUN INSTALL_PKGS="rsync tar gettext postgresql{{ spec.short }}-server postgresql
{% endif %}
INSTALL_PKGS+=" findutils xz" && \
{% if spec.version == "16" %}
INSTALL_PKGS+=" pgaudit" && \
INSTALL_PKGS+=" pgaudit pgvector" && \
{% else %}
INSTALL_PKGS+=" postgresql{{ spec.short }}-pgaudit" && \
{% endif %}
Expand Down
55 changes: 55 additions & 0 deletions test/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ run_s2i_enable_ssl_test
run_upgrade_test
run_migration_test
run_pgaudit_test
run_pgvector_test
run_env_extension_load_test
run_logging_test
"
Expand Down Expand Up @@ -1039,6 +1040,60 @@ EOSQL" || ret=3
return $ret
}

# run_pgvector_test
# --------------------
# Configure container to include pgvector. Check
# that pgvector is loaded.
run_pgvector_test()
{
local ret=0
# extension pgvector is not available for older versions
case ${VERSION} in
11|12|13|15) echo "pgvector not expected, test skipped."; return ;;
*) ;;
esac
case ${OS} in
rhel8)
echo "pgvector not expected, test skipped."; return ;;
*) ;;
esac

local config_dir data_dir name=test-pgvector

# create a dir for config
config_dir=$(mktemp -d --tmpdir vector-hook-volume.XXXXX)
add_cleanup_command /bin/rm -rf "$config_dir"
test -n "$DOCKER_EXTRA_ARGS" || cp -r "$test_dir"/examples/pgvector/* "$config_dir"
setfacl -R -m u:26:rwx "$config_dir"

# create a dir for data
create_volume_dir
data_dir="${volume_dir}"

DOCKER_ARGS="
-e POSTGRESQL_ADMIN_PASSWORD=password
$DOCKER_EXTRA_ARGS
-v ${config_dir}:/opt/app-root/src:Z
-v ${data_dir}:/var/lib/pgsql/data:Z
" create_container "$name"

assert_runtime_option "$name" shared_preload_libraries vector || ret=1
wait_ready "$name" || \
false "FAIL: Container did not start up properly."

# enable the pgvector extension
docker exec -i $(get_cid "$name") bash -c "psql <<EOSQL
CREATE EXTENSION vector;
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));
EOSQL" || ret=2


if [ $ret -eq 0 ]; then
echo " Success!"
fi
return $ret
}

# run_env_extension_load_test
# --------------------
# Tries to load pgaudit extension using environment variables
Expand Down