Command Palette

Search for a command to run...

pglite package icon
wasmer/pglite
Public
wasmer run wasmer/pglite

wasmer/pglite

wasmer/pglite packages PostgreSQL 18.4 for WASIX with an initialized database and a direct PostgreSQL wire-protocol socket. PostgreSQL itself owns the guest socket; there is no native database server or protocol proxy.

The package exports one pglite command and makes it the entrypoint. Its working directory, PostgreSQL arguments, database paths, locale, and other runtime environment are part of the command definition. It listens on 127.0.0.1:5432.

Host networking is a capability and must still be enabled by the embedding runtime. With wasmer-sdk, usage is:

from wasmer_sdk import Wasmer

client = Wasmer()
pglite = await client.packages.load("wasmer/pglite@18.4.0")
sandbox = await client.sandboxes.create(
    packages=[pglite],
    network="host",
)
process = await sandbox.command(pglite).spawn(
    stdout="capture",
    stderr="pipe",
)

Connect a standard PostgreSQL client to:

postgresql://postgres@127.0.0.1:5432/postgres?sslmode=disable

This build intentionally provides a single-backend, single-client PostgreSQL process. It exits after that client disconnects.

Build

The repository does not commit generated PostgreSQL or database artifacts. Assemble the publishable package from the verified WASIX module, Oliphaunt runtime tree, and initialized PGDATA:

bash packages/pglite/build.sh \
  target/postgres-wasix-socket-build/src/backend/oliphaunt \
  /path/to/oliphaunt/runtime/root \
  .wasmer/postgres-poc/pgdata

This populates modules/, runtime/, and pgdata/ directly beneath packages/pglite, then produces:

  • packages/pglite, the complete runnable and publishable package directory;
  • target/wasmer-pglite-18.4.0.webc, the built package container.

Run from the package directory:

cd packages/pglite
wasmer run . --net

--net is the CLI's explicit host-network capability grant. It cannot be declared by a package in wasmer.toml; without it, Wasmer correctly denies the guest's attempt to bind port 5432.

Validate without uploading:

wasmer package build --check packages/pglite
wasmer package push --dry-run --non-interactive packages/pglite

Publish when ready:

wasmer package publish --wait=container packages/pglite

PostgreSQL 18 for WASIX with a direct PostgreSQL wire-protocol socket


Github