Print Milvus banner when start service (#5953)

* print Milvus banner when start service

Signed-off-by: yudong.cai <yudong.cai@zilliz.com>

* update banner

Signed-off-by: yudong.cai <yudong.cai@zilliz.com>

* update messages

Signed-off-by: yudong.cai <yudong.cai@zilliz.com>
pull/5968/head
Cai Yudong 2021-06-22 11:34:04 +08:00 committed by GitHub
parent cdc89648cf
commit 438e7fb4da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -83,9 +83,16 @@ binlog:
@echo "Building binlog ..." @echo "Building binlog ..."
@mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && GO111MODULE=on $(GO) build -o $(INSTALL_PATH)/binlog $(PWD)/cmd/binlog/main.go 1>/dev/null @mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && GO111MODULE=on $(GO) build -o $(INSTALL_PATH)/binlog $(PWD)/cmd/binlog/main.go 1>/dev/null
BUILD_TAGS = $(shell git describe --tags --always --dirty="-dev")
BUILD_TIME = $(shell date)
GIT_COMMIT = $(shell git rev-parse --short HEAD)
GO_VERSION = $(shell go version)
milvus: build-cpp milvus: build-cpp
@echo "Building Milvus ..." @echo "Building Milvus ..."
@mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && GO111MODULE=on $(GO) build -o $(INSTALL_PATH)/milvus $(PWD)/cmd/main.go 1>/dev/null @mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && GO111MODULE=on $(GO) build \
-ldflags="-X 'main.BuildTags=$(BUILD_TAGS)' -X 'main.BuildTime=$(BUILD_TIME)' -X 'main.GitCommit=$(GIT_COMMIT)' -X 'main.GoVersion=$(GO_VERSION)'" \
-o $(INSTALL_PATH)/milvus $(PWD)/cmd/main.go 1>/dev/null
build-go: milvus build-go: milvus

View File

@ -37,6 +37,28 @@ const (
roleStandalone = "standalone" roleStandalone = "standalone"
) )
var (
BuildTags = "unknown"
BuildTime = "unknown"
GitCommit = "unknown"
GoVersion = "unknown"
)
func printBanner() {
fmt.Println()
fmt.Println(" __ _________ _ ____ ______ ")
fmt.Println(" / |/ / _/ /| | / / / / / __/ ")
fmt.Println(" / /|_/ // // /_| |/ / /_/ /\\ \\ ")
fmt.Println(" /_/ /_/___/____/___/\\____/___/ ")
fmt.Println()
fmt.Println("Welcome to use Milvus!")
fmt.Println("Version: " + BuildTags)
fmt.Println("Built: " + BuildTime)
fmt.Println("GitCommit: " + GitCommit)
fmt.Println("GoVersion: " + GoVersion)
fmt.Println()
}
func getPidFileName(serverType string, alias string) string { func getPidFileName(serverType string, alias string) string {
var filename string var filename string
if len(alias) != 0 { if len(alias) != 0 {
@ -239,6 +261,7 @@ func main() {
filename := getPidFileName(serverType, svrAlias) filename := getPidFileName(serverType, svrAlias)
switch command { switch command {
case "run": case "run":
printBanner()
fd, err := createPidFile(filename, runtimeDir) fd, err := createPidFile(filename, runtimeDir)
if err != nil { if err != nil {
panic(err) panic(err)