Ledger Installation
Ledger Installation for PostgreSQL
Ledger is installed as a PostgreSQL extension and is provided through published Docker images.
1. Pull the Ledger PostgreSQL image that matches your PostgreSQL version
PostgreSQL 16:
docker pull ghcr.io/titaniumguardlabs/source/ledger/postgres16:latest
PostgreSQL 17:
docker pull ghcr.io/titaniumguardlabs/source/ledger/postgres17:latest
PostgreSQL 18:
docker pull ghcr.io/titaniumguardlabs/source/ledger/postgres18:latest
These images include the Ledger extension shared library, control file, and SQL migration files in the correct PostgreSQL version directories.
2. Start PostgreSQL from the Ledger image
Example for PostgreSQL 18:
docker run --rm \
--name tg-ledger-pg18 \
-p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
ghcr.io/titaniumguardlabs/source/ledger/postgres18:latest
3. Create the extension
Connect to the running PostgreSQL instance and execute:
CREATE EXTENSION tg_ledger;
Verify installation:
SELECT ledger_status();
Expected result:
true
4. Enable ledgering on a table
SELECT ledger_enable('public.events');
This adds Ledger-managed columns and installs required triggers for that table.
5. Disable ledgering if needed
SELECT ledger_disable('public.events');
This removes those triggers and drops the Ledger-managed columns.
6. Optional smoke check with Docker and psql
After creating the extension, run a quick functional check:
CREATE TABLE public.events(id bigserial primary key, payload jsonb not null);
SELECT ledger_enable('public.events');
INSERT INTO public.events(payload) VALUES ('{"ok":true}');
SELECT * FROM ledger.ledger_verify_table('public.events');
Deployment notes
- Choose the image that matches your PostgreSQL major version.
- Published images are available at:
ghcr.io/titaniumguardlabs/source/ledger/postgres16ghcr.io/titaniumguardlabs/source/ledger/postgres17ghcr.io/titaniumguardlabs/source/ledger/postgres18
- Standard
POSTGRES_*environment variables and base image runtime behavior are preserved. - Current instructions are PostgreSQL-specific because PostgreSQL is the only supported backend.