diff --git a/doc/postgres_upgrade.md b/doc/postgres_upgrade.md index 3a717c173..6e94f3507 100644 --- a/doc/postgres_upgrade.md +++ b/doc/postgres_upgrade.md @@ -6,8 +6,8 @@ Fab-manager release 4.2.0 has upgraded its dependency to PostgreSQL from version To keep using fab-manager you need to upgrade your installation with the new version. We've wrote a script to automate the process while keeping your data integrity, but there's some requirements to understand before running it. -- You need to install *curl* and *GNU awk* on your system before running the script. - Usually, `apt update && apt install curl gawk`, ran as root, will do the trick but this may change, depending upon your system. +- You need to install *curl*, *GNU awk* and *sudo* on your system before running the script. + Usually, `apt update && apt install curl gawk sudo`, ran as root, will do the trick but this may change, depending upon your system. - A bit of free disk space is also required to perform the data migration. The amount needed depends on your current database size, the script will check it and tell you if there's not enough available space. - This script should run on any Linux or MacOS systems if you installed ElasticSearch using docker-compose. diff --git a/scripts/postgre-upgrade.sh b/scripts/postgre-upgrade.sh index 7bd1a2b3f..e7daf02bf 100644 --- a/scripts/postgre-upgrade.sh +++ b/scripts/postgre-upgrade.sh @@ -7,6 +7,18 @@ config() echo "It is not recommended to run this script as root. As a normal user, elevation will be prompted if needed." read -rp "Continue anyway? (Y/n) " confirm "$FM_PATH/.awktmpfile" && mv "$FM_PATH/.awktmpfile" "$FM_PATH/docker-compose.yml" docker-compose pull + trust_pg_hba_conf docker-compose up -d } +trust_pg_hba_conf() +{ + if [ "$(whoami)" = "root" ]; then COMMAND="tee" + else COMMAND="sudo tee"; fi + { + echo + echo "host all all all trust" + } | "$COMMAND" -a "$NEW_PATH/pg_hba.conf" > /dev/null +} + clean() { read -rp "Remove the previous PostgreSQL data folder? (y/N) " confirm