diff --git a/PostgreSQL/build_rdbms_01/Readme.md b/PostgreSQL/build_rdbms_01/Readme.md index 3fec5e1..815eb26 100644 --- a/PostgreSQL/build_rdbms_01/Readme.md +++ b/PostgreSQL/build_rdbms_01/Readme.md @@ -48,6 +48,7 @@ The orchestrator runs the installers in this order: 11. pgvector 12. HypoPG 13. pg_hint_plan +14. wal2json After a successful run, the orchestrator: @@ -76,6 +77,7 @@ Each component can also be installed independently. The PostgreSQL installation ./install_pgvector.sh --version 18.6 ./install_hypopg.sh --version 18.6 ./install_pg_hint_plan.sh --version 18.6 +./install_wal2json.sh --version 18.6 ``` Each installer also accepts `-v 18.6` and the previous positional form (`./install_pg_cron.sh 18.6`). The all-in-one orchestrator passes its complete `--version` value to every component installer. @@ -169,6 +171,10 @@ Builds and installs HypoPG against the selected PostgreSQL installation. Create Builds and installs the pg_hint_plan tag matching the PostgreSQL major version when available. Create it in each database where it will be used with `CREATE EXTENSION pg_hint_plan`. +### `install_wal2json.sh` + +Builds and installs wal2json as a PostgreSQL logical decoding output plugin. It does not use `CREATE EXTENSION` or require `shared_preload_libraries`; configure PostgreSQL with `wal_level = logical` and restart the server before creating a logical replication slot that uses the `wal2json` plugin. + ### `install_common.sh` Shared helper functions used by the installers, including: @@ -201,6 +207,7 @@ The following environment variables can override defaults: | `PGVECTOR_TAG` | Latest release/tag | pgvector source tag | | `HYPOPG_TAG` | Latest release/tag | HypoPG source tag | | `PG_HINT_PLAN_TAG` | PostgreSQL-major-compatible tag | pg_hint_plan source tag | +| `WAL2JSON_TAG` | Latest release/tag | wal2json source tag | Repository variables can also be overridden when using a custom mirror: @@ -214,6 +221,7 @@ PG_STAT_MONITOR_REPOSITORY=owner/repository PGVECTOR_REPOSITORY=owner/repository HYPOPG_REPOSITORY=owner/repository PG_HINT_PLAN_REPOSITORY=owner/repository +WAL2JSON_REPOSITORY=owner/repository ``` Example: @@ -233,7 +241,7 @@ When `CONFIG_FILE` is supplied, the orchestrator adds the modules and extensions shared_preload_libraries = 'pg_cron,timescaledb,pgaudit,pg_stat_statements,pg_stat_monitor,passwordcheck' ``` -`pg_repack`, pgvector, HypoPG, and `set_user` do not require `shared_preload_libraries`. `auto_explain` and pg_hint_plan can be loaded per session or configured for server startup; they are not added automatically. `passwordcheck` and `auto_explain` are PostgreSQL contrib modules (not SQL extensions), and `pg_stat_activity` is a built-in PostgreSQL system view. +`pg_repack`, pgvector, HypoPG, `set_user`, and wal2json do not require `shared_preload_libraries`. `auto_explain` and pg_hint_plan can be loaded per session or configured for server startup; they are not added automatically. wal2json is a logical decoding output plugin and requires `wal_level = logical` plus a server restart before use. `passwordcheck` and `auto_explain` are PostgreSQL contrib modules (not SQL extensions), and `pg_stat_activity` is a built-in PostgreSQL system view. ## Prerequisites @@ -276,7 +284,8 @@ ls \ /app/postgres/rdbms/18.6/lib/pg_stat_monitor.so \ /app/postgres/rdbms/18.6/lib/auto_explain.so \ /app/postgres/rdbms/18.6/lib/hypopg.so \ - /app/postgres/rdbms/18.6/lib/pg_hint_plan.so + /app/postgres/rdbms/18.6/lib/pg_hint_plan.so \ + /app/postgres/rdbms/18.6/lib/wal2json.so ``` The extension SQL objects still need to be created in each target database with PostgreSQL's `CREATE EXTENSION` command. diff --git a/PostgreSQL/build_rdbms_01/install_postgresql_extensions.sh b/PostgreSQL/build_rdbms_01/install_postgresql_extensions.sh index 5aae6d2..a2067d2 100644 --- a/PostgreSQL/build_rdbms_01/install_postgresql_extensions.sh +++ b/PostgreSQL/build_rdbms_01/install_postgresql_extensions.sh @@ -159,6 +159,7 @@ mkdir -p "$SOURCES_DIR" "$SCRIPT_DIR/install_pgvector.sh" --version "$POSTGRES_VERSION" "$SCRIPT_DIR/install_hypopg.sh" --version "$POSTGRES_VERSION" "$SCRIPT_DIR/install_pg_hint_plan.sh" --version "$POSTGRES_VERSION" +"$SCRIPT_DIR/install_wal2json.sh" --version "$POSTGRES_VERSION" readonly CONFIG_FILE="${CONFIG_FILE:-}" readonly SHARED_PRELOAD_LIBRARIES="pg_cron,timescaledb,pgaudit,pg_stat_statements,pg_stat_monitor,passwordcheck" @@ -217,6 +218,7 @@ printf ' pg_stat_monitor: %s\n' "$(extension_version pg_stat_monitor)" printf ' pgvector: %s\n' "$(extension_version vector)" printf ' hypopg: %s\n' "$(extension_version hypopg)" printf ' pg_hint_plan: %s\n' "$(extension_version pg_hint_plan)" +printf ' wal2json: logical decoding output plugin\n' printf " shared_preload_libraries = '%s'\n" "$SHARED_PRELOAD_LIBRARIES" rm -f -- "$ENGINE_ARCHIVE" diff --git a/PostgreSQL/build_rdbms_01/install_wal2json.sh b/PostgreSQL/build_rdbms_01/install_wal2json.sh new file mode 100644 index 0000000..6eb0fba --- /dev/null +++ b/PostgreSQL/build_rdbms_01/install_wal2json.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=install_common.sh +source "$SCRIPT_DIR/install_common.sh" + +readonly STAGING_DIR="${STAGING_DIR:-$SCRIPT_DIR/tmp}" +readonly POSTGRES_ROOT="${POSTGRES_ROOT:-/app/postgres/rdbms}" +readonly WAL2JSON_REPOSITORY="${WAL2JSON_REPOSITORY:-eulerto/wal2json}" + +if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then + show_help "$0" "Build and install wal2json for an existing PostgreSQL installation." + exit 0 +fi + +POSTGRES_VERSION="$(parse_postgresql_version "$@")" +readonly POSTGRES_VERSION +require_tools curl tar make +readonly PREFIX="${PREFIX:-$POSTGRES_ROOT/$POSTGRES_VERSION}" +readonly PG_CONFIG="$PREFIX/bin/pg_config" +require_postgresql_installation "$PREFIX" +reset_staging_dir "$STAGING_DIR" + +readonly WAL2JSON_TAG="${WAL2JSON_TAG:-$(latest_tag "$WAL2JSON_REPOSITORY")}" +[[ -n "$WAL2JSON_TAG" ]] || die "could not determine the latest wal2json release" +readonly WAL2JSON_DIR="$STAGING_DIR/wal2json-$WAL2JSON_TAG" + +printf 'Building wal2json %s\n' "$WAL2JSON_TAG" +download_source "$STAGING_DIR" "$WAL2JSON_REPOSITORY" "$WAL2JSON_TAG" \ + "wal2json-$WAL2JSON_TAG.tar.gz" "$WAL2JSON_DIR" +cd "$WAL2JSON_DIR" +make -j"${JOBS:-$(nproc)}" USE_PGXS=1 PG_CONFIG="$PG_CONFIG" +make install USE_PGXS=1 PG_CONFIG="$PG_CONFIG" +test -f "$PREFIX/lib/wal2json.so" + +readonly SAVED_SOURCE_DIR="$(copy_install_source "$WAL2JSON_DIR" "$PREFIX" "wal2json-$WAL2JSON_TAG")" +write_install_recipe "$SAVED_SOURCE_DIR" "$POSTGRES_VERSION" "$PREFIX" <<'RECIPE' +cd "$SCRIPT_DIR" + +# Configure +# wal2json uses PGXS directly and does not require a separate configure step. + +# Make +make -j"$JOBS" USE_PGXS=1 PG_CONFIG="$PG_CONFIG" + +# Make install +make install USE_PGXS=1 PG_CONFIG="$PG_CONFIG" +RECIPE diff --git a/PostgreSQL/build_rdbms_01/wrapper.sh b/PostgreSQL/build_rdbms_01/wrapper.sh index 110a7b0..6b9b72f 100644 --- a/PostgreSQL/build_rdbms_01/wrapper.sh +++ b/PostgreSQL/build_rdbms_01/wrapper.sh @@ -1,5 +1,5 @@ ./install_postgresql_extensions.sh \ - --version 17.11 \ - --prefix /app/staging_area/postgres/rdbms/17.11 \ - --options="--with-ssl=openssl,--with-ls4" + --version 18.6 \ + --prefix /app/staging_area/postgres/rdbms/18.6 \ + --options="--with-ssl=openssl,--with-lz4" diff --git a/divers/vminfo.txt b/divers/vminfo.txt index 11dba69..1e887ab 100644 --- a/divers/vminfo.txt +++ b/divers/vminfo.txt @@ -6,7 +6,9 @@ exegol OEL9 - ogg21 helska OEL9 - ogg21 # raxus PostgreSQL -belasco PostgreSQL +# belasco PostgreSQL + +mobus Rocky Linux 9, for Copilot jakku Windows 7 - Ciel Compta utapau Windows 11 (vplesnila/secret)