1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

improved pre-run checks in upgrade scripts

This commit is contained in:
Sylvain 2019-10-09 11:17:15 +02:00
parent 9577ea6292
commit 95038313e9
4 changed files with 29 additions and 7 deletions

View File

@ -8,6 +8,8 @@ We've wrote a script to automate the process while keeping your data integrity,
- You need to install *curl*, *jq*, *GNU awk* and *sudo* on your system before running the script.
Usually, `apt update && apt install curl jq sudo gawk`, ran as root, will do the trick but this may change, depending upon your system.
- Your current user must be part of the *docker* and *sudo* groups.
Using the root user is a possible alternative, but not recommended.
- You'll need at least 4GB of RAM for the data migration to complete successfully.
The script will try to add 4GB of swap memory if this requirement is detected as missing but this will consume you hard disk space (see below).
- 1,2GB of free disk space are also required to perform the data migration.

View File

@ -8,6 +8,8 @@ We've wrote a script to automate the process while keeping your data integrity,
- 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.
- Your current user must be part of the *docker* and *sudo* groups.
Using the root user is a possible alternative, but not recommended.
- 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.

View File

@ -15,6 +15,24 @@ 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 </dev/tty
if [[ "$confirm" = "n" ]]; then exit 1; fi
else
if ! command -v sudo
then
echo "Please install and configure sudo before running this script."
echo "sudo was not found, exiting..."
exit 1
elif ! groups | grep sudo; then
echo "Please add your current user to the sudoers."
echo "You can run the following as root: \"usermod -aG sudo $(whoami)\", then logout and login again"
echo "sudo was not configured, exiting..."
exit 1
fi
if ! groups | grep docker; then
echo "Please add your current user to the docker group."
echo "You can run the following as root: \"usermod -aG docker $(whoami)\", then logout and login again"
echo "current user is not allowed to use docker, exiting..."
exit 1
fi
fi
echo "detecting curl..."
if ! command -v curl
@ -30,12 +48,6 @@ config()
echo "jq was not found, exiting..."
exit 1
fi
if ! command -v sudo
then
echo "Please install and configure sudo before running this script."
echo "sudo was not found, exiting..."
exit 1
fi
if ! command -v awk || ! [[ $(awk -W version) =~ ^GNU ]]
then
echo "Please install GNU Awk before running this script."

View File

@ -15,10 +15,16 @@ config()
exit 1
elif ! groups | grep sudo; then
echo "Please add your current user to the sudoers."
echo 'You can run the following as root: "usermod -aG sudo myuser"'
echo "You can run the following as root: \"usermod -aG sudo $(whoami)\", then logout and login again"
echo "sudo was not configured, exiting..."
exit 1
fi
if ! groups | grep docker; then
echo "Please add your current user to the docker group."
echo "You can run the following as root: \"usermod -aG docker $(whoami)\", then logout and login again"
echo "current user is not allowed to use docker, exiting..."
exit 1
fi
fi
if ! command -v awk || ! [[ $(awk -W version) =~ ^GNU ]]
then