Skip to content
Snippets Groups Projects
Commit 8c65976c authored by Michal Zander's avatar Michal Zander Committed by Dan Notestein
Browse files

Upgrade to postgres 17

parent a84e1bd3
No related branches found
No related tags found
6 merge requests!627merge in fix for get_current_block_age,!626Fix get_current_block_age function to avoid healthcheck fails,!622merge develop to master,!599merge ( with merge commit) develop to master,!597Merge develop to master for release,!534Upgrade to postgresql 17
...@@ -14,7 +14,7 @@ variables: ...@@ -14,7 +14,7 @@ variables:
FF_ENABLE_JOB_CLEANUP: 1 FF_ENABLE_JOB_CLEANUP: 1
GIT_STRATEGY: clone GIT_STRATEGY: clone
# uses registry.gitlab.syncad.com/hive/haf/ci-base-image:ubuntu22.04-15 # 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" CI_DEBUG_SERVICES: "true"
SETUP_SCRIPTS_PATH: "$CI_PROJECT_DIR/scripts" SETUP_SCRIPTS_PATH: "$CI_PROJECT_DIR/scripts"
TEST_TOOLS_NODE_DEFAULT_WAIT_FOR_LIVE_TIMEOUT: 60 TEST_TOOLS_NODE_DEFAULT_WAIT_FOR_LIVE_TIMEOUT: 60
......
...@@ -50,7 +50,7 @@ IF ( NOT DEFINED POSTGRES_INSTALLATION_DIR ) ...@@ -50,7 +50,7 @@ IF ( NOT DEFINED POSTGRES_INSTALLATION_DIR )
IF ( POSTGRES_PG_CONFIG ) IF ( POSTGRES_PG_CONFIG )
EXECUTE_PROCESS(COMMAND ${POSTGRES_PG_CONFIG} --bindir OUTPUT_VARIABLE POSTGRES_INSTALLATION_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) EXECUTE_PROCESS(COMMAND ${POSTGRES_PG_CONFIG} --bindir OUTPUT_VARIABLE POSTGRES_INSTALLATION_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
ELSE() ELSE()
SET( POSTGRES_INSTALLATION_DIR "/usr/lib/postgresql/16/bin" ) SET( POSTGRES_INSTALLATION_DIR "/usr/lib/postgresql/17/bin" )
ENDIF() ENDIF()
ENDIF() ENDIF()
......
...@@ -31,8 +31,7 @@ RUN apt-get update && \ ...@@ -31,8 +31,7 @@ RUN apt-get update && \
DEBIAN_FRONTEND=noniteractive apt-get install --no-install-recommends -y postgresql-common gnupg && \ DEBIAN_FRONTEND=noniteractive apt-get install --no-install-recommends -y postgresql-common gnupg && \
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \ /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
apt-get update && \ 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 \ 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 && \
netcat-openbsd && \
apt-get remove -y gnupg && \ apt-get remove -y gnupg && \
apt-get autoremove -y && \ apt-get autoremove -y && \
busybox --install -s busybox --install -s
...@@ -159,7 +158,7 @@ WORKDIR /home/haf_admin ...@@ -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 /home/haf_admin/build /home/haf_admin/build/
COPY --from=build --chown=haf_admin:users "${HAF_SOURCE_DIR}" "${HAF_SOURCE_DIR}" 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=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/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 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} ...@@ -209,7 +208,7 @@ EXPOSE ${WS_PORT}
# JSON rpc service # JSON rpc service
EXPOSE ${HTTP_PORT} 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} 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 ...@@ -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) # 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 HIVED_UID=1000
ENV POSTGRES_VERSION=16 ENV POSTGRES_VERSION=17
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
......
...@@ -45,7 +45,7 @@ source "$SCRIPTSDIR/common.sh" ...@@ -45,7 +45,7 @@ source "$SCRIPTSDIR/common.sh"
HAF_DB_STORE="$DATADIR/haf_db_store" HAF_DB_STORE="$DATADIR/haf_db_store"
PGDATA=$HAF_DB_STORE/pgdata 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) 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 PERFORM_DUMP=0
......
...@@ -771,18 +771,18 @@ max_worker_processes = 9 ...@@ -771,18 +771,18 @@ max_worker_processes = 9
### HAF default settings ### 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 data_directory = '/home/hived/datadir/haf_db_store/pgdata' # use data in another directory
# (change requires restart) # (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) # (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) # (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written. # 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) # (change requires restart)
idle_in_transaction_session_timeout=60000 #ms idle_in_transaction_session_timeout=60000 #ms
......
...@@ -47,7 +47,7 @@ install_all_dev_packages() { ...@@ -47,7 +47,7 @@ install_all_dev_packages() {
postgresql-common postgresql-common
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y /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 netcat-openbsd # needed to correctly handle --skip-hived option
apt-get clean apt-get clean
...@@ -78,7 +78,7 @@ create_haf_admin_account() { ...@@ -78,7 +78,7 @@ create_haf_admin_account() {
echo "Attempting to create $haf_admin_unix_account account..." echo "Attempting to create $haf_admin_unix_account account..."
assert_is_root 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 if id "$haf_admin_unix_account" &>/dev/null; then
echo "Account $haf_admin_unix_account already exists. Creation skipped." echo "Account $haf_admin_unix_account already exists. Creation skipped."
else else
......
...@@ -61,7 +61,7 @@ done ...@@ -61,7 +61,7 @@ done
test_extension_update() { 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 # 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-* sudo rm -rf /usr/lib/postgresql/${POSTGRES_VERSION}/lib/libhfm-*
# modify the hived_api.sql file # modify the hived_api.sql file
......
...@@ -96,7 +96,7 @@ test_extension_update() { ...@@ -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;" 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 # 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 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 if grep -q "Table schema is inconsistent" update.txt; then
echo "Update test succeed" echo "Update test succeed"
......
...@@ -7,7 +7,7 @@ set -eu -o pipefail ...@@ -7,7 +7,7 @@ set -eu -o pipefail
SCRIPTPATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" SCRIPTPATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
SCRIPTS_DIR="$SCRIPTPATH/../../../../scripts" SCRIPTS_DIR="$SCRIPTPATH/../../../../scripts"
UPDATE_DB_NAME=update-db-test UPDATE_DB_NAME=update-db-test
POSTGRES_VERSION=16 POSTGRES_VERSION=17
export PGUSER="haf_admin" export PGUSER="haf_admin"
export PGHOST="/var/run/postgresql" export PGHOST="/var/run/postgresql"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment