Repository navigation
Building from Source
KingresDB is built with meson. The autoconf build is not supported. The server and extensions build on Linux only (Ubuntu 24.04; on Windows use WSL2). The Go control plane builds on any OS and the web panel on any OS with Node.js. The Go modules (kingres/control-plane and kingres/verifier) say go 1.27.3 in their go.mod, and the release build pins Go 1.27.3 and Node.js 24.22.1 with their checksums in kingres/packaging/build/versions.env (the engines field of the console's package.json asks for Node.js 22 or newer). The coding rules are in coding-standards.md.
The tree must keep LF line endings; CRLF breaks shell and Perl scripts inside WSL.
git config core.autocrlf false
git config core.eol lf
kingres/dev/setup-ubuntu.sh installs the toolchain and creates the unprivileged user kingres (PostgreSQL refuses to run as root, and the test suites start real servers).
sudo kingres/dev/setup-ubuntu.sh <your user> # native Ubuntu
On Windows, install the distribution without launching it, then run the script as root inside it (wsl.exe --install -d Ubuntu-24.04 --no-launch, then wsl.exe -d Ubuntu-24.04 -u root -- bash <path>/kingres/dev/setup-ubuntu.sh).
kingres/dev/build.sh all
build.sh runs these commands, each also available alone: sync (mirror the tree into the Linux filesystem when the repository is on a Windows drive), configure (meson setup with assertions and mandatory TAP tests), build (ninja), install (into the private prefix ~/kingres-work/install), test (core regression suite) and test-all (every suite, including TAP tests). The work area is set by KINGRES_WORK (default $HOME/kingres-work) and the parallelism by KINGRES_JOBS.
Check the result:
~/kingres-work/install/bin/postgres --version # postgres (PostgreSQL) 18.7
psql -c 'select version()' # ... (KingresDB 0.1.0)
The PostgreSQL version symbols are unchanged; only the long version string carries the KingresDB suffix (core patch KP-0001 in core-patches.md).
kingres/dev/ext.sh builds one extension from contrib/ with PGXS against an installed server, without rebuilding the server:
kingres/dev/ext.sh kingres_shard all
Commands: sync, clean, build, install, regress (a throwaway server with the extension preloaded and the pg_regress tests), tap (the TAP tests in t/), and all (sync build install regress tap). PROVE_TESTS selects TAP files. EXT_WERROR=1 turns compiler warnings into errors.
The bundled extensions (pgvector, pgaudit and, since 0.2.1, pg_cron; see Extensions) are built from upstream source archives whose URL and SHA-256 are recorded in kingres/extensions/<project>/source.yaml. Since release 0.2.1 (0.2.0 does not have it), kingres/packaging/extensions/fetch-sources.sh fetches each archive once, with retries, into a cache outside the repository and checks its SHA-256 before it keeps the file:
- The cache is
KINGRES_EXT_CACHE(default${XDG_CACHE_HOME:-$HOME/.cache}/kingres/ext-sources); a path below/tmp,/var/tmp,/dev/shmor/runis refused. It holds<sha256>.tar.gz. -
--offline(orKINGRES_EXT_FETCH_OFFLINE=1) never touches the network: it checks the cache only and fails when an archive is missing. When the network is down and a file is missing, the error says which file, from which URL, and under which name to put it by hand. To prepare an offline machine, run the script on a machine with a network and copy the cache over; every file is checked again, so the copy needs no trust. -
build-image.shandbuild-rpm.shgive the checked archives to the Docker build through the build context. The build downloads no extension source and checks each archive again (SHA-256, git commit, every entry) before it extracts anything.KINGRES_EXT_FETCH=0gives the old behaviour (the Docker build downloads the archives itself); a release refuses it.
The Docker build still downloads other things (the apt snapshot or the dnf packages, Go and Node.js, the npm and Go modules). See Installing and Packaging and Release Process.
Every extension must pass on 18 and 19 from one source (ADR 0023). A second major is a second installation. ext.sh accepts KINGRES_PG (a pg_config or an installation directory) to pick the server, and ext-majors.sh runs one extension against every major in turn:
KINGRES_PG18=<installation> KINGRES_PG19=<installation> kingres/dev/ext-majors.sh kingres_ledger
It runs sync clean build install regress tap on each configured major, builds with warnings as errors, prints one line per major and exits non-zero if any failed. KINGRES_PG18 defaults to the installation build.sh makes; with no KINGRES_PG19 only 18 runs. Each major needs an installation of its own, because ext.sh installs into the installation it is given.
A PostgreSQL 19 installation is the one build.sh makes from a checkout of the branch kingres-19, which is on REL_19_0 (testing.md, "Running the suites on both PostgreSQL majors"). Give it its own KINGRES_WORK, so the two majors do not share a work area.
cd kingres/control-plane && go build ./cmd/kingresd
cd kingres/verifier && go test ./...
cd kingres/web && npm ci && npm run build
npm run build type-checks the console and builds it into dist/; the release recipe copies that into kingres/control-plane/internal/webui/dist, which kingresd embeds. kingres-watchdog (go build ./cmd/kingres-watchdog in the control plane) is the second program of the control plane: a server that runs the lease protocol does not start without it.
The release build recipe (kingres/packaging/build/build.sh) builds all of them from a clean snapshot of a branch; see Installing and Packaging. The checks for each part are in Development and Testing.
- A PowerShell or
wsl.exeinlinebash -c "..."rewrites quotes and$. For anything longer than one simple command, put it in a script file. - The packaging recipe checks that
goresolves to a Linux program, not a Windows one under/mnt.
Repository Layout for what is where, Coding Standards for the rules the code follows, Branching and Synchronisation for the two product branches, Testing Strategy for the test layers and Release Process for the release recipe.
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations