
Purpose: This document provides context and
technical details for the postgres component (part of
_storage) within the LibScript ecosystem. LibScript is a
modular, zero-dependency shell-script framework designed for
cross-platform software provisioning across Linux, macOS, DOS, and
Windows.
Current State: LibScript functions as a
comprehensive global and per-component package manager, featuring a
robust core CLI (libscript.sh, libscript.cmd,
libscript.bat). It includes multi-platform toolchain
support (Rust, Python, Node, Go, Java, C/C++), servers (Postgres 18,
Nginx, Valkey), and advanced environment querying (env
subcommand). It natively supports generating deployment configurations
(package_as docker, package_as docker_compose,
package_as msi, package_as innosetup,
package_as nsis, package_as TUI) with deep
installer customization, automated parallel dependency downloading and
resolution via libscript.json, and robust uninstall
lifecycle hooks (uninstall.sh/uninstall.cmd)
for cleanly removing binaries, configs, and services. It natively
handles deep semantic versioning, global --secrets
extraction, caching, OpenBao/Vault generation, local caching via SQLite
(db-search, update-db), explicit error
handling for unsupported actions, and background process serving. Recent
advancements have stabilized major Windows installer generation (MSI,
InnoSetup, NSIS) and expanded macOS native service provisioning.
This directory contains the installation and configuration scripts
for postgres. It is designed to be executed via the global
libscript.sh router or directly via
cli.sh.
Unix (Linux/macOS):
./cli.sh <COMMAND> <PACKAGE_NAME> [VERSION] [OPTIONS]Windows:
cli.cmd <COMMAND> <PACKAGE_NAME> [VERSION] [OPTIONS]The following environment variables can be passed to the CLI
(--KEY=VALUE) or exported before running the setup
script.
| Variable | Description | Default | Aliases |
|---|---|---|---|
POSTGRESQL_VERSION |
Version of PostgreSQL demanded | none |
| | `POSTGRES_USER` | Username to create inside postgres | `none` | |
POSTGRES_PASSWORD |
Password for created user inside postgres | none |
| | `POSTGRES_PASSWORD_FILE` | Password file, its contents used as password for created user inside postgres | `none` | |
POSTGRES_SERVICE_USER |
Username for superuser & system role | none |
| | `POSTGRES_SERVICE_PASSWORD` | Password for postgres user; fallsback to `POSTGRES_PASSWORD` | `none` | |
POSTGRES_HOST |
Hostname to serve postgres from | none |
| | `POSTGRES_DB` | Database to create within postgres | `none` | |
LIBSCRIPT_GLOBAL_INSTALL_METHOD |
Global override for how software should be installed across all systems (e.g. system package manager vs downloaded binaries/from-source). | system |
| | `LIBSCRIPT_WINDOWS_PKG_MGR` | Global package manager override for Windows targets (e.g. winget, choco). | `winget` | |
LIBSCRIPT_LISTEN_PORT |
Global port to listen on | none |
| | `LIBSCRIPT_LISTEN_ADDRESS` | Global address to listen on | `none` | |
LIBSCRIPT_LISTEN_SOCKET |
Global unix socket to listen on | none |
| | `POSTGRES_LISTEN_PORT` | Port for POSTGRES to listen on | `none` | |
POSTGRES_LISTEN_ADDRESS |
Address for POSTGRES to listen on | none |
| | `POSTGRES_LISTEN_SOCKET` | Unix socket for POSTGRES to listen on | `none` | |
POSTGRES_DATA_DIR |
Directory for PostgreSQL data cluster | none |
| | `POSTGRES_LOCALE` | Locale for PostgreSQL initdb (e.g. English, United States) | `none` | |
POSTGRES_SERVICE_RUN_AS_USER |
Windows local user account to run the service (leave empty for Network Service) | none |
| | `POSTGRES_SERVICE_RUN_AS_PASSWORD` | Password for the local user account (if applicable) | `none` | |
POSTGRES_SERVICE_NAME |
Custom name for the Windows Service (allows side-by-side installations) | libscript_postgres |
`` |
setup.sh: The main entrypoint that resolves the OS and
invokes the correct script.setup_generic.sh: Fallback installation logic using the
package manager mapper.test.sh / test.cmd: Verification scripts
to ensure the component is installed and functioning correctly.vars.schema.json: The schema definition for the CLI
arguments.
postgres server vars
(root object)postgres vars that can be set
postgres server vars Properties
| Type | Description | Required | |
|---|---|---|---|
| POSTGRESQL_VERSION | string |
Version of PostgreSQL demanded | No |
| POSTGRES_USER | string |
Username to create inside postgres | No |
| POSTGRES_PASSWORD | string |
Password for created user inside postgres | No |
| POSTGRES_PASSWORD_FILE | string |
Password file, its contents used as password for created user inside postgres | No |
| POSTGRES_SERVICE_USER | string |
Username for superuser & system role | No |
| POSTGRES_SERVICE_PASSWORD | string |
Password for postgres user; fallsback to
POSTGRES_PASSWORD |
No |
| POSTGRES_HOST | string |
Hostname to serve postgres from | No |
| POSTGRES_DB | string |
Database to create within postgres | No |
| LIBSCRIPT_GLOBAL_INSTALL_METHOD | string |
Global override for how software should be installed across all systems (e.g. system package manager vs downloaded binaries/from-source). | No, default: "system" |
| LIBSCRIPT_WINDOWS_PKG_MGR | string |
Global package manager override for Windows targets (e.g. winget, choco). | No, default: "winget" |
| LIBSCRIPT_LISTEN_PORT | ["string", "integer"] |
Global port to listen on | No |
| LIBSCRIPT_LISTEN_ADDRESS | string |
Global address to listen on | No |
| LIBSCRIPT_LISTEN_SOCKET | string |
Global unix socket to listen on | No |
| POSTGRES_LISTEN_PORT | ["string", "integer"] |
Port for POSTGRES to listen on | No |
| POSTGRES_LISTEN_ADDRESS | string |
Address for POSTGRES to listen on | No |
| POSTGRES_LISTEN_SOCKET | string |
Unix socket for POSTGRES to listen on | No |
| POSTGRES_DATA_DIR | string |
Directory for PostgreSQL data cluster | No |
| POSTGRES_LOCALE | string |
Locale for PostgreSQL initdb (e.g. English, United States) | No |
| POSTGRES_SERVICE_RUN_AS_USER | string |
Windows local user account to run the service (leave empty for Network Service) | No |
| POSTGRES_SERVICE_RUN_AS_PASSWORD | string |
Password for the local user account (if applicable) | No |
| POSTGRES_SERVICE_NAME | string |
Custom name for the Windows Service (allows side-by-side installations) | No, default: "libscript_postgres" |
Additional properties are allowed.
Version of PostgreSQL demanded
stringUsername to create inside postgres
stringPassword for created user inside postgres
stringPassword file, its contents used as password for created user inside postgres
stringUsername for superuser & system role
stringPassword for postgres user; fallsback to
POSTGRES_PASSWORD
stringHostname to serve postgres from
stringDatabase to create within postgres
stringGlobal override for how software should be installed across all systems (e.g. system package manager vs downloaded binaries/from-source).
string"system""system""source"Global package manager override for Windows targets (e.g. winget, choco).
string"winget""winget""choco"Global port to listen on
["string", "integer"]Global address to listen on
stringGlobal unix socket to listen on
stringPort for POSTGRES to listen on
["string", "integer"]Address for POSTGRES to listen on
stringUnix socket for POSTGRES to listen on
stringDirectory for PostgreSQL data cluster
stringLocale for PostgreSQL initdb (e.g. English, United States)
stringWindows local user account to run the service (leave empty for Network Service)
stringPassword for the local user account (if applicable)
stringCustom name for the Windows Service (allows side-by-side installations)
string"libscript_postgres"