PostgreSQL + pgvector — a ready-to-use PostgreSQL server with the pgvector extension for storing embeddings and running vector similarity search right in your relational database. Ideal as the retrieval store for RAG and semantic search. Deployed as a host-networked Nomad service with a persistent data volume.
Needs nomad-pack on PATH. The script only adds the nomploy registry and runs this pack.
Source ↗ Project ↗ ★ 23.1k ⚑ Report an issue
Save as values.hcl, edit, then run:
# The name of the Nomad job.
job_name = "pgvector"
# The Nomad namespace to deploy into.
namespace = "default"
# The datacenters to deploy to.
datacenters = ["*"]
# The pgvector PostgreSQL image (postgres + pgvector). Match the tag to your Postgres major version. Pin a tag in production.
image = "pgvector/pgvector:pg16"
# Host port for PostgreSQL.
port = 5432
# Initial database created on first boot (POSTGRES_DB).
db_name = "app"
# PostgreSQL superuser (POSTGRES_USER).
db_user = "postgres"
# PostgreSQL password (POSTGRES_PASSWORD). CHANGE THIS.
db_password = "change-me-please"
# Named volume for PostgreSQL data (/var/lib/postgresql/data). Holds all databases and vectors.
data_volume = "pgvector_data"
# Placement constraints. Pin to the node holding the volume. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true".
constraints = []
# Resources for the PostgreSQL task.
resources = {
cpu = 500
memory = 512
}
| Name | Type | Default | Description |
|---|---|---|---|
| job_name | string | "pgvector" | The name of the Nomad job. |
| namespace | string | "default" | The Nomad namespace to deploy into. |
| datacenters | list | ["*"] | The datacenters to deploy to. |
| image | string | "pgvector/pgvector:pg16" | The pgvector PostgreSQL image (postgres + pgvector). Match the tag to your Postgres major version. Pin a tag in production. |
| port | number | 5432 | Host port for PostgreSQL. |
| db_name | string | "app" | Initial database created on first boot (POSTGRES_DB). |
| db_user | string | "postgres" | PostgreSQL superuser (POSTGRES_USER). |
| db_password set me | string | "change-me-please" | PostgreSQL password (POSTGRES_PASSWORD). CHANGE THIS. |
| data_volume | string | "pgvector_data" | Named volume for PostgreSQL data (/var/lib/postgresql/data). Holds all databases and vectors. |
| constraints | list | [] | Placement constraints. Pin to the node holding the volume. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true". |
| resources | object | {
cpu = 500
memory = 512
} | Resources for the PostgreSQL task. |
No variables match.
This pack stores data in one Docker named volume:
pgvector_data
⚠ This pack bundles a database. A cold copy of the volume can be inconsistent — for a reliable backup, dump the DB (pg_dump / mysqldump) or stop the job while backing up.
restic
# Run on the node hosting this pack. Point restic at your repo first: # export RESTIC_REPOSITORY="s3:https://<account>.r2.cloudflarestorage.com/<bucket>" # export RESTIC_PASSWORD="<repo-password>" # export AWS_ACCESS_KEY_ID=<key> AWS_SECRET_ACCESS_KEY=<secret> restic backup \ /var/lib/docker/volumes/pgvector_data/_data
rclone (sync to S3/R2)
rclone sync /var/lib/docker/volumes/pgvector_data/_data backup:<bucket>/pgvector_data
Paths assume the default Docker volume location (/var/lib/docker/volumes). Restore by stopping the job, restoring files into the same volume, and re-running the pack.
pgvector on PostgreSQL — a ready-to-use Postgres server with the pgvector extension for storing embeddings and running vector similarity search directly in your relational database. Keep your app data and your vectors in one place — ideal as the retrieval store for RAG and semantic search.
Single host-networked Nomad service with a persistent data volume.
nomad-pack registry add nomploy https://github.com/Nomploy/nomad-packs
nomad-pack run pgvector --registry=nomploy
| Variable | Default | Description |
|---|---|---|
port |
5432 |
PostgreSQL port. |
db_name |
app |
Initial database (POSTGRES_DB). |
db_user |
postgres |
Superuser (POSTGRES_USER). |
db_password |
change-me-please |
Password (POSTGRES_PASSWORD). Change it. |
data_volume |
pgvector_data |
/var/lib/postgresql/data — all databases and vectors. |
image |
pgvector/pgvector:pg16 |
Image (match the tag to your Postgres major version). Pin in production. |
resources |
{ cpu = 500, memory = 512 } |
Task resources. |
Enable the extension once per database, then use vector columns:
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(1536));
-- nearest neighbors: ORDER BY embedding <-> '[...]' LIMIT 5;
A drop-in vector store for the ollama / open-webui / anythingllm packs. Serves an unencrypted SQL
port — keep it on an internal network. Pin the job to the node holding the volume with constraints.