diff --git a/core/controllers/system_info.go b/core/controllers/system_info.go index 9b4fad83..45ff983a 100644 --- a/core/controllers/system_info.go +++ b/core/controllers/system_info.go @@ -2,14 +2,14 @@ package controllers import ( "github.com/crawlab-team/crawlab/core/entity" + "github.com/crawlab-team/crawlab/core/utils" "github.com/gin-gonic/gin" - "github.com/spf13/viper" ) func GetSystemInfo(c *gin.Context) { info := &entity.SystemInfo{ - Edition: viper.GetString("edition"), - Version: viper.GetString("version"), + Edition: utils.GetEdition(), + Version: utils.GetVersion(), } HandleSuccessWithData(c, info) } diff --git a/core/utils/logo.go b/core/utils/logo.go index 91c6dcbd..b5c86c05 100644 --- a/core/utils/logo.go +++ b/core/utils/logo.go @@ -7,22 +7,31 @@ import ( func PrintLogoWithWelcomeInfo() { printLogo() + printSystemInfo() printWelcomeInfo() } func printLogo() { figure.NewColorFigure("Crawlab", "slant", "blue", true).Print() + fmt.Println("Welcome to use Crawlab: the ultimate distributed web crawling platform for efficient, scalable data extraction.") + fmt.Println() +} + +func printSystemInfo() { + fmt.Println("System Info:") + fmt.Printf("- Version: %s (%s)\n", GetEditionLabel(), GetVersion()) + fmt.Printf("- Node Type: %s\n", GetNodeTypeLabel()) fmt.Println() } func printWelcomeInfo() { - fmt.Println("Distributed web crawling platform for efficient, scalable data extraction.") fmt.Println("For more information, please refer to the following resources:") fmt.Println("- Website: https://crawlab.cn") fmt.Println("- Documentation: https://docs.crawlab.cn") - fmt.Println("- GitHub: https://github.com/crawlab-team/crawlab") - if IsMaster() { - fmt.Println("Visit https://localhost:8080 for the web ui, once the server is ready.") - } + fmt.Println("- GitHub Repo: https://github.com/crawlab-team/crawlab") fmt.Println() + if IsMaster() { + fmt.Println("Visit the web ui at https://localhost:8080 (please be patient, it takes a while to start up)") + fmt.Println() + } } diff --git a/core/utils/system.go b/core/utils/system.go new file mode 100644 index 00000000..24156a1e --- /dev/null +++ b/core/utils/system.go @@ -0,0 +1,28 @@ +package utils + +import "github.com/spf13/viper" + +func GetVersion() string { + return viper.GetString("version") + +} + +func GetEdition() string { + return viper.GetString("edition") +} + +func GetEditionLabel() string { + if IsPro() { + return "Crawlab Pro" + } else { + return "Crawlab Community" + } +} + +func GetNodeTypeLabel() string { + if IsMaster() { + return "Master" + } else { + return "Worker" + } +} diff --git a/docker/base-image/install/python/python.sh b/docker/base-image/install/python/python.sh index d918ca55..0ede9ee5 100644 --- a/docker/base-image/install/python/python.sh +++ b/docker/base-image/install/python/python.sh @@ -65,9 +65,8 @@ verify_python() { return 1 fi - pip_version=$(pip -V) - if [[ ! $pip_version =~ "python ${version}" ]]; then - echo "ERROR: pip version does not match. expected: \"python ${version}\", but actual is \"${pip_version}\"" + if ! command -v pip &> /dev/null; then + echo "ERROR: pip is not installed" return 1 fi return 0