2026-10-25 21:20:38
This commit is contained in:
1 parent
744968e6d3
commit
f7e10a287c
18 files changed
+63
-7
No files matched your search
@@ -53,6 +53,7 @@ The orchestrator runs the installers in this order:
|
||||
After a successful run, the orchestrator:
|
||||
|
||||
- Optionally updates `shared_preload_libraries` when `CONFIG_FILE` is set.
|
||||
- Logs a `Source downloads` section immediately before the installed-products summary, listing the source URL for PostgreSQL and each extension and the resolved Git tag for GitHub sources.
|
||||
- Prints the installed PostgreSQL and extension versions.
|
||||
- Recreates `sources/<complete-version>/` before starting, where `<complete-version>` is the final directory name of the selected prefix (for example, prefix `/app/postgres/rdbms/18.6.3` uses `sources/18.6.3/`). Each successfully installed component's source tree is saved there with an executable `install_<postgresql-version>.sh` recipe containing that component's configure/build/install commands.
|
||||
- Creates `postgresql-<prefix-basename>-engine.tar.gz` in the directory from which the command was launched (for example, a prefix ending in `18.6.3` produces `postgresql-18.6.3-engine.tar.gz`).
|
||||
|
||||
@@ -25,10 +25,12 @@ reset_staging_dir "$STAGING_DIR"
|
||||
printf 'Building auto_explain from PostgreSQL %s\n' "$POSTGRES_VERSION"
|
||||
readonly POSTGRES_ARCHIVE="$STAGING_DIR/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
readonly POSTGRES_SOURCE="$STAGING_DIR/postgresql-$POSTGRES_VERSION"
|
||||
readonly POSTGRES_SOURCE_URL="https://ftp.postgresql.org/pub/source/v$POSTGRES_VERSION/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
curl -fL --retry 3 --retry-delay 2 \
|
||||
-o "$POSTGRES_ARCHIVE" \
|
||||
"https://ftp.postgresql.org/pub/source/v$POSTGRES_VERSION/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
"$POSTGRES_SOURCE_URL"
|
||||
tar -xzf "$POSTGRES_ARCHIVE" -C "$STAGING_DIR"
|
||||
record_source_download "auto_explain" "$POSTGRES_SOURCE_URL"
|
||||
|
||||
readonly AUTO_EXPLAIN_SOURCE="$POSTGRES_SOURCE/contrib/auto_explain"
|
||||
make -C "$AUTO_EXPLAIN_SOURCE" \
|
||||
|
||||
@@ -169,6 +169,15 @@ RECIPE_HEADER
|
||||
printf 'Saved installation recipe: %s\n' "$recipe"
|
||||
}
|
||||
|
||||
record_source_download() {
|
||||
local product="$1"
|
||||
local source_url="$2"
|
||||
local git_tag="${3:-}"
|
||||
|
||||
[[ -n "${SOURCE_MANIFEST:-}" ]] || return 0
|
||||
printf '%s\t%s\t%s\n' "$product" "$source_url" "$git_tag" >> "$SOURCE_MANIFEST"
|
||||
}
|
||||
|
||||
require_postgresql_installation() {
|
||||
local prefix="$1"
|
||||
local pg_config="$prefix/bin/pg_config"
|
||||
@@ -183,14 +192,22 @@ download_source() {
|
||||
local archive_name="$4"
|
||||
local source_dir="$5"
|
||||
local archive="$staging_dir/$archive_name"
|
||||
local source_url
|
||||
source_url="$(github_source_url "$repository" "$tag")"
|
||||
|
||||
curl -fL --retry 3 --retry-delay 2 \
|
||||
-o "$archive" \
|
||||
"https://github.com/$repository/archive/refs/tags/$tag.tar.gz"
|
||||
"$source_url"
|
||||
tar -xzf "$archive" -C "$staging_dir"
|
||||
[[ -d "$source_dir" ]] || die "source directory was not created: $source_dir"
|
||||
}
|
||||
|
||||
github_source_url() {
|
||||
local repository="$1"
|
||||
local tag="$2"
|
||||
printf 'https://github.com/%s/archive/refs/tags/%s.tar.gz\n' "$repository" "$tag"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
||||
printf 'Shared helper functions used by PostgreSQL component installers.\n'
|
||||
|
||||
@@ -30,6 +30,7 @@ readonly HYPOPG_DIR="$STAGING_DIR/hypopg-${HYPOPG_TAG#v}"
|
||||
printf 'Building HypoPG %s\n' "$HYPOPG_TAG"
|
||||
download_source "$STAGING_DIR" "$HYPOPG_REPOSITORY" "$HYPOPG_TAG" \
|
||||
"hypopg-${HYPOPG_TAG#v}.tar.gz" "$HYPOPG_DIR"
|
||||
record_source_download "HypoPG" "$(github_source_url "$HYPOPG_REPOSITORY" "$HYPOPG_TAG")" "$HYPOPG_TAG"
|
||||
cd "$HYPOPG_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
make install USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -25,10 +25,12 @@ reset_staging_dir "$STAGING_DIR"
|
||||
printf 'Building passwordcheck from PostgreSQL %s\n' "$POSTGRES_VERSION"
|
||||
readonly POSTGRES_ARCHIVE="$STAGING_DIR/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
readonly POSTGRES_SOURCE="$STAGING_DIR/postgresql-$POSTGRES_VERSION"
|
||||
readonly POSTGRES_SOURCE_URL="https://ftp.postgresql.org/pub/source/v$POSTGRES_VERSION/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
curl -fL --retry 3 --retry-delay 2 \
|
||||
-o "$POSTGRES_ARCHIVE" \
|
||||
"https://ftp.postgresql.org/pub/source/v$POSTGRES_VERSION/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
"$POSTGRES_SOURCE_URL"
|
||||
tar -xzf "$POSTGRES_ARCHIVE" -C "$STAGING_DIR"
|
||||
record_source_download "passwordcheck" "$POSTGRES_SOURCE_URL"
|
||||
|
||||
readonly PASSWORDCHECK_SOURCE="$POSTGRES_SOURCE/contrib/passwordcheck"
|
||||
make -C "$PASSWORDCHECK_SOURCE" \
|
||||
|
||||
@@ -31,6 +31,7 @@ readonly PG_CRON_DIR="$STAGING_DIR/pg_cron-${PG_CRON_TAG#v}"
|
||||
printf 'Building pg_cron %s\n' "$PG_CRON_TAG"
|
||||
download_source "$STAGING_DIR" "$PG_CRON_REPOSITORY" "$PG_CRON_TAG" \
|
||||
"pg_cron-${PG_CRON_TAG#v}.tar.gz" "$PG_CRON_DIR"
|
||||
record_source_download "pg_cron" "$(github_source_url "$PG_CRON_REPOSITORY" "$PG_CRON_TAG")" "$PG_CRON_TAG"
|
||||
cd "$PG_CRON_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" PG_CONFIG="$PG_CONFIG"
|
||||
make install PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -30,6 +30,7 @@ readonly PG_HINT_PLAN_DIR="$STAGING_DIR/pg_hint_plan-$PG_HINT_PLAN_TAG"
|
||||
printf 'Building pg_hint_plan %s\n' "$PG_HINT_PLAN_TAG"
|
||||
download_source "$STAGING_DIR" "$PG_HINT_PLAN_REPOSITORY" "$PG_HINT_PLAN_TAG" \
|
||||
"pg_hint_plan-$PG_HINT_PLAN_TAG.tar.gz" "$PG_HINT_PLAN_DIR"
|
||||
record_source_download "pg_hint_plan" "$(github_source_url "$PG_HINT_PLAN_REPOSITORY" "$PG_HINT_PLAN_TAG")" "$PG_HINT_PLAN_TAG"
|
||||
cd "$PG_HINT_PLAN_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
make install USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -31,6 +31,7 @@ readonly PG_REPACK_DIR="$STAGING_DIR/pg_repack-${PG_REPACK_TAG}"
|
||||
printf 'Building pg_repack %s\n' "$PG_REPACK_TAG"
|
||||
download_source "$STAGING_DIR" "$PG_REPACK_REPOSITORY" "$PG_REPACK_TAG" \
|
||||
"pg_repack-${PG_REPACK_TAG}.tar.gz" "$PG_REPACK_DIR"
|
||||
record_source_download "pg_repack" "$(github_source_url "$PG_REPACK_REPOSITORY" "$PG_REPACK_TAG")" "$PG_REPACK_TAG"
|
||||
cd "$PG_REPACK_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" PG_CONFIG="$PG_CONFIG"
|
||||
make install PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -31,6 +31,7 @@ readonly PG_STAT_MONITOR_DIR="$STAGING_DIR/pg_stat_monitor-${PG_STAT_MONITOR_TAG
|
||||
printf 'Building pg_stat_monitor %s\n' "$PG_STAT_MONITOR_TAG"
|
||||
download_source "$STAGING_DIR" "$PG_STAT_MONITOR_REPOSITORY" "$PG_STAT_MONITOR_TAG" \
|
||||
"pg_stat_monitor-${PG_STAT_MONITOR_TAG#v}.tar.gz" "$PG_STAT_MONITOR_DIR"
|
||||
record_source_download "pg_stat_monitor" "$(github_source_url "$PG_STAT_MONITOR_REPOSITORY" "$PG_STAT_MONITOR_TAG")" "$PG_STAT_MONITOR_TAG"
|
||||
cd "$PG_STAT_MONITOR_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" PG_CONFIG="$PG_CONFIG"
|
||||
make install PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -26,10 +26,12 @@ reset_staging_dir "$STAGING_DIR"
|
||||
printf 'Building pg_stat_statements from PostgreSQL %s\n' "$POSTGRES_VERSION"
|
||||
readonly POSTGRES_ARCHIVE="$STAGING_DIR/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
readonly POSTGRES_SOURCE="$STAGING_DIR/postgresql-$POSTGRES_VERSION"
|
||||
readonly POSTGRES_SOURCE_URL="https://ftp.postgresql.org/pub/source/v$POSTGRES_VERSION/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
curl -fL --retry 3 --retry-delay 2 \
|
||||
-o "$POSTGRES_ARCHIVE" \
|
||||
"https://ftp.postgresql.org/pub/source/v$POSTGRES_VERSION/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
"$POSTGRES_SOURCE_URL"
|
||||
tar -xzf "$POSTGRES_ARCHIVE" -C "$STAGING_DIR"
|
||||
record_source_download "pg_stat_statements" "$POSTGRES_SOURCE_URL"
|
||||
make -C "$POSTGRES_SOURCE/contrib/pg_stat_statements" \
|
||||
-j"${JOBS:-$(nproc)}" USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
make -C "$POSTGRES_SOURCE/contrib/pg_stat_statements" \
|
||||
|
||||
@@ -31,6 +31,7 @@ readonly PGAUDIT_DIR="$STAGING_DIR/pgaudit-${PGAUDIT_TAG#v}"
|
||||
printf 'Building pgAudit %s\n' "$PGAUDIT_TAG"
|
||||
download_source "$STAGING_DIR" "$PGAUDIT_REPOSITORY" "$PGAUDIT_TAG" \
|
||||
"pgaudit-${PGAUDIT_TAG#v}.tar.gz" "$PGAUDIT_DIR"
|
||||
record_source_download "pgAudit" "$(github_source_url "$PGAUDIT_REPOSITORY" "$PGAUDIT_TAG")" "$PGAUDIT_TAG"
|
||||
cd "$PGAUDIT_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
make install USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -32,6 +32,7 @@ readonly PGVECTOR_DIR="$STAGING_DIR/pgvector-$PGVECTOR_VERSION"
|
||||
printf 'Building pgvector %s\n' "$PGVECTOR_TAG"
|
||||
download_source "$STAGING_DIR" "$PGVECTOR_REPOSITORY" "$PGVECTOR_TAG" \
|
||||
"pgvector-$PGVECTOR_VERSION.tar.gz" "$PGVECTOR_DIR"
|
||||
record_source_download "pgvector" "$(github_source_url "$PGVECTOR_REPOSITORY" "$PGVECTOR_TAG")" "$PGVECTOR_TAG"
|
||||
cd "$PGVECTOR_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" PG_CONFIG="$PG_CONFIG"
|
||||
make install PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -31,10 +31,12 @@ mkdir -p "$STAGING_DIR" "$PREFIX"
|
||||
printf 'Building PostgreSQL %s\n' "$POSTGRES_VERSION"
|
||||
readonly POSTGRES_ARCHIVE="$STAGING_DIR/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
readonly POSTGRES_SOURCE="$STAGING_DIR/postgresql-$POSTGRES_VERSION"
|
||||
readonly POSTGRES_SOURCE_URL="https://ftp.postgresql.org/pub/source/v$POSTGRES_VERSION/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
curl -fL --retry 3 --retry-delay 2 \
|
||||
-o "$POSTGRES_ARCHIVE" \
|
||||
"https://ftp.postgresql.org/pub/source/v$POSTGRES_VERSION/postgresql-$POSTGRES_VERSION.tar.gz"
|
||||
"$POSTGRES_SOURCE_URL"
|
||||
tar -xzf "$POSTGRES_ARCHIVE" -C "$STAGING_DIR"
|
||||
record_source_download "PostgreSQL" "$POSTGRES_SOURCE_URL"
|
||||
|
||||
cd "$POSTGRES_SOURCE"
|
||||
[[ "$POSTGRES_CONFIGURE_OPTIONS" != ,* &&
|
||||
|
||||
@@ -108,6 +108,7 @@ fi
|
||||
|
||||
readonly PREFIX_VERSION="$(basename -- "$PREFIX")"
|
||||
readonly SOURCES_DIR="$SCRIPT_DIR/sources/$PREFIX_VERSION"
|
||||
readonly SOURCE_MANIFEST="$SOURCES_DIR/.source-manifest.tsv"
|
||||
readonly STAGING_DIR="$SCRIPT_DIR/tmp"
|
||||
readonly PROCESS_LOG="$INVOCATION_DIR/postgresql-$POSTGRES_VERSION-process.log"
|
||||
readonly ENGINE_ARCHIVE="$INVOCATION_DIR/postgresql-$PREFIX_VERSION-engine.tar.gz"
|
||||
@@ -119,7 +120,7 @@ readonly ENGINE_ARCHIVE="$INVOCATION_DIR/postgresql-$PREFIX_VERSION-engine.tar.g
|
||||
rm -rf -- "$STAGING_DIR"
|
||||
mkdir -p "$STAGING_DIR"
|
||||
|
||||
export PREFIX POSTGRES_CONFIGURE_OPTIONS
|
||||
export PREFIX POSTGRES_CONFIGURE_OPTIONS SOURCE_MANIFEST
|
||||
|
||||
if [[ -e "$PREFIX" || -L "$PREFIX" ]]; then
|
||||
printf 'WARNING: PostgreSQL installation directory already exists: %s\n' "$PREFIX" >&2
|
||||
@@ -145,6 +146,7 @@ printf 'PostgreSQL configure options: %s\n' "${POSTGRES_CONFIGURE_OPTIONS:-<none
|
||||
printf 'Recreating source archive directory: %s\n' "$SOURCES_DIR"
|
||||
rm -rf -- "$SOURCES_DIR"
|
||||
mkdir -p "$SOURCES_DIR"
|
||||
: > "$SOURCE_MANIFEST"
|
||||
|
||||
"$SCRIPT_DIR/install_postgresql.sh" --version "$POSTGRES_VERSION"
|
||||
"$SCRIPT_DIR/install_pg_cron.sh" --version "$POSTGRES_VERSION"
|
||||
@@ -197,6 +199,24 @@ if [[ -n "$CONFIG_FILE" ]]; then
|
||||
grep -E '^[[:space:]]*shared_preload_libraries[[:space:]]*=' "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
[[ -s "$SOURCE_MANIFEST" ]] || {
|
||||
printf 'ERROR: source download manifest is empty: %s\n' "$SOURCE_MANIFEST" >&2
|
||||
exit 1
|
||||
}
|
||||
printf '\nSource downloads:\n'
|
||||
while IFS=$'\t' read -r product source_url git_tag; do
|
||||
[[ -n "$product" && -n "$source_url" ]] || {
|
||||
printf 'ERROR: invalid source download record in %s\n' "$SOURCE_MANIFEST" >&2
|
||||
exit 1
|
||||
}
|
||||
printf ' %s\n Source URL: %s\n' "$product" "$source_url"
|
||||
if [[ -n "$git_tag" ]]; then
|
||||
printf ' Git tag: %s\n' "$git_tag"
|
||||
else
|
||||
printf ' Git tag: not applicable (PostgreSQL source archive)\n'
|
||||
fi
|
||||
done < "$SOURCE_MANIFEST"
|
||||
|
||||
extension_version() {
|
||||
local extension="$1"
|
||||
awk -F"'" '/^[[:space:]]*default_version[[:space:]]*=/{print $2; exit}' \
|
||||
|
||||
@@ -31,6 +31,7 @@ readonly SET_USER_DIR="$STAGING_DIR/set_user-${SET_USER_TAG#v}"
|
||||
printf 'Building set_user %s\n' "$SET_USER_TAG"
|
||||
download_source "$STAGING_DIR" "$SET_USER_REPOSITORY" "$SET_USER_TAG" \
|
||||
"set_user-${SET_USER_TAG#v}.tar.gz" "$SET_USER_DIR"
|
||||
record_source_download "set_user" "$(github_source_url "$SET_USER_REPOSITORY" "$SET_USER_TAG")" "$SET_USER_TAG"
|
||||
cd "$SET_USER_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" PG_CONFIG="$PG_CONFIG"
|
||||
make install PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -31,6 +31,7 @@ readonly TIMESCALEDB_DIR="$STAGING_DIR/timescaledb-${TIMESCALEDB_TAG#v}"
|
||||
printf 'Building TimescaleDB %s\n' "$TIMESCALEDB_TAG"
|
||||
download_source "$STAGING_DIR" "$TIMESCALEDB_REPOSITORY" "$TIMESCALEDB_TAG" \
|
||||
"timescaledb-${TIMESCALEDB_TAG#v}.tar.gz" "$TIMESCALEDB_DIR"
|
||||
record_source_download "TimescaleDB" "$(github_source_url "$TIMESCALEDB_REPOSITORY" "$TIMESCALEDB_TAG")" "$TIMESCALEDB_TAG"
|
||||
cd "$TIMESCALEDB_DIR"
|
||||
./bootstrap \
|
||||
-DPG_CONFIG="$PG_CONFIG" \
|
||||
|
||||
@@ -30,6 +30,7 @@ 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"
|
||||
record_source_download "wal2json" "$(github_source_url "$WAL2JSON_REPOSITORY" "$WAL2JSON_TAG")" "$WAL2JSON_TAG"
|
||||
cd "$WAL2JSON_DIR"
|
||||
make -j"${JOBS:-$(nproc)}" USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
make install USE_PGXS=1 PG_CONFIG="$PG_CONFIG"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
./install_postgresql_extensions.sh \
|
||||
--version 18.6 \
|
||||
--prefix /app/staging_area_r2d2/postgres/rdbms/18.6 \
|
||||
--prefix /app/postgres/rdbms/18.6 \
|
||||
--options="--with-ssl=openssl,--with-lz4"
|
||||
|
||||
Reference in new issue
Block a user