From f18b6b57e8938c8588b2688d8a38dcf18bb17ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= Date: Mon, 3 Jan 2022 19:27:29 +0800 Subject: [PATCH 1/3] 1. fix repeat init api module 2. add custom config file flag --- backend/apps/api.go | 2 +- backend/cmd/root.go | 1 + backend/go.mod | 21 +++++++++++++-------- backend/go.mod.local | 20 -------------------- backend/go.mod.remote | 13 +++++++++++++ 5 files changed, 28 insertions(+), 29 deletions(-) delete mode 100644 backend/go.mod.local create mode 100644 backend/go.mod.remote diff --git a/backend/apps/api.go b/backend/apps/api.go index 43a34bc8..ee3bed74 100644 --- a/backend/apps/api.go +++ b/backend/apps/api.go @@ -74,6 +74,6 @@ func NewApi() *Api { api := &Api{ app: gin.New(), } - api.Init() + // api.Init() return api } diff --git a/backend/cmd/root.go b/backend/cmd/root.go index 9d0ef3eb..51f9da38 100644 --- a/backend/cmd/root.go +++ b/backend/cmd/root.go @@ -30,6 +30,7 @@ func Execute() error { func init() { cobra.OnInitialize(initConfig) + rootCmd.PersistentFlags().StringVar(&cfgFile, "c", "", "Use Custom Config File") } func initConfig() { diff --git a/backend/go.mod b/backend/go.mod index 9e98b8e9..4c7116d4 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -2,12 +2,17 @@ module crawlab go 1.16 -require ( - github.com/apex/log v1.9.0 - github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 - 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.uber.org/dig v1.10.0 +replace ( + github.com/crawlab-team/crawlab-core => /Users/chenjingyang/dev/my-job/gitee/crawlab-core + github.com/crawlab-team/goseaweedfs => /Users/chenjingyang/dev/my-job/gitee/goseaweedfs +) + +require ( + github.com/apex/log v1.9.0 + github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 + 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.uber.org/dig v1.10.0 ) diff --git a/backend/go.mod.local b/backend/go.mod.local deleted file mode 100644 index 41c13932..00000000 --- a/backend/go.mod.local +++ /dev/null @@ -1,20 +0,0 @@ -module crawlab - -go 1.16 - -replace ( - github.com/crawlab-team/crawlab-core => /libs/crawlab-team/crawlab-core - github.com/crawlab-team/crawlab-vcs => /libs/crawlab-team/crawlab-vcs - github.com/crawlab-team/crawlab-fs => /libs/crawlab-team/crawlab-fs - github.com/crawlab-team/crawlab-db => /libs/crawlab-team/crawlab-db -) - -require ( - github.com/apex/log v1.9.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.uber.org/dig v1.10.0 -) diff --git a/backend/go.mod.remote b/backend/go.mod.remote new file mode 100644 index 00000000..9e98b8e9 --- /dev/null +++ b/backend/go.mod.remote @@ -0,0 +1,13 @@ +module crawlab + +go 1.16 + +require ( + github.com/apex/log v1.9.0 + github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 + 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.uber.org/dig v1.10.0 +) From 2e57571b5da58587e5f54bdaa03b8b8dd280778f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= Date: Mon, 3 Jan 2022 19:29:40 +0800 Subject: [PATCH 2/3] fix go.mod --- backend/go.mod | 19 +++++++------------ backend/go.mod.local | 18 ++++++++++++++++++ backend/go.mod.remote | 13 ------------- docker-compose.yml | 16 ++++++++-------- 4 files changed, 33 insertions(+), 33 deletions(-) create mode 100644 backend/go.mod.local delete mode 100644 backend/go.mod.remote diff --git a/backend/go.mod b/backend/go.mod index 4c7116d4..9e98b8e9 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -2,17 +2,12 @@ module crawlab go 1.16 -replace ( - github.com/crawlab-team/crawlab-core => /Users/chenjingyang/dev/my-job/gitee/crawlab-core - github.com/crawlab-team/goseaweedfs => /Users/chenjingyang/dev/my-job/gitee/goseaweedfs -) - require ( - github.com/apex/log v1.9.0 - github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 - 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.uber.org/dig v1.10.0 + github.com/apex/log v1.9.0 + github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 + 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.uber.org/dig v1.10.0 ) diff --git a/backend/go.mod.local b/backend/go.mod.local new file mode 100644 index 00000000..4c7116d4 --- /dev/null +++ b/backend/go.mod.local @@ -0,0 +1,18 @@ +module crawlab + +go 1.16 + +replace ( + github.com/crawlab-team/crawlab-core => /Users/chenjingyang/dev/my-job/gitee/crawlab-core + github.com/crawlab-team/goseaweedfs => /Users/chenjingyang/dev/my-job/gitee/goseaweedfs +) + +require ( + github.com/apex/log v1.9.0 + github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 + 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.uber.org/dig v1.10.0 +) diff --git a/backend/go.mod.remote b/backend/go.mod.remote deleted file mode 100644 index 9e98b8e9..00000000 --- a/backend/go.mod.remote +++ /dev/null @@ -1,13 +0,0 @@ -module crawlab - -go 1.16 - -require ( - github.com/apex/log v1.9.0 - github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 - 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.uber.org/dig v1.10.0 -) diff --git a/docker-compose.yml b/docker-compose.yml index 8ef8b450..7454342a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,15 +12,15 @@ services: - mongo # volumes: # - "/var/crawlab/log:/var/logs/crawlab" # log persistent 日志持久化 - #worker: - # image: tikazyq/crawlab:latest - # container_name: worker - # environment: - # CRAWLAB_SERVER_MASTER: "N" - # CRAWLAB_MONGO_HOST: "mongo" + worker: + image: crawlabteam/crawlab:latest + container_name: worker + environment: + CRAWLAB_SERVER_MASTER: "N" + CRAWLAB_MONGO_HOST: "mongo" # CRAWLAB_REDIS_ADDRESS: "redis" - # depends_on: - # - mongo + depends_on: + - mongo # volumes: # - "/var/crawlab/log:/var/logs/crawlab" # log persistent 日志持久化 mongo: From 3382438d2380a69634985b15a68aab87f17d8849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= Date: Mon, 3 Jan 2022 23:13:26 +0800 Subject: [PATCH 3/3] fix rollback NewApi init method --- backend/apps/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/apps/api.go b/backend/apps/api.go index ee3bed74..43a34bc8 100644 --- a/backend/apps/api.go +++ b/backend/apps/api.go @@ -74,6 +74,6 @@ func NewApi() *Api { api := &Api{ app: gin.New(), } - // api.Init() + api.Init() return api }