GitHub Action and scripts to set up PostgreSQL with pgvector extension for vector similarity search.
- 🚀 Quick setup of PostgreSQL with pgvector extension
- 🔄 Supports both GitHub Actions and local installation
- 🛠️ Customizable PostgreSQL and pgvector versions
- 🔐 Secure password authentication
- 🌐 Cross-platform support: Ubuntu, Windows (MSYS2), and macOS
- 🏗️ Builds pgvector from source for maximum compatibility
The following table shows the compatibility matrix for different PostgreSQL versions and platforms:
| Platform | Architecture | PostgreSQL 14 | PostgreSQL 15 | PostgreSQL 16 | PostgreSQL 17 |
|---|---|---|---|---|---|
| ubuntu-latest | x86_64 | ✅ | ✅ | ✅ | ✅ |
| ubuntu-24.04 | x86_64 | ✅ | ✅ | ✅ | ✅ |
| windows-latest | x86_64 | ✅ | ✅ | ✅ | ✅ |
| windows-2019 | x86_64 | ✅ | ✅ | ✅ | ✅ |
| macos-latest | arm64 | ✅ | ✅ | ✅ | ✅ |
| macos-13 | x86_64 | ✅ | ✅ | ✅ | ✅ |
steps: - uses: cpunion/setup-pgvector@main with: postgres-version: '17' postgres-user: 'myuser' postgres-password: 'mypassword' postgres-db: 'mydb' - name: Test pgvector env: PGPASSWORD: mypassword run: | psql -h localhost -U myuser -d mydb -c 'CREATE EXTENSION vector;'# Ubuntu curl -fsSL https://raw.githubusercontent.com/cpunion/setup-pgvector/main/scripts/install-ubuntu.sh | bash # macOS curl -fsSL https://raw.githubusercontent.com/cpunion/setup-pgvector/main/scripts/install-macos.sh | bash # Windows (MSYS2) curl -fsSL https://raw.githubusercontent.com/cpunion/setup-pgvector/main/scripts/install-windows.sh | bashWith custom parameters:
# Format: curl ... | bash -s [PG_VERSION] [PGVECTOR_VERSION] [PGUSER] [PGPASSWORD] [PGDATABASE] curl -fsSL https://raw.githubusercontent.com/cpunion/setup-pgvector/main/scripts/install-ubuntu.sh | bash -s 17 0.8.0 myuser mypassword mydb# Ubuntu ./scripts/install-ubuntu.sh # macOS ./scripts/install-macos.sh # Windows (MSYS2) ./scripts/install-windows.sh- Ubuntu: No additional requirements
- Windows: MSYS2 environment
- macOS: Homebrew
- Git (for building pgvector)
steps: - uses: cpunion/setup-pgvector@main with: # PostgreSQL version to install (default: 17) postgres-version: '17' # pgvector version to install (default: 0.8.0) pgvector-version: '0.8.0' # PostgreSQL user to create (default: postgres) postgres-user: 'myuser' # Password for the PostgreSQL user (default: postgres) postgres-password: 'mypassword' # Database to create (default: postgres) postgres-db: 'mydb' - name: Test pgvector env: PGPASSWORD: mypassword run: | psql -h localhost -U myuser -d mydb -c 'CREATE EXTENSION vector;' psql -h localhost -U myuser -d mydb -c 'CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));' psql -h localhost -U myuser -d mydb -c "INSERT INTO items (embedding) VALUES ('[1,2,3]');" psql -h localhost -U myuser -d mydb -c 'SELECT * FROM items;'All installation scripts accept the following parameters:
PG_VERSION(default: 17) - PostgreSQL version to installPGVECTOR_VERSION(default: 0.8.0) - pgvector version to installPGUSER(default: postgres) - PostgreSQL user to createPGPASSWORD(default: postgres) - Password for the PostgreSQL userPGDATABASE(default: postgres) - Database to create
After installation, you can connect to PostgreSQL using:
# Using password from environment variable export PGPASSWORD=mypassword psql -h localhost -U myuser -d mydb # Or using password prompt psql -h localhost -U myuser -d mydb- The scripts will install PostgreSQL if not already installed
- The scripts will create the specified user and database if they don't exist
- The scripts will build and install pgvector from source
- All connections are configured to use password authentication
MIT