From de7c33416776b5635f39f99ec154a45e95ec6e0c Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Fri, 24 Dec 2021 15:07:04 +0800 Subject: [PATCH] updated version --- backend/cmd/root.go | 14 +++++++++++++ backend/go.mod | 2 +- backend/go.mod.local | 5 ++--- backend/test/config-worker-03.json | 10 +++++++++ frontend/package.json | 4 ++-- frontend/public/index.html | 6 +++--- workspace/docker-compose.yml | 33 ++++++++++++++++++++++++++---- 7 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 backend/test/config-worker-03.json diff --git a/backend/cmd/root.go b/backend/cmd/root.go index 8c6c322f..9d0ef3eb 100644 --- a/backend/cmd/root.go +++ b/backend/cmd/root.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/apex/log" "strings" "github.com/spf13/cobra" @@ -54,4 +55,17 @@ func initConfig() { if err := viper.ReadInConfig(); err == nil { fmt.Println("Using config file:", viper.ConfigFileUsed()) } + + // initialize log level + initLogLevel() +} + +func initLogLevel() { + // set log level + logLevel := viper.GetString("log.level") + l, err := log.ParseLevel(logLevel) + if err != nil { + l = log.InfoLevel + } + log.SetLevel(l) } diff --git a/backend/go.mod b/backend/go.mod index ef8367fc..63f78ded 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/apex/log v1.9.0 - github.com/crawlab-team/crawlab-core v0.6.0-beta.20211219.2134 + github.com/crawlab-team/crawlab-core v0.6.0-beta.20211224.1500 github.com/crawlab-team/go-trace v0.1.1 github.com/gin-gonic/gin v1.7.1 github.com/spf13/cobra v1.1.3 diff --git a/backend/go.mod.local b/backend/go.mod.local index 129fe194..41c13932 100644 --- a/backend/go.mod.local +++ b/backend/go.mod.local @@ -11,11 +11,10 @@ replace ( require ( github.com/apex/log v1.9.0 - github.com/crawlab-team/crawlab-core v0.6.0-beta.20211213.2006 - github.com/crawlab-team/go-trace v0.1.0 + github.com/crawlab-team/crawlab-core v0.6.0-beta.20211219.2134 + github.com/crawlab-team/go-trace v0.1.1 github.com/gin-gonic/gin v1.7.1 github.com/spf13/cobra v1.1.3 github.com/spf13/viper v1.7.1 - go.mongodb.org/mongo-driver v1.6.0 // indirect go.uber.org/dig v1.10.0 ) diff --git a/backend/test/config-worker-03.json b/backend/test/config-worker-03.json new file mode 100644 index 00000000..70da53f1 --- /dev/null +++ b/backend/test/config-worker-03.json @@ -0,0 +1,10 @@ +{ + "key": "worker-03", + "is_master": false, + "name": "Worker Node 03", + "ip": "", + "mac": "", + "hostname": "", + "description": "", + "auth_key": "Crawlab2021!" +} \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index a41ba197..1f460a36 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@crawlab/app", - "version": "0.6.0-beta.20211221.1200", + "version": "0.6.0-beta.20211224.1500", "description": "", "scripts": { "serve": "vue-cli-service serve", @@ -15,7 +15,7 @@ }, "license": "BSD-3-Clause", "dependencies": { - "crawlab-ui": "0.6.0-beta.20211219.1200", + "crawlab-ui": "0.6.0-beta.20211224.1500", "vue": "3.0.11", "vue-router": "^4.0.11" }, diff --git a/frontend/public/index.html b/frontend/public/index.html index e307c2bc..113fdc38 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -1,12 +1,12 @@ + <%= htmlWebpackPlugin.options.title %> + + - - - <%= htmlWebpackPlugin.options.title %> diff --git a/workspace/docker-compose.yml b/workspace/docker-compose.yml index b20f9cab..52d35ce3 100644 --- a/workspace/docker-compose.yml +++ b/workspace/docker-compose.yml @@ -1,10 +1,24 @@ version: '3.3' services: + build: + build: + context: ./dockerfiles/golang + command: /bin/bash -c "rm -f /backend/dist/crawlab && go build -o ./dist/crawlab ./" + volumes: + - ./dist:/backend/dist + - ./.crawlab/go/pkg/mod:/go/pkg/mod + - ../backend:/backend + - ../backend/go.mod.local:/backend/go.mod + - ../..:/libs/crawlab-team + environment: + GOPROXY: https://goproxy.cn,direct + master: build: context: ./dockerfiles/golang - command: /bin/bash -c "/app/bin/docker-start-master.sh && air -c .air.master.conf" + command: /bin/bash -c "/app/bin/docker-start-master.sh && /dist/crawlab master" volumes: + - ./dist:/dist - ./.crawlab/master:/root/.crawlab - ./.crawlab/go/pkg/mod:/go/pkg/mod - ../backend:/backend @@ -17,22 +31,29 @@ services: CRAWLAB_NODE_MASTER: "Y" CRAWLAB_NODE_NAME: "Master Node" CRAWLAB_MONGO_HOST: "mongo" + CRAWLAB_LOG_LEVEL: debug + GOPROXY: https://goproxy.cn,direct ports: - "9080:8080" - "9000:8000" + - "9866:9666" + - "9888:8888" depends_on: - mongo worker01: build: context: ./dockerfiles/golang - command: "air -c .air.worker.conf" + command: /bin/bash -c "/dist/crawlab worker" environment: CRAWLAB_NODE_MASTER: "N" CRAWLAB_NODE_NAME: "Worker Node 01" CRAWLAB_GRPC_ADDRESS: "master" CRAWLAB_FS_FILER_URL: "http://master:8080/api/filer" + CRAWLAB_LOG_LEVEL: debug + GOPROXY: https://goproxy.cn,direct volumes: + - ./dist:/dist - ./.crawlab/worker01:/root/.crawlab - ./.crawlab/go/pkg/mod:/go/pkg/mod - ../backend:/backend @@ -44,13 +65,16 @@ services: worker02: build: context: ./dockerfiles/golang - command: "air -c .air.worker.conf" + command: /bin/bash -c "/dist/crawlab worker" environment: CRAWLAB_NODE_MASTER: "N" - CRAWLAB_NODE_NAME: "Worker Node 01" + CRAWLAB_NODE_NAME: "Worker Node 02" CRAWLAB_GRPC_ADDRESS: "master" CRAWLAB_FS_FILER_URL: "http://master:8080/api/filer" + CRAWLAB_LOG_LEVEL: debug + GOPROXY: https://goproxy.cn,direct volumes: + - ./dist:/dist - ./.crawlab/worker02:/root/.crawlab - ./.crawlab/go/pkg/mod:/go/pkg/mod - ../backend:/backend @@ -58,6 +82,7 @@ services: - ../..:/libs/crawlab-team depends_on: - master + - worker01 mongo: image: mongo:4