diff --git a/Makefile b/Makefile index c210edbe3..ceffba205 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ include scripts/make-rules/gen.mk include scripts/make-rules/dependencies.mk include scripts/make-rules/tools.mk include scripts/make-rules/release.mk +include scripts/make-rules/swagger.mk # ============================================================================== # Usage @@ -148,6 +149,16 @@ tools: gen: @$(MAKE) gen.run +## swagger: Generate swagger document. +.PHONY: swagger +swagger: + @$(MAKE) swagger.run + +## serve-swagger: Serve swagger spec and docs. +.PHONY: swagger.serve +serve-swagger: + @$(MAKE) swagger.serve + ## verify-copyright: Verify the license headers for all files. .PHONY: verify-copyright verify-copyright: diff --git a/README.md b/README.md index 8f2713ccb..d3d880d41 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ By deployment of the Open-IM-Server on the customer's server, developers can int ./docker_check_service.sh./check_all.sh ``` - ![OpenIMServersonSystempng](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Open-IM-Servers-on-System.png) + ![OpenIMServersonSystempng](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/Open-IM-Servers-on-System.png) #### Deploy using source code @@ -157,11 +157,11 @@ all services build success ## Authentication Clow Chart -![avatar](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/open-im-server.png) +![avatar](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/open-im-server.png) ## Architecture -![avatar](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/Architecture.jpg) +![avatar](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/images/Architecture.jpg) ## To start developing OpenIM The [community repository](https://github.com/OpenIMSDK/community) hosts all information about building Kubernetes from source, how to contribute code and documentation, who to contact about what, etc. diff --git a/docs/Architecture.jpg b/docs/images/Architecture.jpg similarity index 100% rename from docs/Architecture.jpg rename to docs/images/Architecture.jpg diff --git a/docs/Open-IM-Servers-on-System.png b/docs/images/Open-IM-Servers-on-System.png similarity index 100% rename from docs/Open-IM-Servers-on-System.png rename to docs/images/Open-IM-Servers-on-System.png diff --git a/docs/Open-IM-Servers-on-docker.png b/docs/images/Open-IM-Servers-on-docker.png similarity index 100% rename from docs/Open-IM-Servers-on-docker.png rename to docs/images/Open-IM-Servers-on-docker.png diff --git a/docs/Open-IM.png b/docs/images/Open-IM.png similarity index 100% rename from docs/Open-IM.png rename to docs/images/Open-IM.png diff --git a/docs/Wechat.jpg b/docs/images/Wechat.jpg similarity index 100% rename from docs/Wechat.jpg rename to docs/images/Wechat.jpg diff --git a/docs/open-im-logo.png b/docs/images/open-im-logo.png similarity index 100% rename from docs/open-im-logo.png rename to docs/images/open-im-logo.png diff --git a/docs/open-im-server.png b/docs/images/open-im-server.png similarity index 100% rename from docs/open-im-server.png rename to docs/images/open-im-server.png diff --git a/scripts/make-rules/golang.mk b/scripts/make-rules/golang.mk index 81ff49f14..de1e6b74e 100644 --- a/scripts/make-rules/golang.mk +++ b/scripts/make-rules/golang.mk @@ -141,6 +141,7 @@ go.test: ## go.test.junit-report: Run unit test .PHONY: go.test.junit-report go.test.junit-report: tools.verify.go-junit-report + @touch $(TMP_DIR)/coverage.out @echo "===========> Run unit test > $(TMP_DIR)/report.xml" # @$(GO) test -v -coverprofile=$(TMP_DIR)/coverage.out 2>&1 $(GO_BUILD_FLAGS) ./... | $(TOOLS_DIR)/go-junit-report -set-exit-code > $(TMP_DIR)/report.xml @$(GO) test -v -coverprofile=$(TMP_DIR)/coverage.out 2>&1 ./... | $(TOOLS_DIR)/go-junit-report -set-exit-code > $(TMP_DIR)/report.xml @@ -151,7 +152,6 @@ go.test.junit-report: tools.verify.go-junit-report ## go.test.cover: Run unit test with coverage .PHONY: go.test.cover go.test.cover: go.test.junit-report - @touch $(TMP_DIR)/coverage.out @$(GO) tool cover -func=$(TMP_DIR)/coverage.out | \ awk -v target=$(COVERAGE) -f $(ROOT_DIR)/scripts/coverage.awk diff --git a/scripts/make-rules/swagger.mk b/scripts/make-rules/swagger.mk index 0598813c3..991de43c6 100644 --- a/scripts/make-rules/swagger.mk +++ b/scripts/make-rules/swagger.mk @@ -2,11 +2,18 @@ # Makefile helper functions for swagger # +## swagger.run: Generate swagger document. .PHONY: swagger.run swagger.run: tools.verify.swagger @echo "===========> Generating swagger API docs" - @swagger generate spec --scan-models -w $(ROOT_DIR)/cmd/genswaggertypedocs -o $(ROOT_DIR)/api/swagger/swagger.yaml + @$(TOOLS_DIR)/swagger generate spec --scan-models -w $(ROOT_DIR)/cmd/genswaggertypedocs -o $(ROOT_DIR)/api/swagger/swagger.yaml +## swagger.serve: Serve swagger spec and docs. .PHONY: swagger.serve swagger.serve: tools.verify.swagger - @swagger serve -F=redoc --no-open --port 36666 $(ROOT_DIR)/api/swagger/swagger.yaml + @$(TOOLS_DIR)/swagger serve -F=redoc --no-open --port 36666 $(ROOT_DIR)/api/swagger/swagger.yaml + +## swagger.help: Display help information about the release package +.PHONY: swagger.help +swagger.help: scripts/make-rules/swagger.mk + $(call smallhelp) \ No newline at end of file diff --git a/scripts/make-rules/tools.mk b/scripts/make-rules/tools.mk index 468cf109f..e268cb264 100644 --- a/scripts/make-rules/tools.mk +++ b/scripts/make-rules/tools.mk @@ -101,6 +101,11 @@ install.go-gitlint: install.go-junit-report: @$(GO) install github.com/jstemmer/go-junit-report@latest +## install.gotests: Install gotests, used to generate go tests +.PHONY: install.swagger +install.swagger: + @$(GO) install github.com/go-swagger/go-swagger/cmd/swagger@latest + # ============================================================================== # Tools that might be used include go gvm # diff --git a/scripts/start_all.sh b/scripts/start_all.sh index eba94c4b7..1a86db7f3 100755 --- a/scripts/start_all.sh +++ b/scripts/start_all.sh @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -#fixme This scripts is the total startup scripts -#fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array +#FIXME This script is the startup script for multiple servers. +#FIXME The full names of the shell scripts that need to be started are placed in the `need_to_start_server_shell` array. -#fixme Put the shell scripts name here +#FIXME Put the shell script names here need_to_start_server_shell=( start_rpc_service.sh push_start.sh @@ -25,20 +25,21 @@ need_to_start_server_shell=( msg_gateway_start.sh start_cron.sh ) + time=`date +"%Y-%m-%d %H:%M:%S"` -echo "==========================================================">>../logs/openIM.log 2>&1 & -echo "==========================================================">>../logs/openIM.log 2>&1 & -echo "==========================================================">>../logs/openIM.log 2>&1 & -echo "==========server start time:${time}===========">>../logs/openIM.log 2>&1 & -echo "==========================================================">>../logs/openIM.log 2>&1 & -echo "==========================================================">>../logs/openIM.log 2>&1 & -echo "==========================================================">>../logs/openIM.log 2>&1 & +echo "==========================================================" >> ../logs/openIM.log 2>&1 & +echo "==========================================================" >> ../logs/openIM.log 2>&1 & +echo "==========================================================" >> ../logs/openIM.log 2>&1 & +echo "==========server start time:${time}===========" >> ../logs/openIM.log 2>&1 & +echo "==========================================================" >> ../logs/openIM.log 2>&1 & +echo "==========================================================" >> ../logs/openIM.log 2>&1 & +echo "==========================================================" >> ../logs/openIM.log 2>&1 & for i in ${need_to_start_server_shell[*]}; do chmod +x $i - echo "=====================exec ${i}======================">>../logs/openIM.log + echo "=====================exec ${i}======================" >> ../logs/openIM.log ./$i - if [ $? -ne 0 ]; then - exit -1 + if [ $? -ne 0 ]; then + exit -1 fi done