pgxman is a package manager for PostgreSQL extensions that automates building, publishing, and installing extensions across different distributions and PostgreSQL versions.
Step 1: Create Buildkit Configuration
Create an extension.yaml file (also called a "buildkit") that defines:
- Extension metadata (name, version, description)
- Source code location
- Build instructions
- Supported architectures and PostgreSQL versions
Example extension.yaml:
apiVersion: v1
name: a5pg
version: "0.2.0"
source: https://github.com/decision-labs/a5pg/archive/refs/tags/v0.2.0.tar.gz
arch:
- amd64
- arm64
pgVersions:
- "15"
- "16"
build:
main:
- name: Build extension
run: cargo pgrx package --pg-config /usr/lib/postgresql/${PG_VERSION}/bin/pg_configStep 2: Build Packages Locally
# Install pgxman CLI
cargo install pgxman
# Build packages
pgxman build
# This creates packages in out/ directory:
# - out/a5pg_0.2.0-1_amd64.deb (Debian/Ubuntu)
# - out/a5pg-0.2.0-1.x86_64.rpm (RHEL/CentOS)
# - Packages for each architecture × PostgreSQL version combinationWhat Happens During Build:
- Docker-based builds: Uses Docker containers for isolated, reproducible builds
- Multi-platform: Builds for each specified architecture (amd64, arm64)
- Multi-version: Builds for each PostgreSQL version (15, 16, 17)
- Package creation: Creates native packages:
.debfiles for Debian/Ubuntu systems.rpmfiles for RHEL/CentOS systems
- Package contents:
- Compiled
.solibrary file - SQL migration files (
extension--version.sql) - Control file (
extension.control) - Metadata (dependencies, maintainer, description)
- Compiled
After building packages locally:
pgxman publishThis uploads all built packages to the pgxman registry at https://registry.pgxman.com/v1.
Requirements:
- You need to be authenticated (usually via API token)
- Packages must be successfully built
- Extension metadata must be valid
GitHub Actions Integration:
- Buildkit Repository: Buildkits (
extension.yamlfiles) are stored in a GitHub repository - Automatic Triggers: When a buildkit is added or updated:
- GitHub Actions automatically triggers
- Builds extension for all architectures/PostgreSQL versions
- Runs tests (if configured)
- Publishes to pgxman registry on success
Benefits:
- No manual publishing needed
- Consistent builds
- Automatic versioning
- CI/CD integration
Step 1: Install pgxman CLI
cargo install pgxmanStep 2: Install Extension
# Install latest version
pgxman install a5pg
# Install specific version
pgxman install a5pg@0.2.0
# Install for specific PostgreSQL version
pgxman install a5pg --pg-version 16What Happens During Installation:
-
System Detection: pgxman detects your system:
- Distribution (Debian/Ubuntu/RHEL/CentOS)
- Architecture (amd64/arm64)
- PostgreSQL version (if installed)
-
Repository Setup: Adds pgxman repository to your system package manager:
- Debian/Ubuntu: Adds to
/etc/apt/sources.list.d/ - RHEL/CentOS: Adds to
/etc/yum.repos.d/
- Debian/Ubuntu: Adds to
-
Package Download: Downloads the appropriate package from registry:
- Matches your system architecture
- Matches your PostgreSQL version
- Handles dependencies automatically
-
Installation: Uses system package manager to install:
# On Debian/Ubuntu apt-get install postgresql-16-pgxman-a5pg # On RHEL/CentOS yum install postgresql16-pgxman-a5pg
-
File Placement: Extension files are installed to:
- Library:
/usr/lib/postgresql/{version}/lib/a5pg.so - SQL files:
/usr/share/postgresql/{version}/extension/a5pg--*.sql - Control file:
/usr/share/postgresql/{version}/extension/a5pg.control
- Library:
Step 3: Enable in PostgreSQL
CREATE EXTENSION a5pg;┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Developer │ │ Registry │ │ User │
└──────┬──────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
│ 1. extension.yaml │ │
│──────────────────────>│ │
│ │ │
│ 2. pgxman build │ │
│ (creates .deb/.rpm) │ │
│ │ │
│ 3. pgxman publish │ │
│──────────────────────>│ │
│ │ │
│ │ 4. pgxman install │
│ │<────────────────────────│
│ │ (queries registry) │
│ │ │
│ │ 5. Package download │
│ │─────────────────────────>│
│ │ (via apt/yum) │
│ │ │
│ │ 6. Install package │
│ │─────────────────────────>│
│ │ │
- ✅ No Manual Packaging: Buildkit defines everything
- ✅ Multi-Platform: Automatic builds for all architectures
- ✅ Version Management: Easy versioning and updates
- ✅ CI/CD Ready: Integrates with GitHub Actions
- ✅ Standardized: Consistent packaging format
- ✅ Simple Installation: One command:
pgxman install a5pg - ✅ No Build Tools: No Rust toolchain needed
- ✅ System Integration: Uses native package managers
- ✅ Dependency Resolution: Automatic dependency handling
- ✅ Version Control: Easy to install specific versions
- ✅ Updates: Simple upgrade path
a5pg_0.2.0-1_amd64.deb
├── DEBIAN/
│ └── control # Package metadata
└── usr/
├── lib/
│ └── postgresql/
│ └── 16/
│ └── lib/
│ └── a5pg.so # Compiled library
└── share/
└── postgresql/
└── 16/
└── extension/
├── a5pg--0.2.0.sql # SQL migration
└── a5pg.control # Extension control file
- Extension version:
0.2.0(semantic versioning) - Package version:
0.2.0-1(version-revision format) - PostgreSQL version:
16(major version)
For Users:
# Update to latest version
pgxman install a5pg --upgrade
# Or reinstall specific version
pgxman install a5pg@0.2.0For Developers:
- Update version in
extension.yaml - Build new packages:
pgxman build - Publish:
pgxman publish
Before publishing, test packages locally:
# Build packages
pgxman build
# Test installation locally
pgxman install --local ./out/a5pg_0.2.0-1_amd64.deb
# Or test in Docker
docker run -it --rm ubuntu:22.04 bash
apt-get update && apt-get install -y ./out/a5pg_0.2.0-1_amd64.debBased on your extension.yaml:
- ✅ Build Configuration: Ready (
extension.yamlconfigured) - ✅ Local Builds: Working (with recent fixes)
- ⏳ Registry Publishing: Not yet done (run
pgxman publishafter successful builds) - ⏳ User Installation: Will work once published to registry
- Complete Build: Ensure
pgxman buildsucceeds for all architectures/versions - Test Locally: Test packages before publishing
- Publish: Run
pgxman publishto make available to users - Documentation: Update README with installation instructions
- CI/CD: Set up automated publishing via GitHub Actions (optional)