Prerequisites

  • Docker

Initialize an buildkit file

pgxman init

init is interactive and will prompt you about the extension you wish to create.

This result is a manifest file named extension.yaml. The file serves as your blueprint for building the extension.

Writing the buildkit file

Please refer to the full buildkit file specification for details. You’ll find a full documented example with all available fields, as well as documentation for the file. You can also review existing buildkits for examples on how to create a buildkit.

Most manifest files should follow the build instructions for the extension. This may be as simple as make && make install, but others may be considerably more complicated. Review the documentation for the extension for build instructions and any required dependencies.

Building the extension

Once you have a buildkit written, use pgxman to build the extension locally. pgxman uses Docker to build the packages.

pgxman build -f extension.yaml

This will package the extension files in the out directory:

$ tree out
out
├── linux_amd64
│   ├── debian
│   │   └── bookworm
│   │       ├── postgresql-13-pgxman-pgvector_0.5.0_amd64.deb
│   │       ├── postgresql-14-pgxman-pgvector_0.5.0_amd64.deb
│   │       └── postgresql-15-pgxman-pgvector_0.5.0_amd64.deb
│   └── ubuntu
│       └── jammy
│           ├── postgresql-13-pgxman-pgvector_0.5.0_amd64.deb
│           ├── postgresql-14-pgxman-pgvector_0.5.0_amd64.deb
│           └── postgresql-15-pgxman-pgvector_0.5.0_amd64.deb
└── linux_arm64
    ├── debian
    │   └── bookworm
    │       ├── postgresql-13-pgxman-pgvector_0.5.0_arm64.deb
    │       ├── postgresql-14-pgxman-pgvector_0.5.0_arm64.deb
    │       └── postgresql-15-pgxman-pgvector_0.5.0_arm64.deb
    └── ubuntu
        └── jammy
            ├── postgresql-13-pgxman-pgvector_0.5.0_arm64.deb
            ├── postgresql-14-pgxman-pgvector_0.5.0_arm64.deb
            └── postgresql-15-pgxman-pgvector_0.5.0_arm64.deb

11 directories, 12 files

Test the extension

We plan on making it easier to test extensions in the near future.

Our recommendation is to test the built extension using Docker. You could use a Dockerfile to build an image, or run the commands manually from inside of the container.

Below is an example Dockerfile. In order to use this, you’ll need your built extension in out/ and a pgxman.yaml file specifying the package from out/ to install.

FROM postgres:15-bookworm

RUN apt-get update && \
  apt-get install -y curl && \
  curl -sfL https://install.pgx.sh | sh -

COPY out/ /pgxman/out/
COPY pgxman.yaml /pgxman/pgxman.yaml

WORKDIR /pgxman
RUN pgxman install --debug -f pgxman.yaml

Here’s an example pgxman.yaml file for this setup:

apiVersion: v1
extensions:
- path: "./out/debian/bookworm/postgresql-15-pgxman-yourpackage_1.2.3_arm64.deb"
postgres:
  version: 15

Adding the extension to pgxman

Send a PR to pgxman/buildkit, adding your buildkit to the buildkit folder.