How-To Create Fly Postgres DB with pgvector

Hoping to get some help on getting a postgres app with pgvector up and running on fly.

So far, following the advice I found in this thread: Adding pgvector to Fly Postgres

I did build/push the recommended docker image:

FROM flyio/postgres-flex:15.3

# Install build dependencies
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        build-essential \
        curl \
        postgresql-server-dev-all

# Set the pgvector version
ARG PGVECTOR_VERSION=0.4.1

# Download and extract the pgvector release, build the extension, and install it
RUN curl -L -o pgvector.tar.gz "https://github.com/ankane/pgvector/archive/refs/tags/v${PGVECTOR_VERSION}.tar.gz" && \
    tar -xzf pgvector.tar.gz && \
    cd "pgvector-${PGVECTOR_VERSION}" && \
    make && \
    make install

# Clean up build dependencies and temporary files
RUN apt-get remove -y build-essential curl postgresql-server-dev-all && \
    apt-get autoremove -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    rm -rf /pgvector.tar.gz /pgvector-${PGVECTOR_VERSION}

And attempted to spin up a postgres app from that:
$ fly postgres create --image-ref justinhenricks/fly-pg-pgvector

To which I got the same errors referenced in that thread, something to do with cluster membership:
2023-10-22T16:08:24.582 health[28749d7f173278] ord [error] Health check for your postgres role has failed. Your cluster's membership is inconsistent.

I then took the advice from further down that thread to deploy a new app from my docker image:
fly deploy --build-only --push --remote-only --dockerfile Dockerfile.db --app pg-vector-image

And then use the docker image from that app to spin up another pg db:
fly apps create pg-vector --image-ref registry.fly.io/pg-vector-image:deployment-01HDC1QWGGRA19ZKAFQ9AYX4T4

And once that started up, I unfortunately got the same cluster membership error.

Any idea/guidance on how to get a postgres db up and running with pgvector on fly would be greatly appreciated!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.