bisos.postgres: PostgreSQL as the bedrock database of BISOS
Overview
bisos.postgres makes PostgreSQL the bedrock of BISOS: the sole database, and a generic layer on which other capabilities are built. Airflow, django-based packages and every other capability that needs a database converge on it, each as a tenant. In the BISOS model many capabilities co-exist consistently on one host (typically one of several multi-tenant VMs), and a single, well-known database layer is what lets them do so.
The package is a BISOS Capability Bundle (CBS/CBM). A planted pointer leaf (cbmProc.spcs at sys/cbm/collective/bedrock/postgres/) subprocess-invokes a Capability Bundle Specification (postgres-cbs.pcs), whose bundle is the package installation (postgres-sbom.pcs). The CBM walker processes the bedrock capabilityType before all other capability types, so tenants find the cluster already running.
Package Documentation At Github
The information below is a subset of the full of documentation for this bisos-pip package. More complete documentation is available at: https://github.com/bisos-pip/postgres-cs
Table of Contents TOC
-
Cluster and Tenants Information: ``postgresAdmin.cs` <#cluster-and-tenants-information-postgresadmincs>`__
Direct PostgreSQL Cheat Sheet: ``quickPostgres.cs` <#direct-postgresql-cheat-sheet-quickpostgrescs>`__
The Tenant Model
A tenant of the bedrock database is a PostgreSQL role plus a database of the same name, owned by that role. The tenant’s service runs as an OS account of the same name, and connects over the unix socket (/var/run/postgresql) with peer authentication: PostgreSQL maps the connecting OS account to the like-named role. No password and no secret exists anywhere.
The administrator is the postgres OS account (and role) that Debian creates with the postgresql package. Only the bedrock capability administers the cluster; a tenant never does.
A tenant unit declares its dependency with Requires=/=After postgresql.service.
What This Package Does And Does Not Do
Does:
Installs the postgresql server and the libpq-dev client headers (apt).
Makes sure the cluster is enabled and running, discovering its version and name rather than hardcoding them.
Sets max_connections to at least 200, the baseline every tenant may assume. The value is server-wide, so it is owned here and not by any one consumer.
Does not:
Author a systemd unit. Debian’s postgresql.service is used as is.
Provision tenants (roles and databases). For now each consumer creates its own; a shared provisioning interface is an open item (see Planned Improvements).
Install Python drivers (psycopg2, asyncpg, …). Those belong to each consumer’s sbom.
Installation
You can install bisos.postgres with pip or pipx.
Installation With pip
If you need access to bisos.postgres as a python module, install it with pip:
pip install bisos.postgres
Installation With pipx
If you only need access to bisos.postgres on the command line, install it with pipx:
pipx install bisos.postgres
The following commands are made available:
postgresAdmin.cs — read-only information about this host’s cluster and its tenants.
quickPostgres.cs — direct-command cheat sheet for psql, pg_* and the postgresql service.
postgres-cbs.pcs — Capability Bundle Specification: declares the sbom.
cbmProc-postgres.spcs — planted CBM pointer that materializes the CBS at this host.
postgres-sbom.pcs — package installation via bisos.sbom.
dbClients-sbom.pcs — the database clients, run by postgres-sbom.pcs; and dbeaver-sbom.pcs, the DBeaver Community Edition client, run by it.
Usage
Cluster and Tenants Information: postgresAdmin.cs
Run with no arguments (or -i examples) to see the full menu. Key sub-commands:
postgresAdmin.cs -i clusterInfo # cluster, service, version, data dir, max_connections
postgresAdmin.cs -i tenantsInfo # roles, databases, connections
postgresAdmin.cs -i fullUpdate # both together
Direct PostgreSQL Cheat Sheet: quickPostgres.cs
For direct psql / pg_lsclusters / systemctl / journalctl invocations, run:
quickPostgres.cs
Clients
Standardizing on PostgreSQL also means choosing which clients are used with it. There is no single tool; there is one per context, layered:
Context |
Client |
Notes |
|---|---|---|
Every host, every VM |
psql (`` postgresql-client``) |
The baseline. Works with peer authentication over the unix socket, no password. |
Blee (Libre-Halaal, Emacs) |
sql-mode and org-babel SQL; PGmacs |
SQL lives in org files beside the documentation. PGmacs browses and edits tables over the network or a unix socket. |
Graphical, optional |
DBeaver Community Edition |
Apache 2.0. Over a unix socket it needs junixsocket driver properties. |
VS Code, in proprietary environments |
Microsoft’s PostgreSQL ext ension |
See below. |
The clients are installed by a group sbom, dbClients-sbom.pcs: postgresql-client (psql) and, through its own file dbeaver-sbom.pcs, DBeaver. The group stands alone, for a platform that needs only clients to reach a cluster on another host; postgres-sbom.pcs pulls it in, after the server steps, so a host that runs the server gets the clients too and a failure in a client cannot undo the server. DBeaver is not in Debian’s own apt, so it comes from the vendor repository; the vendor key is fetched over https and trusted on first use. DBeaver Community Edition sends anonymous usage statistics by default; each user can switch that off under Window > Preferences > General > Usage Statistics. The BISOS Platform is edge-oriented and includes a desktop, so a graphical client on a host is normal.
VS Code
Some environments require VS Code, and they are proprietary ones. For them the client is Microsoft’s PostgreSQL extension for VS Code (ms-ossdata.vscode-postgresql in the Marketplace). Blee remains the Libre-Halaal answer; VS Code is an accommodation, not a replacement for it.
The extension’s documented connection profile asks for a hostname, database, user and password. Whether it can connect over the unix socket with peer authentication has not been confirmed. If it cannot, using it against a bedrock cluster needs a TCP listener, a pg_hba.conf entry and a password: an exception to the tenant model, where no secret exists anywhere. Such an exception is for the bedrock layer to own and to grant deliberately, not for a tenant or a developer to configure ad hoc. See Planned Improvements.
Key Files
An overview of the relevant files of the bisos.postgres package (starting point; to be expanded as the package develops):
py3/bin/postgres-sbom.pcs — package installation: server, client headers, cluster running with the connection baseline.
py3/bin/dbClients-sbom.pcs — the database clients: postgresql-client, and dbeaver-sbom.pcs; stands alone, and is pulled in by postgres-sbom.pcs.
py3/bin/dbeaver-sbom.pcs — DBeaver Community Edition: the vendor apt source and the package; pulled in by dbClients-sbom.pcs.
py3/bin/postgres-cbs.pcs — CBS declaring the bundle (the sbom alone: no assemble step, no units).
py3/bin/cbmProc-postgres.spcs — planted CBM pointer leaf for sys/cbm/collective/bedrock/postgres/.
py3/bin/postgresAdmin.cs — cluster and tenants information (clusterInfo, tenantsInfo, fullUpdate).
py3/bin/quickPostgres.cs — direct-command cheat sheet.
py3/bisos/postgres/ — the library surface; empty so far.
py3/tests/verify.sh — smoke test for the command services.
py3/setup.py, py3/pypiProc.sh — PyPI packaging (setup.py is dblock-driven; do not hand-edit).
Part of BISOS — ByStar Internet Services Operating System
Layered on top of Debian, BISOS (By* Internet Services Operating System) is a unified and universal framework for developing both internet services and software-service continuums that use internet services. See Bootstrapping ByStar, BISOS and Blee for information about getting started with BISOS.
BISOS is a foundation for The Libre-Halaal ByStar Digital Ecosystem which is described as a cure for losses of autonomy and privacy in a book titled: Nature of Polyexistentials
bisos.postgres is part of BISOS. It is a standalone package that can be used independently of the full BISOS environment.
Documentation and Blee-Panels
bisos.postgres is part of the ByStar Digital Ecosystem http://www.by-star.net.
This module’s primary documentation is in the form of Blee-Panels. Blee-Panels are in the ./panels directory. From within Blee and BISOS these panels are accessible under the Blee “Panels” menu.
See file:./panels/bisos.postgres/_nodeBase_/fullUsagePanel-en.org for a starting point.
bisos.postgres is best developed with Blee, the By* BISOS Libre-Halaal Emacs Environment — a layer on top of Emacs and BISOS which creates a comprehensive integrated usage and development environment.
Support
Planned Improvements
TODO Decide the interface through which a consumer asks for its role and database
TODO Adopt the live cluster of this host, with its existing airflow tenant, without re-creating anything
TODO Own pghba.conf, backup and restore, and major-version upgrades at the bedrock level
TODO Confirm whether Microsoft’s VS Code PostgreSQL extension can use the unix socket with peer authentication; if not, decide how bedrock grants a TCP and password exception
TODO Confirm DBeaver Community Edition’s telemetry setting and its unix-socket connection on a current version
Metadata
Release files for bisos.postgres 0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bisos_postgres-0.11.tar.gz | 36.5 kB | Without provenance | Details for bisos_postgres-0.11.tar.gz |
Release files / bisos_postgres-0.11.tar.gz
| Download URL | bisos_postgres-0.11.tar.gz |
|---|---|
| Size | 36.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99a1c38bba91361011afc865653a36bef448a3f773815896d68e24a68a6c9e77
|
|
BLAKE2b-256 checksum How to use checksums |
73fde8763f632abe7bf35c3b9c7a10b3c55fcb3008ec741be5f38d51726e2b63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|
Security for bisos.postgres 0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.