pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: farmisen (@farmisen) <noreply+farmisen@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] PR #739: Adds docker image based on fly io pgsql image
Date: Thu, 26 Dec 2024 19:00:40 +0000
Message-ID: <gh-pgvector-pgvector-739@github.com> (raw)

Adds Fly.io PostgreSQL support with custom Dockerfile and deployment documentation

This change introduces Fly.io-specific Docker configuration and documentation for deploying PostgreSQL with pgvector extension. It modifies the base image from standard postgres:17 to flyio/postgres-flex:16 and adds comprehensive deployment instructions.

### Changes

- Modified base Dockerfile to use flyio/postgres-flex:16 instead of postgres:17
- Added new Dockerfile-fly specifically for Fly.io deployments
- Created FLY.md with detailed deployment documentation and prerequisites

### Impact

- Changes PostgreSQL version from 17 to 16 for compatibility with Fly.io
- Introduces deployment pathway for Fly.io platform users
- Requires Docker Hub account for image distribution
- No direct performance implications, but enables cloud deployment capabilities

inline patch 1: Dockerfile, Dockerfile-fly, FLY.md (+62/-2 lines) download inline-1.patchdiff --git a/Dockerfile b/Dockerfile index 936440928..50b8ecd7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -ARG PG_MAJOR=17 -FROM postgres:$PG_MAJOR +ARG PG_MAJOR=16 +FROM flyio/postgres-flex:$PG_MAJOR ARG PG_MAJOR COPY . /tmp/pgvector diff --git a/Dockerfile-fly b/Dockerfile-fly new file mode 100644 index 000000000..46ee0924a --- /dev/null +++ b/Dockerfile-fly @@ -0,0 +1,20 @@ +ARG PG_MAJOR=16 +FROM flyio/postgres-flex:16 +ARG PG_MAJOR + +COPY . /tmp/pgvector + +RUN apt-get update && \ + apt-mark hold locales && \ + apt-get install -y --no-install-recommends build-essential postgresql-server-dev-$PG_MAJOR && \ + cd /tmp/pgvector && \ + make clean && \ + make OPTFLAGS="" && \ + make install && \ + mkdir /usr/share/doc/pgvector && \ + cp LICENSE README.md /usr/share/doc/pgvector && \ + rm -r /tmp/pgvector && \ + apt-get remove -y build-essential postgresql-server-dev-$PG_MAJOR && \ + apt-get autoremove -y && \ + apt-mark unhold locales && \ + rm -rf /var/lib/apt/lists/* diff --git a/FLY.md b/FLY.md new file mode 100644 index 000000000..d9b3cad16 --- /dev/null +++ b/FLY.md @@ -0,0 +1,40 @@ +# Deploying PostgreSQL with pgvector on Fly.io + +Vector databases have become essential tools for AI and Machine Learning applications, particularly for similarity searches and embeddings storage. While Fly.io offers a standard PostgreSQL image, it doesn't include the popular `pgvector` extension by default. This guide explains how to deploy a PostgreSQL instance with `pgvector` on Fly.io. + +## Prerequisites +- Docker installed on your local machine +- Fly.io account and CLI installed +- Docker Hub account + +## Steps to Deploy + +### 1. Build and Push the Custom Docker Image +Build the custom PostgreSQL image with pgvector support: +```shell +docker build -f Dockerfile-fly -t <DOCKER_HUB_ACCOUNT>/fly-pgvector . --platform "linux/amd64" +docker push <DOCKER_HUB_ACCOUNT>/fly-pgvector +``` +Replace `<DOCKER_HUB_ACCOUNT>` with your Docker Hub username. + +### 2. Create PostgreSQL Cluster +Deploy the custom PostgreSQL instance on Fly.io: +```shell +fly pg create --image-ref <DOCKER_HUB_ACCOUNT>/fly-pgvector --app <APP_NAME> +``` +Replace `<APP_NAME>` with your desired application name. + +### 3. Enable External Access (Optional) +To access the database from outside Fly.io's network: +```shell +fly ips allocate-v4 --app <APP_NAME> +``` + +This will assign a public IPv4 address to your database instance. + +## Next Steps +- Configure your application to connect to the database +- Create tables with vector columns +- Enable the pgvector extension in your database + +For more information about pgvector usage, refer to the [official documentation](https://github.com/pgvector/pgvector). \ No newline at end of file

view thread (3+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-739@github.com>
Permalink:  ../gh-pgvector-pgvector-739@github.com/

 ·  · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox