Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/upgradeversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ fi
# mitigate: 'you must have read and write access in the current directory'
cd /var/lib/postgresql

# Once started, pg_upgrade will verify the two clusters are compatible and then do the upgrade.
# See https://www.postgresql.org/docs/current/pgupgrade.html
pg_upgrade \
-U "${POSTGRES_USER}" \
--old-bindir ${PGBINOLD} \
Expand Down
9 changes: 5 additions & 4 deletions tests/test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -euo pipefail
# attempts to upgrade it and checks if the version file was updated correctly.

DOCKER_IMAGE=packages.greenbone.net/opensight/opensight-postgres
PREVIOUS_VERSION=16.6 # released version to test the upgrade from
PREVIOUS_VERSION=16.9.3 # released version to test the upgrade from

tempdir=$(mktemp -d -t opensight-postgres-test-XXXXX)

Expand All @@ -15,11 +15,11 @@ cleanup() {
}
trap cleanup ERR

sudo chown -R 999:999 "${tempdir}"
sudo chown -R 10002:10002 "${tempdir}"

# Start a PostgreSQL container with an outdated version
docker run -it --rm \
--user 999:999 \
--user 10002:10002 \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=keycloak \
-e POSTGRES_USER=keycloak \
Expand All @@ -29,7 +29,8 @@ docker run -it --rm \
# Upgrade the database with the test version
docker build -t ${DOCKER_IMAGE}:test .
docker run -it --rm \
--user 999:999 -e POSTGRES_PASSWORD=password \
--user 10002:10002 \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=keycloak \
-e POSTGRES_USER=keycloak \
-v "${tempdir}":/var/lib/postgresql/data \
Expand Down
Loading