updated version

This commit is contained in:
Marvin Zhang
2021-12-24 15:07:04 +08:00
parent 2493a8ec97
commit de7c334167
7 changed files with 61 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/apex/log"
"strings" "strings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@@ -54,4 +55,17 @@ func initConfig() {
if err := viper.ReadInConfig(); err == nil { if err := viper.ReadInConfig(); err == nil {
fmt.Println("Using config file:", viper.ConfigFileUsed()) 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)
} }

View File

@@ -4,7 +4,7 @@ go 1.16
require ( require (
github.com/apex/log v1.9.0 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/crawlab-team/go-trace v0.1.1
github.com/gin-gonic/gin v1.7.1 github.com/gin-gonic/gin v1.7.1
github.com/spf13/cobra v1.1.3 github.com/spf13/cobra v1.1.3

View File

@@ -11,11 +11,10 @@ replace (
require ( require (
github.com/apex/log v1.9.0 github.com/apex/log v1.9.0
github.com/crawlab-team/crawlab-core v0.6.0-beta.20211213.2006 github.com/crawlab-team/crawlab-core v0.6.0-beta.20211219.2134
github.com/crawlab-team/go-trace v0.1.0 github.com/crawlab-team/go-trace v0.1.1
github.com/gin-gonic/gin v1.7.1 github.com/gin-gonic/gin v1.7.1
github.com/spf13/cobra v1.1.3 github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1 github.com/spf13/viper v1.7.1
go.mongodb.org/mongo-driver v1.6.0 // indirect
go.uber.org/dig v1.10.0 go.uber.org/dig v1.10.0
) )

View File

@@ -0,0 +1,10 @@
{
"key": "worker-03",
"is_master": false,
"name": "Worker Node 03",
"ip": "",
"mac": "",
"hostname": "",
"description": "",
"auth_key": "Crawlab2021!"
}

View File

@@ -1,6 +1,6 @@
{ {
"name": "@crawlab/app", "name": "@crawlab/app",
"version": "0.6.0-beta.20211221.1200", "version": "0.6.0-beta.20211224.1500",
"description": "", "description": "",
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
@@ -15,7 +15,7 @@
}, },
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"dependencies": { "dependencies": {
"crawlab-ui": "0.6.0-beta.20211219.1200", "crawlab-ui": "0.6.0-beta.20211224.1500",
"vue": "3.0.11", "vue": "3.0.11",
"vue-router": "^4.0.11" "vue-router": "^4.0.11"
}, },

View File

@@ -1,12 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title><%= htmlWebpackPlugin.options.title %></title>
<link rel="icon" type="image/x-icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="font-awesome.min.css">
<meta charset="utf-8"> <meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible"> <meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width,initial-scale=1.0" name="viewport"> <meta content="width=device-width,initial-scale=1.0" name="viewport">
<link href="<%= BASE_URL %>favicon.ico" rel="icon">
<link href="font-awesome.min.css" rel="stylesheet">
<title><%= htmlWebpackPlugin.options.title %></title>
<script> <script>
window.VUE_APP_API_BASE_URL = '<%= VUE_APP_API_BASE_URL %>' window.VUE_APP_API_BASE_URL = '<%= VUE_APP_API_BASE_URL %>'
</script> </script>

View File

@@ -1,10 +1,24 @@
version: '3.3' version: '3.3'
services: 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: master:
build: build:
context: ./dockerfiles/golang 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: volumes:
- ./dist:/dist
- ./.crawlab/master:/root/.crawlab - ./.crawlab/master:/root/.crawlab
- ./.crawlab/go/pkg/mod:/go/pkg/mod - ./.crawlab/go/pkg/mod:/go/pkg/mod
- ../backend:/backend - ../backend:/backend
@@ -17,22 +31,29 @@ services:
CRAWLAB_NODE_MASTER: "Y" CRAWLAB_NODE_MASTER: "Y"
CRAWLAB_NODE_NAME: "Master Node" CRAWLAB_NODE_NAME: "Master Node"
CRAWLAB_MONGO_HOST: "mongo" CRAWLAB_MONGO_HOST: "mongo"
CRAWLAB_LOG_LEVEL: debug
GOPROXY: https://goproxy.cn,direct
ports: ports:
- "9080:8080" - "9080:8080"
- "9000:8000" - "9000:8000"
- "9866:9666"
- "9888:8888"
depends_on: depends_on:
- mongo - mongo
worker01: worker01:
build: build:
context: ./dockerfiles/golang context: ./dockerfiles/golang
command: "air -c .air.worker.conf" command: /bin/bash -c "/dist/crawlab worker"
environment: environment:
CRAWLAB_NODE_MASTER: "N" CRAWLAB_NODE_MASTER: "N"
CRAWLAB_NODE_NAME: "Worker Node 01" CRAWLAB_NODE_NAME: "Worker Node 01"
CRAWLAB_GRPC_ADDRESS: "master" CRAWLAB_GRPC_ADDRESS: "master"
CRAWLAB_FS_FILER_URL: "http://master:8080/api/filer" CRAWLAB_FS_FILER_URL: "http://master:8080/api/filer"
CRAWLAB_LOG_LEVEL: debug
GOPROXY: https://goproxy.cn,direct
volumes: volumes:
- ./dist:/dist
- ./.crawlab/worker01:/root/.crawlab - ./.crawlab/worker01:/root/.crawlab
- ./.crawlab/go/pkg/mod:/go/pkg/mod - ./.crawlab/go/pkg/mod:/go/pkg/mod
- ../backend:/backend - ../backend:/backend
@@ -44,13 +65,16 @@ services:
worker02: worker02:
build: build:
context: ./dockerfiles/golang context: ./dockerfiles/golang
command: "air -c .air.worker.conf" command: /bin/bash -c "/dist/crawlab worker"
environment: environment:
CRAWLAB_NODE_MASTER: "N" CRAWLAB_NODE_MASTER: "N"
CRAWLAB_NODE_NAME: "Worker Node 01" CRAWLAB_NODE_NAME: "Worker Node 02"
CRAWLAB_GRPC_ADDRESS: "master" CRAWLAB_GRPC_ADDRESS: "master"
CRAWLAB_FS_FILER_URL: "http://master:8080/api/filer" CRAWLAB_FS_FILER_URL: "http://master:8080/api/filer"
CRAWLAB_LOG_LEVEL: debug
GOPROXY: https://goproxy.cn,direct
volumes: volumes:
- ./dist:/dist
- ./.crawlab/worker02:/root/.crawlab - ./.crawlab/worker02:/root/.crawlab
- ./.crawlab/go/pkg/mod:/go/pkg/mod - ./.crawlab/go/pkg/mod:/go/pkg/mod
- ../backend:/backend - ../backend:/backend
@@ -58,6 +82,7 @@ services:
- ../..:/libs/crawlab-team - ../..:/libs/crawlab-team
depends_on: depends_on:
- master - master
- worker01
mongo: mongo:
image: mongo:4 image: mongo:4