From 351ef3c379b180ff83af58992be492ac4747add8 Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Fri, 22 Jan 2021 10:36:31 +0800 Subject: [PATCH 01/10] check os compatible and ddependencies_version in prepare_env.sh --- README.md | 8 ++++---- scripts/prepare_env.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0142414d0051..daf5687c5007 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,17 @@ Read more in the [whitepaper](https://github.com/alibaba/GraphScope/blob/main/do ## Getting Started -GraphScope can run on clusters managed by [Kubernetes](https://kubernetes.io/) within containers. For quickly getting started, we can leverage [minikube](https://minikube.sigs.k8s.io/) (on Linux) to set up a *local* Kubernetes cluster and take advantage of pre-built Docker images as follows. +GraphScope can run on clusters managed by [Kubernetes](https://kubernetes.io/) within containers. For quickly getting started, we can set up a *local* Kubernetes cluster and take advantage of pre-built Docker images as follows. ### Prerequisites -To run GraphScope on your local computer with minikube, the following dependencies or tools are required. +To run GraphScope on your local, the following dependencies or tools are required. - Docker -- minikube - Python >= 3.6 (with pip) +- Local Kubernetes cluster tool (e.g. [Minikube](https://minikube.sigs.k8s.io), [Kind](https://kind.sigs.k8s.io)) -For Linux distributions, we provide a script to install the above dependencies and prepare the environment. +For Ubuntu/CentOs/WSL2, we provide a script to install the above dependencies and prepare the environment. ```bash # run the environment preparing script. diff --git a/scripts/prepare_env.sh b/scripts/prepare_env.sh index b6e3e23a3bff..ad9c4a8623a6 100755 --- a/scripts/prepare_env.sh +++ b/scripts/prepare_env.sh @@ -19,6 +19,29 @@ is_in_wsl=false && [[ ! -z "${IS_WSL}" || ! -z "${WSL_DISTRO_NAME}" ]] && is_in_ # Arguments: # None ########################## + +function check_os_compatible() { + if [[ "${is_in_wsl}" == true && -z "${WSL_INTEROP}" ]]; then + echo "Not support to run on WSL1, please use WSL2." + exit 1 + fi + + echo "$(date '+%Y-%m-%d %H:%M:%S') preparing environment on '${platform}'" +} + +function check_dependencies_version() { + # python + if ! hash python3; then + echo "Python3 is not installed" + exit 1 + fi + ver=$(python3 -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/') + if [ "$ver" -lt "36" ]; then + echo "This script requires python 3.6 or greater" + exit 1 + fi +} + function install_dependencies() { echo "$(date '+%Y-%m-%d %H:%M:%S') install dependencies." if [[ "${platform}" == *"Ubuntu"* ]]; then @@ -125,8 +148,12 @@ then exit 0 fi +check_os_compatible + install_dependencies +check_dependencies_version + start_docker launch_k8s_cluster From 9e62e2632d3801be27a61a4e188923a8125c1a6c Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Fri, 22 Jan 2021 10:42:38 +0800 Subject: [PATCH 02/10] update --- README.md | 4 ++-- scripts/prepare_env.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index daf5687c5007..d80e8324666b 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ GraphScope can run on clusters managed by [Kubernetes](https://kubernetes.io/) w ### Prerequisites -To run GraphScope on your local, the following dependencies or tools are required. +To run GraphScope on your local computer, the following dependencies or tools are required. - Docker - Python >= 3.6 (with pip) -- Local Kubernetes cluster tool (e.g. [Minikube](https://minikube.sigs.k8s.io), [Kind](https://kind.sigs.k8s.io)) +- Local Kubernetes cluster set-up tool (e.g. [Minikube](https://minikube.sigs.k8s.io) or [Kind](https://kind.sigs.k8s.io)) For Ubuntu/CentOs/WSL2, we provide a script to install the above dependencies and prepare the environment. diff --git a/scripts/prepare_env.sh b/scripts/prepare_env.sh index ad9c4a8623a6..cf75f61f47a1 100755 --- a/scripts/prepare_env.sh +++ b/scripts/prepare_env.sh @@ -20,7 +20,7 @@ is_in_wsl=false && [[ ! -z "${IS_WSL}" || ! -z "${WSL_DISTRO_NAME}" ]] && is_in_ # None ########################## -function check_os_compatible() { +function check_os_compatibility() { if [[ "${is_in_wsl}" == true && -z "${WSL_INTEROP}" ]]; then echo "Not support to run on WSL1, please use WSL2." exit 1 @@ -148,7 +148,7 @@ then exit 0 fi -check_os_compatible +check_os_compatibility install_dependencies From 15327f5d61c2d8657e38949d066ed7edafb380f3 Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Fri, 22 Jan 2021 11:09:42 +0800 Subject: [PATCH 03/10] update --- scripts/prepare_env.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/prepare_env.sh b/scripts/prepare_env.sh index cf75f61f47a1..4a5047fb6251 100755 --- a/scripts/prepare_env.sh +++ b/scripts/prepare_env.sh @@ -22,7 +22,12 @@ is_in_wsl=false && [[ ! -z "${IS_WSL}" || ! -z "${WSL_DISTRO_NAME}" ]] && is_in_ function check_os_compatibility() { if [[ "${is_in_wsl}" == true && -z "${WSL_INTEROP}" ]]; then - echo "Not support to run on WSL1, please use WSL2." + echo "GraphScope not support to run on WSL1, please use WSL2." + exit 1 + fi + + if [[ "${platform}" != *"Ubuntu"* && "${platform}" != *"CentOS"* ]]; then + echo "This script is only available on Unbuntu/CentOS/WSL2." exit 1 fi @@ -37,7 +42,7 @@ function check_dependencies_version() { fi ver=$(python3 -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/') if [ "$ver" -lt "36" ]; then - echo "This script requires python 3.6 or greater" + echo "GraphScope requires python 3.6 or greater" exit 1 fi } @@ -58,9 +63,6 @@ function install_dependencies() { sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo yum install -y docker-ce docker-ce-cli containerd.io sudo yum clean all - else - echo "Only support Ubuntu and CentOS" - exit 1 fi pip3 install -U pip --user From 430938c543eb5b4b475b6eb560e244401bcb517a Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Fri, 22 Jan 2021 11:11:50 +0800 Subject: [PATCH 04/10] fix typo --- scripts/prepare_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_env.sh b/scripts/prepare_env.sh index 4a5047fb6251..30cb87fb956f 100755 --- a/scripts/prepare_env.sh +++ b/scripts/prepare_env.sh @@ -27,7 +27,7 @@ function check_os_compatibility() { fi if [[ "${platform}" != *"Ubuntu"* && "${platform}" != *"CentOS"* ]]; then - echo "This script is only available on Unbuntu/CentOS/WSL2." + echo "This script is only available on Ubuntu/CentOS/WSL2." exit 1 fi From 380a268d58b268ca7f1a56cbcc7f6962339a211e Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Sun, 24 Jan 2021 11:11:57 +0800 Subject: [PATCH 05/10] update doc --- README.md | 5 ++++- docs/installation.rst | 19 +++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d80e8324666b..3cba547ea663 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,10 @@ To run GraphScope on your local computer, the following dependencies or tools ar - Python >= 3.6 (with pip) - Local Kubernetes cluster set-up tool (e.g. [Minikube](https://minikube.sigs.k8s.io) or [Kind](https://kind.sigs.k8s.io)) -For Ubuntu/CentOs/WSL2, we provide a script to install the above dependencies and prepare the environment. +On Windows and macOS, you can follow the official guides to install them. +For Ubuntu/CenOS Linux distributions, we provide a script to install the above +dependencies and prepare the environment. +Alternatively, You may want to install `WSL2 `_ on Windows to use the scripts. ```bash # run the environment preparing script. diff --git a/docs/installation.rst b/docs/installation.rst index 4eb2a32a6dbc..7be10ac816c2 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,22 +1,21 @@ Installation ============ -The client of GraphScope is distributed as a Python package. It manages a set of -backend engines and the coordinator via containers. +The client of GraphScope is distributed as a Python package. It manages a set of +backend engines and the coordinator via containers. -In practice, GraphScope runs on clusters managed by Kubernetes. -For quickly getting started, we can leverage `minikube `_ -to set up a local Kubernetes cluster and take advantage of pre-built Docker images as follows. +In practice, GraphScope runs on clusters managed by Kubernetes. +For quickly getting started, we set up a local Kubernetes cluster and take advantage of pre-built Docker images as follows. To run GraphScope on your local computer, the following dependencies or tools are required. - Docker -- minikube - Python 3.8 (with pip) +- Local Kubernetes cluster set-up tool (e.g. [Minikube](https://minikube.sigs.k8s.io) or [Kind](https://kind.sigs.k8s.io)) -On Windows and macOS, you can follow the official guides to install them. -For Linux distributions, we provide a script to install the above -dependencies and prepare the environment. +On Windows and macOS, you can follow the official guides to install them. +For Ubuntu/CenOS Linux distributions, we provide a script to install the above +dependencies and prepare the environment. Alternatively, You may want to install `WSL2 `_ on Windows to use the scripts. .. code:: bash @@ -43,7 +42,7 @@ If you have the :code:`.wheel` package, you can install the package using pip install graphscope-0.1.macosx-10.14-x86_64.tar.gz -To build the package from source code, please download the latest version +To build the package from source code, please download the latest version from our `repo `_ with git: .. code:: shell From ba53bf25ae1cbbf34003eaa0cad0c383f26d49a0 Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Sun, 24 Jan 2021 11:47:42 +0800 Subject: [PATCH 06/10] add os checker --- scripts/prepare_env.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/prepare_env.sh b/scripts/prepare_env.sh index 30cb87fb956f..a36346a26f76 100755 --- a/scripts/prepare_env.sh +++ b/scripts/prepare_env.sh @@ -27,10 +27,18 @@ function check_os_compatibility() { fi if [[ "${platform}" != *"Ubuntu"* && "${platform}" != *"CentOS"* ]]; then - echo "This script is only available on Ubuntu/CentOS/WSL2." + echo "This script is only available on Ubuntu/CentOS." exit 1 fi + if [[ "${platform}" != *"Ubuntu"* && "$(grep '^VERSION' /etc/os-release)" -lt "12.04" ]]; then + echo "This script requires Ubuntu 12.04 or greater." + fi + + if [[ "${platform}" != *"CentOS"* && "$(grep '^VERSION' /etc/os-release)" -lt "7" ]]; then + echo "This script requires CentOS 7 or greater." + fi + echo "$(date '+%Y-%m-%d %H:%M:%S') preparing environment on '${platform}'" } @@ -42,7 +50,7 @@ function check_dependencies_version() { fi ver=$(python3 -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/') if [ "$ver" -lt "36" ]; then - echo "GraphScope requires python 3.6 or greater" + echo "GraphScope requires python 3.6 or greater." exit 1 fi } From 8d52dad3037c7c0ff2282648e46ae9d2eb47deed Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Mon, 25 Jan 2021 09:57:24 +0800 Subject: [PATCH 07/10] update check os version --- scripts/prepare_env.sh | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/scripts/prepare_env.sh b/scripts/prepare_env.sh index a36346a26f76..5ecc3f7ac0a2 100755 --- a/scripts/prepare_env.sh +++ b/scripts/prepare_env.sh @@ -9,7 +9,6 @@ set -o pipefail graphscope_home="$( cd "$(dirname "$0")/.." >/dev/null 2>&1 ; pwd -P )" version=$(cat ${graphscope_home}/VERSION) -platform=$(awk -F= '/^NAME/{print $2}' /etc/os-release) is_in_wsl=false && [[ ! -z "${IS_WSL}" || ! -z "${WSL_DISTRO_NAME}" ]] && is_in_wsl=true ########################## @@ -20,6 +19,36 @@ is_in_wsl=false && [[ ! -z "${IS_WSL}" || ! -z "${WSL_DISTRO_NAME}" ]] && is_in_ # None ########################## +function get_os_version() { + if [ -f /etc/os-release ]; then + # freedesktop.org and systemd + . /etc/os-release + platform="${NAME}" + os_version="${VERSION_ID}" + elif type lsb_release >/dev/null 2>&1; then + # linuxbase.org + platform=$(lsb_release -si) + os_version=$(lsb_release -sr) + elif [ -f /etc/lsb-release ]; then + # For some versions of Debian/Ubuntu without lsb_release command + . /etc/lsb-release + platform="${DISTRIB_ID}" + os_version="${DISTRIB_RELEASE}" + elif [ -f /etc/debian_version ]; then + # Older Debian/Ubuntu/etc. + platform=Debian + os_version=$(cat /etc/debian_version) + elif [ -f /etc/redhat-release ]; then + # Older Red Hat, CentOS, etc. + platform=CentOS + os_version=$(cat /etc/debian_version) + else + # Fall back to uname, e.g. "Linux ", also works for BSD, etc. + platform=$(uname -s) + os_version=$(uname -r) + fi +} + function check_os_compatibility() { if [[ "${is_in_wsl}" == true && -z "${WSL_INTEROP}" ]]; then echo "GraphScope not support to run on WSL1, please use WSL2." @@ -31,12 +60,14 @@ function check_os_compatibility() { exit 1 fi - if [[ "${platform}" != *"Ubuntu"* && "$(grep '^VERSION' /etc/os-release)" -lt "12.04" ]]; then - echo "This script requires Ubuntu 12.04 or greater." + if [[ "${platform}" == *"Ubuntu"* && "$(echo ${os_version} | sed 's/\([0-9]\)\([0-9]\).*/\1\2/')" -lt "14" ]]; then + echo "This script requires Ubuntu 14 or greater." + exit 1 fi - if [[ "${platform}" != *"CentOS"* && "$(grep '^VERSION' /etc/os-release)" -lt "7" ]]; then + if [[ "${platform}" == *"CentOS"* && "$(echo ${os_version} | sed 's/\([0-9]\).*/\1')" -lt "7" ]]; then echo "This script requires CentOS 7 or greater." + exit 1 fi echo "$(date '+%Y-%m-%d %H:%M:%S') preparing environment on '${platform}'" @@ -158,6 +189,8 @@ then exit 0 fi +get_os_version + check_os_compatibility install_dependencies From 6d2d5e3e31ad9ede052415d2cea40cad8f2ef265 Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Mon, 25 Jan 2021 10:30:57 +0800 Subject: [PATCH 08/10] update ubuntu require version --- scripts/prepare_env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/prepare_env.sh b/scripts/prepare_env.sh index 5ecc3f7ac0a2..378443d20584 100755 --- a/scripts/prepare_env.sh +++ b/scripts/prepare_env.sh @@ -60,8 +60,8 @@ function check_os_compatibility() { exit 1 fi - if [[ "${platform}" == *"Ubuntu"* && "$(echo ${os_version} | sed 's/\([0-9]\)\([0-9]\).*/\1\2/')" -lt "14" ]]; then - echo "This script requires Ubuntu 14 or greater." + if [[ "${platform}" == *"Ubuntu"* && "$(echo ${os_version} | sed 's/\([0-9]\)\([0-9]\).*/\1\2/')" -lt "18" ]]; then + echo "This script requires Ubuntu 18 or greater." exit 1 fi From fab050f79267cc88078c4f47e600dfcd79b49144 Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Mon, 25 Jan 2021 11:37:23 +0800 Subject: [PATCH 09/10] update --- scripts/prepare_env.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/prepare_env.sh b/scripts/prepare_env.sh index 378443d20584..0b121288bbe5 100755 --- a/scripts/prepare_env.sh +++ b/scripts/prepare_env.sh @@ -19,6 +19,7 @@ is_in_wsl=false && [[ ! -z "${IS_WSL}" || ! -z "${WSL_DISTRO_NAME}" ]] && is_in_ # None ########################## +# https://unix.stackexchange.com/questions/6345/how-can-i-get-distribution-name-and-version-number-in-a-simple-shell-script function get_os_version() { if [ -f /etc/os-release ]; then # freedesktop.org and systemd @@ -38,10 +39,10 @@ function get_os_version() { # Older Debian/Ubuntu/etc. platform=Debian os_version=$(cat /etc/debian_version) - elif [ -f /etc/redhat-release ]; then + elif [ -f /etc/centos-release ]; then # Older Red Hat, CentOS, etc. platform=CentOS - os_version=$(cat /etc/debian_version) + os_version=$(cat /etc/centos-release | sed 's/.* \([0-9]\).*/\1/')) else # Fall back to uname, e.g. "Linux ", also works for BSD, etc. platform=$(uname -s) @@ -65,12 +66,12 @@ function check_os_compatibility() { exit 1 fi - if [[ "${platform}" == *"CentOS"* && "$(echo ${os_version} | sed 's/\([0-9]\).*/\1')" -lt "7" ]]; then + if [[ "${platform}" == *"CentOS"* && "${os_version}" -lt "7" ]]; then echo "This script requires CentOS 7 or greater." exit 1 fi - echo "$(date '+%Y-%m-%d %H:%M:%S') preparing environment on '${platform}'" + echo "$(date '+%Y-%m-%d %H:%M:%S') preparing environment on '${platform}' '${os_version}'" } function check_dependencies_version() { @@ -104,6 +105,8 @@ function install_dependencies() { sudo yum clean all fi + check_dependencies_version + pip3 install -U pip --user pip3 install graphscope vineyard wheel --user @@ -195,8 +198,6 @@ check_os_compatibility install_dependencies -check_dependencies_version - start_docker launch_k8s_cluster From 219357ce920d683c0b923b0c709f6aefd88051a0 Mon Sep 17 00:00:00 2001 From: "qiaozi.zwb" Date: Mon, 25 Jan 2021 12:53:25 +0800 Subject: [PATCH 10/10] update doc --- README.md | 4 ++-- docs/installation.rst | 4 ++-- docs/zh/installation.rst | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3cba547ea663..963a061ea537 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ To run GraphScope on your local computer, the following dependencies or tools ar - Local Kubernetes cluster set-up tool (e.g. [Minikube](https://minikube.sigs.k8s.io) or [Kind](https://kind.sigs.k8s.io)) On Windows and macOS, you can follow the official guides to install them. -For Ubuntu/CenOS Linux distributions, we provide a script to install the above +For Ubuntu/CentOS Linux distributions, we provide a script to install the above dependencies and prepare the environment. -Alternatively, You may want to install `WSL2 `_ on Windows to use the scripts. +Alternatively, you may want to install `WSL2 `_ on Windows to use the script. ```bash # run the environment preparing script. diff --git a/docs/installation.rst b/docs/installation.rst index 7be10ac816c2..1edc80da066f 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -14,9 +14,9 @@ To run GraphScope on your local computer, the following dependencies or tools ar - Local Kubernetes cluster set-up tool (e.g. [Minikube](https://minikube.sigs.k8s.io) or [Kind](https://kind.sigs.k8s.io)) On Windows and macOS, you can follow the official guides to install them. -For Ubuntu/CenOS Linux distributions, we provide a script to install the above +For Ubuntu/CentOS Linux distributions, we provide a script to install the above dependencies and prepare the environment. -Alternatively, You may want to install `WSL2 `_ on Windows to use the scripts. +Alternatively, you may want to install `WSL2 `_ on Windows to use the script. .. code:: bash diff --git a/docs/zh/installation.rst b/docs/zh/installation.rst index dadc74364565..e4715c4a1fce 100644 --- a/docs/zh/installation.rst +++ b/docs/zh/installation.rst @@ -3,16 +3,16 @@ GraphScope 客户端以 Python 程序包的形式发布,背后通过容器机制管理一组引擎和一个协调器。 GraphScope 被设计为运行在 Kubernetes 管理的群集上。 -方便起见,我们可以按照本文档的以下步骤通过 `minikube `_ 部署一个本地 Kubernetes 集群,并加载预编译好的镜像。 +方便起见,我们可以按照本文档的以下步骤部署一个本地 Kubernetes 集群,并加载预编译好的镜像。 本地运行 GraphScope 需要预先安装以下依赖。 - Docker -- minikube - Python 3.8 (with pip) +- Local Kubernetes cluster set-up tool (e.g. [Minikube](https://minikube.sigs.k8s.io) or [Kind](https://kind.sigs.k8s.io)) 对于 Windows 和 MacOS 的用户,可通过官方文档来安装上述依赖。 -对于常见的 Linux 发行版用户,我们提供了脚本来准备运行时环境。 +对于Ubuntu/CentOS Linux 发行版用户,我们提供了脚本来准备运行时环境。 您也可以在 Windows 上安装 `WSL2 `_ 以使用脚本。 .. code:: bash