Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting vector.so not found in cloudnative pg cluster #612

Open
gregkonush opened this issue Nov 8, 2024 · 0 comments
Open

Getting vector.so not found in cloudnative pg cluster #612

gregkonush opened this issue Nov 8, 2024 · 0 comments

Comments

@gregkonush
Copy link

gregkonush commented Nov 8, 2024

version 0.3

{"level":"info","ts":"2024-11-08T08:47:59.738349871Z","logger":"pg_ctl","msg":"waiting for server to start....2024-11-08 08:47:59.738 UTC [30] FATAL: could not access file "vectors.so": No such file or directory","pipe":"stdout","logging_pod":"ecran-vector-cluster-1-initdb"}

kubernetes manifest

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: ecran-vector-cluster
  namespace: ecran
spec:
  instances: 3
  bootstrap:
    initdb:
      database: ecran
      postInitApplicationSQL:
        - ALTER SYSTEM SET search_path TO "$user", public, vectors;
        - CREATE EXTENSION IF NOT EXISTS "vectors";
        - ALTER SYSTEM SET shared_preload_libraries = 'vectors';
      owner: ecran
      secret:
        name: ecran-cluster-secret
      dataChecksums: true
      encoding: "UTF8"
  storage:
    size: 5Gi
  imageName: kalmyk.duckdns.org/lab/vecteur:16.4
  imagePullSecrets:
    - name: kalmyk-registry
  postgresql:
    shared_preload_libraries:
      - "vectors.so"

Dockerfile

# syntax=docker/dockerfile-upstream:master
FROM ghcr.io/cloudnative-pg/postgresql:16

ARG CNPG_TAG
ARG PGVECTORS_TAG
ARG TARGETARCH

# drop to root to install packages
USER root

# install pgvecto.rs
ADD https://github.com/tensorchord/pgvecto.rs/releases/download/$PGVECTORS_TAG/vectors-pg${CNPG_TAG%.*}_${PGVECTORS_TAG#"v"}_$TARGETARCH.deb ./pgvectors.deb
RUN apt install ./pgvectors.deb

USER postgres

bash script to build image

#!/bin/bash

# Set variables
IMAGE_NAME="kalmyk.duckdns.org/lab/vecteur"
DOCKERFILE="services/vecteur/Dockerfile"
CONTEXT_PATH="services/vecteur"

TARGETARCH="arm64"
CNPG_TAG="16"

# Check if a tag is provided as an argument
if [ $# -eq 1 ]; then
    TAG=$1
else
    # If no tag is provided, use the current date and time
    TAG=$(date +"%Y%m%d_%H%M%S")
fi

# Full image name with tag
FULL_IMAGE_NAME="${IMAGE_NAME}:${TAG}"

# Build the Docker image
echo "Building Docker image: ${FULL_IMAGE_NAME}"
docker buildx build \
    --platform linux/${TARGETARCH} \
    --build-arg PGVECTORS_TAG=v0.3.0 \
    --build-arg TARGETARCH=${TARGETARCH} \
    --build-arg CNPG_TAG=${CNPG_TAG} \
    -t ${FULL_IMAGE_NAME} \
    -f ${DOCKERFILE} ${CONTEXT_PATH} \
    --push

# Check if the build was successful
if [ $? -eq 0 ]; then
    echo "Docker image built and pushed successfully: ${FULL_IMAGE_NAME}"
else
    echo "Docker image build or push failed"
    exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant