From 1c16dd5f3fab22a29aecee074b6a5c175eac1431 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 27 Jun 2022 14:48:12 +0200 Subject: [PATCH 1/2] (feat) Use bat to display coloured documentation of environment variables during setup --- CHANGELOG.md | 1 + doc/environment.md | 4 ++-- setup/setup.sh | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2f7b1bae..9bef22cfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Added some eslint rules to validate react components code style - Fixed all react components code according to eslint rules - Renamed proof-of-identity to supporting-documents in react components and in end-user strings +- Use bat to display coloured documentation of environment variables during setup - Fix a bug: when email was mapped from SSO provided as empty string -> unable to merge account - Fix a bug: when an empty data was retured by the SSO, unable to edit it - Fix a bug: user can change his group in the profile completion page, even if mapped from the SSO diff --git a/doc/environment.md b/doc/environment.md index ec9577d8b..9d9f69166 100644 --- a/doc/environment.md +++ b/doc/environment.md @@ -58,9 +58,9 @@ You can generate such a random key by running `rails secret`. Configure the Rails' Action Mailer delivery method. See http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration for more details. - + - SMTP_ADDRESS, SMTP_PORT, SMTP_USER_NAME, SMTP_PASSWORD, SMTP_AUTHENTICATION, SMTP_ENABLE_STARTTLS_AUTO, SMTP_OPENSSL_VERIFY_MODE & SMTP_TLS + SMTP_ADDRESS, SMTP_PORT, SMTP_USER_NAME, SMTP_PASSWORD, SMTP_AUTHENTICATION, SMTP_ENABLE_STARTTLS_AUTO & SMTP_OPENSSL_VERIFY_MODE When DELIVERY_METHOD is set to **smtp**, configure the SMTP server parameters. See https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration for more details. diff --git a/setup/setup.sh b/setup/setup.sh index bc8c1f018..d50adee0f 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -15,11 +15,11 @@ welcome_message() printf "\n Welcome to Fab-manager's setup assistant\n\n\n" echo "Thank you for installing Fab-manager." printf "This script will guide you through the installation process of Fab-manager\n\n" - echo -e "Please report any \e[1mfeedback or improvement request\e[21m on https://feedback.fab-manager.com/" - echo -e "For \e[1mbug reports\e[21m, please open a new issue on https://github.com/sleede/fab-manager/issues" - echo -e "You can call for \e[1mcommunity assistance\e[21m on https://forum.fab-manager.com/" + echo -e "Please report any \e[1mfeedback or improvement request\e[0m on https://feedback.fab-manager.com/" + echo -e "For \e[1mbug reports\e[0m, please open a new issue on https://github.com/sleede/fab-manager/issues" + echo -e "You can call for \e[1mcommunity assistance\e[0m on https://forum.fab-manager.com/" printf "\nYou can interrupt this installation at any time by pressing Ctrl+C\n" - printf "If you do not feel confortable with this installation, you can \e[4msubscribe to our hosting offers\e[24m:\nhttps://www.fab-manager.com/saas-offer\n\n" + printf "If you do not feel confortable with this installation, you can \e[4msubscribe to our hosting offers\e[0m:\nhttps://www.fab-manager.com/saas-offer\n\n" read -rp "Continue? (Y/n) " confirm " value /dev/null; then - get_md_anchor "$doc" "ALLOW_INSECURE_HTTP" + get_md_anchor "$doc" "ALLOW_INSECURE_HTTP" | bat --file-name "ALLOW_INSECURE_HTTP" --language md --color=always printf "You have set \e[1mDEFAULT_PROTOCOL\e[21m to \e[1mhttp\e[21m.\n" read -rp "Do you want to allow insecure HTTP? (Y/n) " confirm Date: Mon, 27 Jun 2022 15:19:53 +0200 Subject: [PATCH 2/2] (feat) Check the minimum docker version (20.10) during setup and upgrade --- CHANGELOG.md | 1 + doc/production_readme.md | 2 +- setup/setup.sh | 14 ++++++++++++++ setup/upgrade.sh | 5 +++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bef22cfd..6731878f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Fixed all react components code according to eslint rules - Renamed proof-of-identity to supporting-documents in react components and in end-user strings - Use bat to display coloured documentation of environment variables during setup +- Check the minimum docker version (20.10) during setup and upgrade - Fix a bug: when email was mapped from SSO provided as empty string -> unable to merge account - Fix a bug: when an empty data was retured by the SSO, unable to edit it - Fix a bug: user can change his group in the profile completion page, even if mapped from the SSO diff --git a/doc/production_readme.md b/doc/production_readme.md index f19640193..0ed30cb83 100644 --- a/doc/production_readme.md +++ b/doc/production_readme.md @@ -50,7 +50,7 @@ This might work on other linux systems, and CPU architectures but this is untest `curl` and `bash` are needed to retrieve and run the automated deployment scripts. Then the various scripts will check for their own dependencies. -Moreover, the main software dependencies to run fab-manager are [Docker](https://docs.docker.com/engine/installation/linux/docker-ce/debian/) v20.0 or above and [Docker Compose](https://docs.docker.com/compose/install/) +Moreover, the main software dependencies to run fab-manager are [Docker](https://docs.docker.com/engine/installation/linux/docker-ce/debian/) v20.10 or above and [Docker Compose](https://docs.docker.com/compose/install/) They can be easily installed using the [`prepare-vps.sleede.com` script below](#prepare-the-server). diff --git a/setup/setup.sh b/setup/setup.sh index d50adee0f..2bd954455 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -54,11 +54,25 @@ system_requirements() echo -e "\e[91m[ ❌ ] $_command was not found, exiting...\e[39m" && exit 1 fi done + echo "detecting docker version..." + DOCKER_VERSION=$(docker -v | grep -oP "([0-9]{1,}\.)+[0-9]{1,}") + if verlt "$DOCKER_VERSION" 20.10; then + echo -e "\e[91m[ ❌ ] The installed docker version ($DOCKER_VERSION) is lower than the minimum required version (20.10). Exiting...\e[39m" && exit 1 + fi echo "detecting docker-compose..." docker-compose version printf "\e[92m[ ✔ ] All requirements successfully checked.\e[39m \n\n" } +# compare versions utilities +# https://stackoverflow.com/a/4024263/1039377 +verlte() { + [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ] +} +verlt() { + [ "$1" = "$2" ] && return 1 || verlte "$1" "$2" +} + docker-compose() { if ! docker compose version 1>/dev/null 2>/dev/null diff --git a/setup/upgrade.sh b/setup/upgrade.sh index c35dff083..c8c62c3dd 100644 --- a/setup/upgrade.sh +++ b/setup/upgrade.sh @@ -110,6 +110,11 @@ config() echo -e "\e[91m[ ❌ ] docker-compose.yml was not found in ${PWD}. Please run this script from the Fab-manager's installation folder. Exiting... \e[39m" exit 1 fi + echo "Checking docker version..." + DOCKER_VERSION=$(docker -v | grep -oP "([0-9]{1,}\.)+[0-9]{1,}") + if verlt "$DOCKER_VERSION" 20.10; then + echo -e "\e[91m[ ❌ ] The installed docker version ($DOCKER_VERSION) is lower than the minimum required version (20.10). Exiting...\e[39m" && exit 1 + fi SERVICE="$(yq eval '.services.*.image | select(. == "sleede/fab-manager*") | path | .[-2]' docker-compose.yml)" YES_ALL=${Y:-false}