From 8c65976cbf9ea7d527d7ea037dbd3b64d4e23a4f Mon Sep 17 00:00:00 2001 From: Michal Zander <mzander@syncad.com> Date: Wed, 9 Oct 2024 13:33:23 +0000 Subject: [PATCH] Upgrade to postgres 17 --- .gitlab-ci.yml | 2 +- CMakeLists.txt | 2 +- Dockerfile | 9 ++++----- docker/docker_entrypoint.sh | 2 +- docker/postgresql.conf | 8 ++++---- scripts/setup_ubuntu.sh | 4 ++-- .../hive_fork_manager/test_extension_update.sh | 2 +- .../functional/hive_fork_manager/test_table_schema.sh | 2 +- .../functional/hive_fork_manager/test_update_script.sh | 2 +- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 09fbd9292..078c476b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ variables: FF_ENABLE_JOB_CLEANUP: 1 GIT_STRATEGY: clone # uses registry.gitlab.syncad.com/hive/haf/ci-base-image:ubuntu22.04-15 - BUILDER_IMAGE_TAG: "@sha256:8f0313c1b46b23ea74ea4e6a3809a1c7a41354994a9b066960bd645f375a1530" + BUILDER_IMAGE_TAG: "@sha256:eb9e060983fab933c3a81d148c5f07f73c14a35f6d2bbec18c69c5efdabad4fc" CI_DEBUG_SERVICES: "true" SETUP_SCRIPTS_PATH: "$CI_PROJECT_DIR/scripts" TEST_TOOLS_NODE_DEFAULT_WAIT_FOR_LIVE_TIMEOUT: 60 diff --git a/CMakeLists.txt b/CMakeLists.txt index 25a105869..bc41e7574 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ IF ( NOT DEFINED POSTGRES_INSTALLATION_DIR ) IF ( POSTGRES_PG_CONFIG ) EXECUTE_PROCESS(COMMAND ${POSTGRES_PG_CONFIG} --bindir OUTPUT_VARIABLE POSTGRES_INSTALLATION_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) ELSE() - SET( POSTGRES_INSTALLATION_DIR "/usr/lib/postgresql/16/bin" ) + SET( POSTGRES_INSTALLATION_DIR "/usr/lib/postgresql/17/bin" ) ENDIF() ENDIF() diff --git a/Dockerfile b/Dockerfile index f91de5b2a..24004f3db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,8 +31,7 @@ RUN apt-get update && \ DEBIAN_FRONTEND=noniteractive apt-get install --no-install-recommends -y postgresql-common gnupg && \ /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \ apt-get update && \ - DEBIAN_FRONTEND=noniteractive apt-get install --no-install-recommends -y curl postgresql-16 postgresql-16-cron libpq5 libboost-chrono1.74.0 libboost-context1.74.0 libboost-filesystem1.74.0 libboost-thread1.74.0 busybox \ - netcat-openbsd && \ + DEBIAN_FRONTEND=noniteractive apt-get install --no-install-recommends -y curl postgresql-17 postgresql-17-cron libpq5 libboost-chrono1.74.0 libboost-context1.74.0 libboost-filesystem1.74.0 libboost-thread1.74.0 busybox netcat-openbsd && \ apt-get remove -y gnupg && \ apt-get autoremove -y && \ busybox --install -s @@ -159,7 +158,7 @@ WORKDIR /home/haf_admin COPY --from=build --chown=haf_admin:users /home/haf_admin/build /home/haf_admin/build/ COPY --from=build --chown=haf_admin:users "${HAF_SOURCE_DIR}" "${HAF_SOURCE_DIR}" -ENV POSTGRES_VERSION=16 +ENV POSTGRES_VERSION=17 COPY --from=build --chown=haf_admin:users "${HAF_SOURCE_DIR}/docker/docker_entrypoint.sh" . COPY --from=build --chown=postgres:postgres "${HAF_SOURCE_DIR}/docker/postgresql.conf" /etc/postgresql/$POSTGRES_VERSION/main/postgresql.conf COPY --from=build --chown=postgres:postgres "${HAF_SOURCE_DIR}/docker/pg_hba.conf" /etc/postgresql/$POSTGRES_VERSION/main/pg_hba.conf.default @@ -209,7 +208,7 @@ EXPOSE ${WS_PORT} # JSON rpc service EXPOSE ${HTTP_PORT} -FROM registry.gitlab.syncad.com/hive/haf/minimal-runtime:ubuntu22.04-14 AS minimal-instance +FROM registry.gitlab.syncad.com/hive/haf/minimal-runtime:ubuntu22.04-15 AS minimal-instance ENV BUILD_IMAGE_TAG=${BUILD_IMAGE_TAG:-:ubuntu22.04-8} @@ -233,7 +232,7 @@ ENV PG_ACCESS="host haf_block_log haf_app_admin 172.0.0.0/8 trust\n # Always define default value of HIVED_UID variable to make possible direct spawn of docker image (without run_hived_img.sh wrapper) ENV HIVED_UID=1000 -ENV POSTGRES_VERSION=16 +ENV POSTGRES_VERSION=17 SHELL ["/bin/bash", "-c"] diff --git a/docker/docker_entrypoint.sh b/docker/docker_entrypoint.sh index 698cb1e4d..0429cc67b 100755 --- a/docker/docker_entrypoint.sh +++ b/docker/docker_entrypoint.sh @@ -45,7 +45,7 @@ source "$SCRIPTSDIR/common.sh" HAF_DB_STORE="$DATADIR/haf_db_store" PGDATA=$HAF_DB_STORE/pgdata -export POSTGRES_VERSION=${POSTGRES_VERSION:-16} +export POSTGRES_VERSION=${POSTGRES_VERSION:-17} DO_MAINTENANCE=0 #Allows to enter some maintenance mode (when postgres is started but hived not yet. Rather for internal debugging/development purposes) PERFORM_DUMP=0 diff --git a/docker/postgresql.conf b/docker/postgresql.conf index a4cd4407f..ed08e002b 100644 --- a/docker/postgresql.conf +++ b/docker/postgresql.conf @@ -771,18 +771,18 @@ max_worker_processes = 9 ### HAF default settings -cluster_name = '16/haf_main' +cluster_name = '17/haf_main' data_directory = '/home/hived/datadir/haf_db_store/pgdata' # use data in another directory # (change requires restart) -hba_file = '/etc/postgresql/16/main/pg_hba.conf' # host-based authentication file +hba_file = '/etc/postgresql/17/main/pg_hba.conf' # host-based authentication file # (change requires restart) -ident_file = '/etc/postgresql/16/main/pg_ident.conf' # ident configuration file +ident_file = '/etc/postgresql/17/main/pg_ident.conf' # ident configuration file # (change requires restart) # If external_pid_file is not explicitly set, no extra PID file is written. -external_pid_file = '/var/run/postgresql/16-main.pid' # write an extra PID file +external_pid_file = '/var/run/postgresql/17-main.pid' # write an extra PID file # (change requires restart) idle_in_transaction_session_timeout=60000 #ms diff --git a/scripts/setup_ubuntu.sh b/scripts/setup_ubuntu.sh index 2db6deb79..5a8b2b349 100755 --- a/scripts/setup_ubuntu.sh +++ b/scripts/setup_ubuntu.sh @@ -47,7 +47,7 @@ install_all_dev_packages() { postgresql-common /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y - DEBIAN_FRONTEND=noniteractive apt-get install -y postgresql-16 postgresql-server-dev-16 postgresql-16-cron \ + DEBIAN_FRONTEND=noniteractive apt-get install -y postgresql-17 postgresql-server-dev-17 postgresql-17-cron \ netcat-openbsd # needed to correctly handle --skip-hived option apt-get clean @@ -78,7 +78,7 @@ create_haf_admin_account() { echo "Attempting to create $haf_admin_unix_account account..." assert_is_root - # Unfortunately haf_admin must be able to su as root, because it must be able to write into /usr/share/postgresql/16/extension directory, being owned by root (it could be owned by postgres) + # Unfortunately haf_admin must be able to su as root, because it must be able to write into /usr/share/postgresql/17/extension directory, being owned by root (it could be owned by postgres) if id "$haf_admin_unix_account" &>/dev/null; then echo "Account $haf_admin_unix_account already exists. Creation skipped." else diff --git a/tests/integration/functional/hive_fork_manager/test_extension_update.sh b/tests/integration/functional/hive_fork_manager/test_extension_update.sh index 46e5c5af0..566e944d7 100755 --- a/tests/integration/functional/hive_fork_manager/test_extension_update.sh +++ b/tests/integration/functional/hive_fork_manager/test_extension_update.sh @@ -61,7 +61,7 @@ done test_extension_update() { - POSTGRES_VERSION=16 + POSTGRES_VERSION=17 # old libhfm has to be removed so in case of an corrupted setup of haf the old libhfm won't be used sudo rm -rf /usr/lib/postgresql/${POSTGRES_VERSION}/lib/libhfm-* # modify the hived_api.sql file diff --git a/tests/integration/functional/hive_fork_manager/test_table_schema.sh b/tests/integration/functional/hive_fork_manager/test_table_schema.sh index 1993b1c47..c87620d9c 100755 --- a/tests/integration/functional/hive_fork_manager/test_table_schema.sh +++ b/tests/integration/functional/hive_fork_manager/test_table_schema.sh @@ -96,7 +96,7 @@ test_extension_update() { sudo -Enu "$DB_ADMIN" psql -w $POSTGRES_ACCESS -d "$DB_NAME" -v ON_ERROR_STOP=on -U "$DB_ADMIN" -c "ALTER TABLE hive.accounts ADD COLUMN phone_number VARCHAR;" # run generator script - POSTGRES_VERSION=16 + POSTGRES_VERSION=17 sudo /usr/share/postgresql/${POSTGRES_VERSION}/extension/hive_fork_manager_update_script_generator.sh 2>&1 | tee -i update.txt || true if grep -q "Table schema is inconsistent" update.txt; then echo "Update test succeed" diff --git a/tests/integration/functional/hive_fork_manager/test_update_script.sh b/tests/integration/functional/hive_fork_manager/test_update_script.sh index 32da2a398..3f9ab65ba 100755 --- a/tests/integration/functional/hive_fork_manager/test_update_script.sh +++ b/tests/integration/functional/hive_fork_manager/test_update_script.sh @@ -7,7 +7,7 @@ set -eu -o pipefail SCRIPTPATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" SCRIPTS_DIR="$SCRIPTPATH/../../../../scripts" UPDATE_DB_NAME=update-db-test -POSTGRES_VERSION=16 +POSTGRES_VERSION=17 export PGUSER="haf_admin" export PGHOST="/var/run/postgresql" -- GitLab