From 79cb0621d9c41d2522b6b33593c89de6d0869a90 Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751@qq.com> Date: Sat, 16 Dec 2023 16:37:12 +0800 Subject: [PATCH 1/4] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index e7af04f2..f7d2448b 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -50,6 +50,7 @@ jobs: type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} + type=semver,pattern=v{{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha @@ -85,6 +86,15 @@ jobs: uses: docker/metadata-action@v4.6.0 with: images: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern=v{{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha - name: Log in to AliYun Docker Hub uses: docker/login-action@v2 @@ -118,6 +128,15 @@ jobs: uses: docker/metadata-action@v4.6.0 with: images: ghcr.io/openimsdk/openim-chat + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern=v{{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha - name: Log in to GitHub Container Registry uses: docker/login-action@v2 From 22e06827a3a812378bd9c383fa166c98551e1476 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong (cubxxw)" <3293172751nss@gmail.com> Date: Sat, 16 Dec 2023 17:34:39 +0800 Subject: [PATCH 2/4] fix: scripts config Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --- .dockerignore | 1 - .github/workflows/scripts-test.yml | 2 +- Dockerfile | 1 + Makefile | 16 ++- README.md | 2 +- config/Readme.md | 17 +++ .../helm-charts/.helmignore | 0 .../helm-charts/Chart.yaml | 0 .../helm-charts/charts/admin-rpc/.helmignore | 0 .../helm-charts/charts/admin-rpc/Chart.yaml | 0 .../charts/admin-rpc/templates/NOTES.txt | 0 .../charts/admin-rpc/templates/_helpers.tpl | 0 .../admin-rpc/templates/deployment.yaml | 0 .../charts/admin-rpc/templates/hpa.yaml | 0 .../charts/admin-rpc/templates/ingress.yaml | 0 .../charts/admin-rpc/templates/service.yaml | 0 .../admin-rpc/templates/serviceaccount.yaml | 0 .../helm-charts/charts/admin-rpc/values.yaml | 0 .../helm-charts/charts/chat-api/.helmignore | 0 .../helm-charts/charts/chat-api/Chart.yaml | 0 .../charts/chat-api/templates/NOTES.txt | 0 .../charts/chat-api/templates/_helpers.tpl | 0 .../charts/chat-api/templates/deployment.yaml | 0 .../charts/chat-api/templates/hpa.yaml | 0 .../charts/chat-api/templates/ingress.yaml | 0 .../charts/chat-api/templates/service.yaml | 0 .../chat-api/templates/serviceaccount.yaml | 0 .../helm-charts/charts/chat-api/values.yaml | 0 .../helm-charts/charts/chat-rpc/.helmignore | 0 .../helm-charts/charts/chat-rpc/Chart.yaml | 0 .../charts/chat-rpc/templates/NOTES.txt | 0 .../charts/chat-rpc/templates/_helpers.tpl | 0 .../charts/chat-rpc/templates/deployment.yaml | 0 .../charts/chat-rpc/templates/hpa.yaml | 0 .../charts/chat-rpc/templates/ingress.yaml | 0 .../charts/chat-rpc/templates/service.yaml | 0 .../chat-rpc/templates/serviceaccount.yaml | 0 .../helm-charts/charts/chat-rpc/values.yaml | 0 .../helm-charts/config.yaml | 0 .../helm-charts/templates/NOTES.txt | 0 .../helm-charts/templates/_helpers.tpl | 0 .../helm-charts/templates/app-cm.yaml | 0 .../helm-charts/templates/deployment.yaml | 0 .../helm-charts/templates/hpa.yaml | 0 .../helm-charts/templates/ingress.yaml | 0 .../helm-charts/templates/service.yaml | 0 .../helm-charts/templates/serviceaccount.yaml | 0 .../helm-charts/values.yaml | 0 .../templates/config.yaml | 0 scripts/docker_start_all.sh | 2 +- scripts/gen.mk | 105 ++++++++++++++++++ scripts/githooks/commit-msg | 2 +- scripts/githooks/pre-commit | 4 +- scripts/githooks/pre-push | 2 +- scripts/init-config.sh | 26 +++++ scripts/init-githooks.sh | 100 +++++++++++++++++ 56 files changed, 268 insertions(+), 12 deletions(-) create mode 100644 config/Readme.md rename {deployment => deployments}/helm-charts/.helmignore (100%) rename {deployment => deployments}/helm-charts/Chart.yaml (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/.helmignore (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/Chart.yaml (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/templates/NOTES.txt (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/templates/_helpers.tpl (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/templates/deployment.yaml (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/templates/hpa.yaml (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/templates/ingress.yaml (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/templates/service.yaml (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml (100%) rename {deployment => deployments}/helm-charts/charts/admin-rpc/values.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/.helmignore (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/Chart.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/templates/NOTES.txt (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/templates/_helpers.tpl (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/templates/deployment.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/templates/hpa.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/templates/ingress.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/templates/service.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/templates/serviceaccount.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-api/values.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/.helmignore (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/Chart.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/templates/NOTES.txt (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/templates/_helpers.tpl (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/templates/deployment.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/templates/hpa.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/templates/ingress.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/templates/service.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml (100%) rename {deployment => deployments}/helm-charts/charts/chat-rpc/values.yaml (100%) rename {deployment => deployments}/helm-charts/config.yaml (100%) rename {deployment => deployments}/helm-charts/templates/NOTES.txt (100%) rename {deployment => deployments}/helm-charts/templates/_helpers.tpl (100%) rename {deployment => deployments}/helm-charts/templates/app-cm.yaml (100%) rename {deployment => deployments}/helm-charts/templates/deployment.yaml (100%) rename {deployment => deployments}/helm-charts/templates/hpa.yaml (100%) rename {deployment => deployments}/helm-charts/templates/ingress.yaml (100%) rename {deployment => deployments}/helm-charts/templates/service.yaml (100%) rename {deployment => deployments}/helm-charts/templates/serviceaccount.yaml (100%) rename {deployment => deployments}/helm-charts/values.yaml (100%) rename config/config.yaml.template => deployments/templates/config.yaml (100%) create mode 100644 scripts/gen.mk create mode 100755 scripts/init-config.sh create mode 100755 scripts/init-githooks.sh diff --git a/.dockerignore b/.dockerignore index 9faeff61..a118b899 100644 --- a/.dockerignore +++ b/.dockerignore @@ -19,7 +19,6 @@ CHANGELOG/ # Ignore deployment-related files docker-compose.yaml -deployments/ # Ignore assets assets/ diff --git a/.github/workflows/scripts-test.yml b/.github/workflows/scripts-test.yml index a633899a..51bd3a65 100644 --- a/.github/workflows/scripts-test.yml +++ b/.github/workflows/scripts-test.yml @@ -79,7 +79,7 @@ jobs: sleep 30; - name: start all services run: | - sudo cp ./config/config.yaml.template ./config/config.yaml + sudo cp ./deployments/templates/config.yaml ./config/config.yaml sudo make start shell: bash diff --git a/Dockerfile b/Dockerfile index 325e5c69..c72ad92f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,5 +43,6 @@ WORKDIR ${CHAT_WORKDIR} COPY --from=builder ${OPENIM_CHAT_BINDIR} /openim/openim-chat/_output/bin COPY --from=builder ${CHAT_WORKDIR}/config /openim/openim-chat/config COPY --from=builder ${CHAT_WORKDIR}/scripts /openim/openim-chat/scripts +COPY --from=builder ${SERVER_WORKDIR}/deployments /openim/openim-server/deployments CMD ["/openim/openim-chat/scripts/docker_start_all.sh"] \ No newline at end of file diff --git a/Makefile b/Makefile index 546c859c..90c61e62 100644 --- a/Makefile +++ b/Makefile @@ -93,10 +93,6 @@ else IMAGE_PLAT := $(PLATFORM) endif -# Copy githook scripts when execute makefile -# TODO! GIT_FILE_SIZE_LIMIT=42000000 git commit -m "This commit is allowed file sizes up to 42MB" -COPY_GITHOOK:=$(shell cp -f scripts/githooks/* .git/hooks/; chmod +x .git/hooks/*) - # Linux command settings FIND := find . ! -path './image/*' ! -path './vendor/*' ! -path './bin/*' XARGS := xargs -r @@ -193,6 +189,18 @@ endif .PHONY: all all: copyright-verify tidy build start check #lint cover +## init: Init openim-chat config +.PHONY: init +init: + @echo "===========> Init openim-chat config" + @$(ROOT_DIR)/scripts/init-config.sh + +## init-githooks: Initialize git hooks ✨ +.PHONY: init-githooks +init-githooks: + @echo "===========> Initializing git hooks" + @${ROOT_DIR}/scripts/init-githooks.sh + ## build: Build binaries by default. .PHONY: build build: go.build.verify $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS))) diff --git a/README.md b/README.md index cd49d794..f14cdb6d 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ sudo docker compose up -d **Setting configuration items:** ```bash -cp ./config/config.yaml.template ./config/config.yaml +cp ./deployments/templates/config.yaml ./config/config.yaml ``` > Then modify the configuration file `config/config.yaml` according to your needs diff --git a/config/Readme.md b/config/Readme.md new file mode 100644 index 00000000..1ee45038 --- /dev/null +++ b/config/Readme.md @@ -0,0 +1,17 @@ +# Configuration file + +The configuration file is automatically generated through make init or scripts/init-config.sh. + +Add the configuration file to the policy that adds version management + + +```bash +make init +``` + + +## Fix config/config.yaml + +```bash +vim config/config.yaml +``` diff --git a/deployment/helm-charts/.helmignore b/deployments/helm-charts/.helmignore similarity index 100% rename from deployment/helm-charts/.helmignore rename to deployments/helm-charts/.helmignore diff --git a/deployment/helm-charts/Chart.yaml b/deployments/helm-charts/Chart.yaml similarity index 100% rename from deployment/helm-charts/Chart.yaml rename to deployments/helm-charts/Chart.yaml diff --git a/deployment/helm-charts/charts/admin-rpc/.helmignore b/deployments/helm-charts/charts/admin-rpc/.helmignore similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/.helmignore rename to deployments/helm-charts/charts/admin-rpc/.helmignore diff --git a/deployment/helm-charts/charts/admin-rpc/Chart.yaml b/deployments/helm-charts/charts/admin-rpc/Chart.yaml similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/Chart.yaml rename to deployments/helm-charts/charts/admin-rpc/Chart.yaml diff --git a/deployment/helm-charts/charts/admin-rpc/templates/NOTES.txt b/deployments/helm-charts/charts/admin-rpc/templates/NOTES.txt similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/templates/NOTES.txt rename to deployments/helm-charts/charts/admin-rpc/templates/NOTES.txt diff --git a/deployment/helm-charts/charts/admin-rpc/templates/_helpers.tpl b/deployments/helm-charts/charts/admin-rpc/templates/_helpers.tpl similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/templates/_helpers.tpl rename to deployments/helm-charts/charts/admin-rpc/templates/_helpers.tpl diff --git a/deployment/helm-charts/charts/admin-rpc/templates/deployment.yaml b/deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/templates/deployment.yaml rename to deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml diff --git a/deployment/helm-charts/charts/admin-rpc/templates/hpa.yaml b/deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/templates/hpa.yaml rename to deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml diff --git a/deployment/helm-charts/charts/admin-rpc/templates/ingress.yaml b/deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/templates/ingress.yaml rename to deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml diff --git a/deployment/helm-charts/charts/admin-rpc/templates/service.yaml b/deployments/helm-charts/charts/admin-rpc/templates/service.yaml similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/templates/service.yaml rename to deployments/helm-charts/charts/admin-rpc/templates/service.yaml diff --git a/deployment/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml b/deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml rename to deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml diff --git a/deployment/helm-charts/charts/admin-rpc/values.yaml b/deployments/helm-charts/charts/admin-rpc/values.yaml similarity index 100% rename from deployment/helm-charts/charts/admin-rpc/values.yaml rename to deployments/helm-charts/charts/admin-rpc/values.yaml diff --git a/deployment/helm-charts/charts/chat-api/.helmignore b/deployments/helm-charts/charts/chat-api/.helmignore similarity index 100% rename from deployment/helm-charts/charts/chat-api/.helmignore rename to deployments/helm-charts/charts/chat-api/.helmignore diff --git a/deployment/helm-charts/charts/chat-api/Chart.yaml b/deployments/helm-charts/charts/chat-api/Chart.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-api/Chart.yaml rename to deployments/helm-charts/charts/chat-api/Chart.yaml diff --git a/deployment/helm-charts/charts/chat-api/templates/NOTES.txt b/deployments/helm-charts/charts/chat-api/templates/NOTES.txt similarity index 100% rename from deployment/helm-charts/charts/chat-api/templates/NOTES.txt rename to deployments/helm-charts/charts/chat-api/templates/NOTES.txt diff --git a/deployment/helm-charts/charts/chat-api/templates/_helpers.tpl b/deployments/helm-charts/charts/chat-api/templates/_helpers.tpl similarity index 100% rename from deployment/helm-charts/charts/chat-api/templates/_helpers.tpl rename to deployments/helm-charts/charts/chat-api/templates/_helpers.tpl diff --git a/deployment/helm-charts/charts/chat-api/templates/deployment.yaml b/deployments/helm-charts/charts/chat-api/templates/deployment.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-api/templates/deployment.yaml rename to deployments/helm-charts/charts/chat-api/templates/deployment.yaml diff --git a/deployment/helm-charts/charts/chat-api/templates/hpa.yaml b/deployments/helm-charts/charts/chat-api/templates/hpa.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-api/templates/hpa.yaml rename to deployments/helm-charts/charts/chat-api/templates/hpa.yaml diff --git a/deployment/helm-charts/charts/chat-api/templates/ingress.yaml b/deployments/helm-charts/charts/chat-api/templates/ingress.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-api/templates/ingress.yaml rename to deployments/helm-charts/charts/chat-api/templates/ingress.yaml diff --git a/deployment/helm-charts/charts/chat-api/templates/service.yaml b/deployments/helm-charts/charts/chat-api/templates/service.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-api/templates/service.yaml rename to deployments/helm-charts/charts/chat-api/templates/service.yaml diff --git a/deployment/helm-charts/charts/chat-api/templates/serviceaccount.yaml b/deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-api/templates/serviceaccount.yaml rename to deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml diff --git a/deployment/helm-charts/charts/chat-api/values.yaml b/deployments/helm-charts/charts/chat-api/values.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-api/values.yaml rename to deployments/helm-charts/charts/chat-api/values.yaml diff --git a/deployment/helm-charts/charts/chat-rpc/.helmignore b/deployments/helm-charts/charts/chat-rpc/.helmignore similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/.helmignore rename to deployments/helm-charts/charts/chat-rpc/.helmignore diff --git a/deployment/helm-charts/charts/chat-rpc/Chart.yaml b/deployments/helm-charts/charts/chat-rpc/Chart.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/Chart.yaml rename to deployments/helm-charts/charts/chat-rpc/Chart.yaml diff --git a/deployment/helm-charts/charts/chat-rpc/templates/NOTES.txt b/deployments/helm-charts/charts/chat-rpc/templates/NOTES.txt similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/templates/NOTES.txt rename to deployments/helm-charts/charts/chat-rpc/templates/NOTES.txt diff --git a/deployment/helm-charts/charts/chat-rpc/templates/_helpers.tpl b/deployments/helm-charts/charts/chat-rpc/templates/_helpers.tpl similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/templates/_helpers.tpl rename to deployments/helm-charts/charts/chat-rpc/templates/_helpers.tpl diff --git a/deployment/helm-charts/charts/chat-rpc/templates/deployment.yaml b/deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/templates/deployment.yaml rename to deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml diff --git a/deployment/helm-charts/charts/chat-rpc/templates/hpa.yaml b/deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/templates/hpa.yaml rename to deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml diff --git a/deployment/helm-charts/charts/chat-rpc/templates/ingress.yaml b/deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/templates/ingress.yaml rename to deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml diff --git a/deployment/helm-charts/charts/chat-rpc/templates/service.yaml b/deployments/helm-charts/charts/chat-rpc/templates/service.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/templates/service.yaml rename to deployments/helm-charts/charts/chat-rpc/templates/service.yaml diff --git a/deployment/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml b/deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml rename to deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml diff --git a/deployment/helm-charts/charts/chat-rpc/values.yaml b/deployments/helm-charts/charts/chat-rpc/values.yaml similarity index 100% rename from deployment/helm-charts/charts/chat-rpc/values.yaml rename to deployments/helm-charts/charts/chat-rpc/values.yaml diff --git a/deployment/helm-charts/config.yaml b/deployments/helm-charts/config.yaml similarity index 100% rename from deployment/helm-charts/config.yaml rename to deployments/helm-charts/config.yaml diff --git a/deployment/helm-charts/templates/NOTES.txt b/deployments/helm-charts/templates/NOTES.txt similarity index 100% rename from deployment/helm-charts/templates/NOTES.txt rename to deployments/helm-charts/templates/NOTES.txt diff --git a/deployment/helm-charts/templates/_helpers.tpl b/deployments/helm-charts/templates/_helpers.tpl similarity index 100% rename from deployment/helm-charts/templates/_helpers.tpl rename to deployments/helm-charts/templates/_helpers.tpl diff --git a/deployment/helm-charts/templates/app-cm.yaml b/deployments/helm-charts/templates/app-cm.yaml similarity index 100% rename from deployment/helm-charts/templates/app-cm.yaml rename to deployments/helm-charts/templates/app-cm.yaml diff --git a/deployment/helm-charts/templates/deployment.yaml b/deployments/helm-charts/templates/deployment.yaml similarity index 100% rename from deployment/helm-charts/templates/deployment.yaml rename to deployments/helm-charts/templates/deployment.yaml diff --git a/deployment/helm-charts/templates/hpa.yaml b/deployments/helm-charts/templates/hpa.yaml similarity index 100% rename from deployment/helm-charts/templates/hpa.yaml rename to deployments/helm-charts/templates/hpa.yaml diff --git a/deployment/helm-charts/templates/ingress.yaml b/deployments/helm-charts/templates/ingress.yaml similarity index 100% rename from deployment/helm-charts/templates/ingress.yaml rename to deployments/helm-charts/templates/ingress.yaml diff --git a/deployment/helm-charts/templates/service.yaml b/deployments/helm-charts/templates/service.yaml similarity index 100% rename from deployment/helm-charts/templates/service.yaml rename to deployments/helm-charts/templates/service.yaml diff --git a/deployment/helm-charts/templates/serviceaccount.yaml b/deployments/helm-charts/templates/serviceaccount.yaml similarity index 100% rename from deployment/helm-charts/templates/serviceaccount.yaml rename to deployments/helm-charts/templates/serviceaccount.yaml diff --git a/deployment/helm-charts/values.yaml b/deployments/helm-charts/values.yaml similarity index 100% rename from deployment/helm-charts/values.yaml rename to deployments/helm-charts/values.yaml diff --git a/config/config.yaml.template b/deployments/templates/config.yaml similarity index 100% rename from config/config.yaml.template rename to deployments/templates/config.yaml diff --git a/scripts/docker_start_all.sh b/scripts/docker_start_all.sh index ea4b5e0c..44ffd049 100755 --- a/scripts/docker_start_all.sh +++ b/scripts/docker_start_all.sh @@ -58,7 +58,7 @@ service_prometheus_port_names=() cd "$SCRIPTS_ROOT" -cp ./config/config.yaml.template ./config/config.yaml +cp ./deployments/templates/config.yaml ./config/config.yaml # Function to kill a service kill_service() { diff --git a/scripts/gen.mk b/scripts/gen.mk new file mode 100644 index 00000000..1671faff --- /dev/null +++ b/scripts/gen.mk @@ -0,0 +1,105 @@ +# Copyright © 2023 OpenIMSDK. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ============================================================================== +# Makefile helper functions for generate necessary files and docs +# https://cloud.redhat.com/blog/kubernetes-deep-dive-code-generation-customresources +# ! The stock of code generated by `make gen` should be idempotent +# +# Questions about go mod instead of go path: https://github.com/kubernetes/kubernetes/issues/117181 +# ============================================================================== +# Makefile helper functions for generate necessary files +# + +## gen.init: Initialize openim server project ✨ +.PHONY: gen.init +gen.init: + @echo "===========> Initializing openim server project" + @${ROOT_DIR}/scripts/init-config.sh + +## gen.init-githooks: Initialize git hooks ✨ +.PHONY: gen.init-githooks +gen.init-githooks: + @echo "===========> Initializing git hooks" + @${ROOT_DIR}/scripts/init-githooks.sh + +## gen.run: Generate necessary files and docs ✨ +.PHONY: gen.run +#gen.run: gen.errcode gen.docgo +gen.run: gen.clean gen.errcode gen.docgo.doc + +## gen.errcode: Generate necessary files and docs ✨ +.PHONY: gen.errcode +gen.errcode: gen.errcode.code gen.errcode.doc + +## gen.errcode.code: Generate openim error code go source files ✨ +.PHONY: gen.errcode.code +gen.errcode.code: tools.verify.codegen + @echo "===========> Generating openim error code go source files" + @codegen -type=int ${ROOT_DIR}/internal/pkg/code + +## gen.errcode.doc: Generate openim error code markdown documentation ✨ +.PHONY: gen.errcode.doc +gen.errcode.doc: tools.verify.codegen + @echo "===========> Generating error code markdown documentation" + @codegen -type=int -doc \ + -output ${ROOT_DIR}/docs/guide/zh-CN/api/error_code_generated.md ${ROOT_DIR}/internal/pkg/code + +## gen.docgo: Generate missing doc.go for go packages ✨ +.PHONY: gen.ca.% +gen.ca.%: + $(eval CA := $(word 1,$(subst ., ,$*))) + @echo "===========> Generating CA files for $(CA)" + @${ROOT_DIR}/scripts/gencerts.sh generate-openim-cert $(OUTPUT_DIR)/cert $(CA) + +## gen.ca: Generate CA files for all certificates ✨ +.PHONY: gen.ca +gen.ca: $(addprefix gen.ca., $(CERTIFICATES)) + +## gen.docgo: Generate missing doc.go for go packages ✨ +.PHONY: gen.docgo.doc +gen.docgo.doc: + @echo "===========> Generating missing doc.go for go packages" + @${ROOT_DIR}/scripts/gendoc.sh + +## gen.docgo.check: Check if there are untracked doc.go files ✨ +.PHONY: gen.docgo.check +gen.docgo.check: gen.docgo.doc + @n="$$(git ls-files --others '*/doc.go' | wc -l)"; \ + if test "$$n" -gt 0; then \ + git ls-files --others '*/doc.go' | sed -e 's/^/ /'; \ + echo "$@: untracked doc.go file(s) exist in working directory" >&2 ; \ + false ; \ + fi + +## gen.docgo.add: Add untracked doc.go files to git index ✨ +.PHONY: gen.docgo.add +gen.docgo.add: + @git ls-files --others '*/doc.go' | $(XARGS) -- git add + +## gen.docgo: Generate missing doc.go for go packages ✨ +.PHONY: gen.defaultconfigs +gen.defaultconfigs: + @${ROOT_DIR}/scripts/gen_default_config.sh + +## gen.docgo: Generate missing doc.go for go packages ✨ +.PHONY: gen.clean +gen.clean: + @rm -rf ./api/client/{clientset,informers,listers} + @$(FIND) -type f -name '*_generated.go' -delete + +## gen.help: show help for gen +.PHONY: gen.help +gen.help: scripts/make-rules/gen.mk + $(call smallhelp) \ No newline at end of file diff --git a/scripts/githooks/commit-msg b/scripts/githooks/commit-msg index c7b130cd..21d977f7 100644 --- a/scripts/githooks/commit-msg +++ b/scripts/githooks/commit-msg @@ -62,7 +62,7 @@ GITLINT_DIR="$OPENIM_ROOT/_output/tools/go-gitlint" $GITLINT_DIR \ --msg-file=$1 \ - --subject-regex="^(build|chore|ci|docs|feat|feature|fix|perf|refactor|revert|style|bot|test)(.*)?:\s?.*" \ + --subject-regex="^(build|chore|ci|docs|feat|feature|fix|bug|perf|refactor|revert|style|bot|test)(.*)?:\s?.*" \ --subject-maxlen=150 \ --subject-minlen=10 \ --body-regex=".*" \ diff --git a/scripts/githooks/pre-commit b/scripts/githooks/pre-commit index 9c44ecb0..9ba5256e 100644 --- a/scripts/githooks/pre-commit +++ b/scripts/githooks/pre-commit @@ -27,7 +27,7 @@ LC_ALL=C local_branch="$(git rev-parse --abbrev-ref HEAD)" -valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|bot|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" +valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|fix|openim|hotfix|test|bug|bot|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" YELLOW="\e[93m" GREEN="\e[32m" @@ -106,7 +106,7 @@ fi if [[ ! $local_branch =~ $valid_branch_regex ]] then printError "There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. -Your commit will be rejected. You should rename your branch to a valid name(feat/name OR bug/name) and try again." +Your commit will be rejected. You should rename your branch to a valid name(feat/name OR fix/name) and try again." printError "For more on this, read on: https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694" exit 1 fi \ No newline at end of file diff --git a/scripts/githooks/pre-push b/scripts/githooks/pre-push index 297cadc7..cce9f91d 100644 --- a/scripts/githooks/pre-push +++ b/scripts/githooks/pre-push @@ -23,7 +23,7 @@ RED="\e[31m" ENDCOLOR="\e[0m" local_branch="$(git rev-parse --abbrev-ref HEAD)" -valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" +valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|fix|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" printMessage() { printf "${YELLOW}OpenIM : $1${ENDCOLOR}\n" diff --git a/scripts/init-config.sh b/scripts/init-config.sh new file mode 100755 index 00000000..f89a6800 --- /dev/null +++ b/scripts/init-config.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Copyright © 2023 OpenIM. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script automatically initializes various configuration files and can generate example files. + +set -o errexit +set -o nounset +set -o pipefail + +# Include shell font styles and some basic information +SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. + +cp ${OPENIM_ROOT}/deployments/templates/config.yaml ${OPENIM_ROOT}/config/config.yaml \ No newline at end of file diff --git a/scripts/init-githooks.sh b/scripts/init-githooks.sh new file mode 100755 index 00000000..399054bb --- /dev/null +++ b/scripts/init-githooks.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +# Copyright © 2023 OpenIM. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ----------------------------------------------------------------------------- +# init-githooks.sh +# +# This script assists in managing Git hooks for the OpenIM project. +# When executed: +# 1. It prompts the user to enable git hooks. +# 2. If the user accepts, it copies predefined hook scripts to the appropriate +# Git directory, making them executable. +# 3. If requested, it can delete the added hooks. +# +# This script equal runs `make init-githooks` command. +# Usage: +# ./init-githooks.sh Prompt to enable git hooks. +# ./init-githooks.sh --delete Delete previously added git hooks. +# ./init-githooks.sh --help Show the help message. +# +# Example: `scripts/build-go.sh --help`. +# Documentation & related context can be found at: +# https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694 +# +# ----------------------------------------------------------------------------- + +OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +HOOKS_DIR="${OPENIM_ROOT}/.git/hooks" + +help_info() { + echo "Usage: $0 [options]" + echo + echo "This script helps to manage git hooks." + echo + echo "Options:" + echo " -h, --help Show this help message and exit." + echo " -d, --delete Delete the hooks that have been added." + echo " By default, it will prompt to enable git hooks." +} + +delete_hooks() { + for file in ${OPENIM_ROOT}/scripts/githooks/*.sh; do + hook_name=$(basename "$file" .sh) # This removes the .sh extension + rm -f "$HOOKS_DIR/$hook_name" + done + echo "Git hooks have been deleted." +} + +enable_hooks() { + echo "Would you like to:" + echo "1) Enable git hooks mode" + echo "2) Delete existing git hooks" + echo "Please select a number (or any other key to exit):" + read -r choice + + case "$choice" in + 1) + for file in ${OPENIM_ROOT}/scripts/githooks/*.sh; do + hook_name=$(basename "$file" .sh) # This removes the .sh extension + cp -f "$file" "$HOOKS_DIR/$hook_name" + done + + chmod +x $HOOKS_DIR/* + + echo "Git hooks mode has been enabled." + echo "With git hooks enabled, every time you perform a git action (e.g. git commit), the corresponding hooks script will be triggered automatically." + echo "This means that if the size of the file you're committing exceeds the set limit (e.g. 42MB), the commit will be rejected." + ;; + 2) + delete_hooks + ;; + *) + echo "Exiting without making changes." + ;; + esac +} + + +case "$1" in + -h|--help) + help_info + ;; + -d|--delete) + delete_hooks + ;; + *) + enable_hooks + ;; +esac From 647c703a556df032669497cc9dacee0c4e26f9a5 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong (cubxxw)" <3293172751nss@gmail.com> Date: Sat, 16 Dec 2023 17:35:00 +0800 Subject: [PATCH 3/4] fix: copyright-add Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --- build/images/Dockerfile | 14 ++++++++++++++ cmd/rpc/chat-rpc/main.go | 14 ++++++++++++++ deployments/helm-charts/Chart.yaml | 14 ++++++++++++++ .../helm-charts/charts/admin-rpc/Chart.yaml | 14 ++++++++++++++ .../charts/admin-rpc/templates/deployment.yaml | 14 ++++++++++++++ .../charts/admin-rpc/templates/hpa.yaml | 14 ++++++++++++++ .../charts/admin-rpc/templates/ingress.yaml | 14 ++++++++++++++ .../charts/admin-rpc/templates/service.yaml | 14 ++++++++++++++ .../charts/admin-rpc/templates/serviceaccount.yaml | 14 ++++++++++++++ .../helm-charts/charts/admin-rpc/values.yaml | 14 ++++++++++++++ deployments/helm-charts/charts/chat-api/Chart.yaml | 14 ++++++++++++++ .../charts/chat-api/templates/deployment.yaml | 14 ++++++++++++++ .../helm-charts/charts/chat-api/templates/hpa.yaml | 14 ++++++++++++++ .../charts/chat-api/templates/ingress.yaml | 14 ++++++++++++++ .../charts/chat-api/templates/service.yaml | 14 ++++++++++++++ .../charts/chat-api/templates/serviceaccount.yaml | 14 ++++++++++++++ .../helm-charts/charts/chat-api/values.yaml | 14 ++++++++++++++ deployments/helm-charts/charts/chat-rpc/Chart.yaml | 14 ++++++++++++++ .../charts/chat-rpc/templates/deployment.yaml | 14 ++++++++++++++ .../helm-charts/charts/chat-rpc/templates/hpa.yaml | 14 ++++++++++++++ .../charts/chat-rpc/templates/ingress.yaml | 14 ++++++++++++++ .../charts/chat-rpc/templates/service.yaml | 14 ++++++++++++++ .../charts/chat-rpc/templates/serviceaccount.yaml | 14 ++++++++++++++ .../helm-charts/charts/chat-rpc/values.yaml | 14 ++++++++++++++ deployments/helm-charts/config.yaml | 14 ++++++++++++++ deployments/helm-charts/templates/app-cm.yaml | 14 ++++++++++++++ deployments/helm-charts/templates/deployment.yaml | 14 ++++++++++++++ deployments/helm-charts/templates/hpa.yaml | 14 ++++++++++++++ deployments/helm-charts/templates/ingress.yaml | 14 ++++++++++++++ deployments/helm-charts/templates/service.yaml | 14 ++++++++++++++ .../helm-charts/templates/serviceaccount.yaml | 14 ++++++++++++++ deployments/helm-charts/values.yaml | 14 ++++++++++++++ deployments/templates/config.yaml | 14 ++++++++++++++ internal/rpc/chat/log.go | 14 ++++++++++++++ pkg/common/db/model/chat/log.go | 14 ++++++++++++++ pkg/common/db/table/chat/log.go | 14 ++++++++++++++ pkg/common/version/base.go | 14 ++++++++++++++ pkg/common/version/types.go | 14 ++++++++++++++ pkg/common/version/version.go | 14 ++++++++++++++ pkg/discovery_register/k8s_discovery_register.go | 14 ++++++++++++++ pkg/email/mail_test.go | 14 ++++++++++++++ tools/component/component.go | 14 ++++++++++++++ 42 files changed, 588 insertions(+) diff --git a/build/images/Dockerfile b/build/images/Dockerfile index 518de78b..2b78e8af 100644 --- a/build/images/Dockerfile +++ b/build/images/Dockerfile @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM BASE_IMAGE WORKDIR ${SERVER_WORKDIR} diff --git a/cmd/rpc/chat-rpc/main.go b/cmd/rpc/chat-rpc/main.go index 5b00c9f8..b02705c4 100644 --- a/cmd/rpc/chat-rpc/main.go +++ b/cmd/rpc/chat-rpc/main.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/deployments/helm-charts/Chart.yaml b/deployments/helm-charts/Chart.yaml index 14197079..b96fa796 100644 --- a/deployments/helm-charts/Chart.yaml +++ b/deployments/helm-charts/Chart.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v2 name: admin-api description: A Helm chart for Kubernetes diff --git a/deployments/helm-charts/charts/admin-rpc/Chart.yaml b/deployments/helm-charts/charts/admin-rpc/Chart.yaml index 81a2aadb..7b176105 100644 --- a/deployments/helm-charts/charts/admin-rpc/Chart.yaml +++ b/deployments/helm-charts/charts/admin-rpc/Chart.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v2 name: admin-rpc description: A Helm chart for Kubernetes diff --git a/deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml b/deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml index b8c92167..5fb1e383 100644 --- a/deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml +++ b/deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: apps/v1 kind: Deployment metadata: diff --git a/deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml b/deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml index ea6966c6..27755e49 100644 --- a/deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml +++ b/deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.autoscaling.enabled }} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler diff --git a/deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml b/deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml index 1c1ba0e9..3d946603 100644 --- a/deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml +++ b/deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.ingress.enabled -}} {{- $fullName := include "admin-rpc.fullname" . -}} {{- $svcPort := .Values.service.port -}} diff --git a/deployments/helm-charts/charts/admin-rpc/templates/service.yaml b/deployments/helm-charts/charts/admin-rpc/templates/service.yaml index 5104079a..a5b0dca5 100644 --- a/deployments/helm-charts/charts/admin-rpc/templates/service.yaml +++ b/deployments/helm-charts/charts/admin-rpc/templates/service.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v1 kind: Service metadata: diff --git a/deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml b/deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml index d79d94a6..41795155 100644 --- a/deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml +++ b/deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount diff --git a/deployments/helm-charts/charts/admin-rpc/values.yaml b/deployments/helm-charts/charts/admin-rpc/values.yaml index c4a4ae9b..ee7225e6 100644 --- a/deployments/helm-charts/charts/admin-rpc/values.yaml +++ b/deployments/helm-charts/charts/admin-rpc/values.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Default values for admin-rpc. # This is a YAML-formatted file. # Declare variables to be passed into your templates. diff --git a/deployments/helm-charts/charts/chat-api/Chart.yaml b/deployments/helm-charts/charts/chat-api/Chart.yaml index f885ada6..a82e9e11 100644 --- a/deployments/helm-charts/charts/chat-api/Chart.yaml +++ b/deployments/helm-charts/charts/chat-api/Chart.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v2 name: chat-api description: A Helm chart for Kubernetes diff --git a/deployments/helm-charts/charts/chat-api/templates/deployment.yaml b/deployments/helm-charts/charts/chat-api/templates/deployment.yaml index f5518d00..d29efdf1 100644 --- a/deployments/helm-charts/charts/chat-api/templates/deployment.yaml +++ b/deployments/helm-charts/charts/chat-api/templates/deployment.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: apps/v1 kind: Deployment metadata: diff --git a/deployments/helm-charts/charts/chat-api/templates/hpa.yaml b/deployments/helm-charts/charts/chat-api/templates/hpa.yaml index 454cd0ed..f6d63e82 100644 --- a/deployments/helm-charts/charts/chat-api/templates/hpa.yaml +++ b/deployments/helm-charts/charts/chat-api/templates/hpa.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.autoscaling.enabled }} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler diff --git a/deployments/helm-charts/charts/chat-api/templates/ingress.yaml b/deployments/helm-charts/charts/chat-api/templates/ingress.yaml index f9a7ab0e..43ecdb75 100644 --- a/deployments/helm-charts/charts/chat-api/templates/ingress.yaml +++ b/deployments/helm-charts/charts/chat-api/templates/ingress.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.ingress.enabled -}} {{- $fullName := include "chat-api.fullname" . -}} {{- $svcPort := .Values.service.port -}} diff --git a/deployments/helm-charts/charts/chat-api/templates/service.yaml b/deployments/helm-charts/charts/chat-api/templates/service.yaml index 7761dccc..ec844e28 100644 --- a/deployments/helm-charts/charts/chat-api/templates/service.yaml +++ b/deployments/helm-charts/charts/chat-api/templates/service.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v1 kind: Service metadata: diff --git a/deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml b/deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml index ab59c1af..52f3aabd 100644 --- a/deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml +++ b/deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount diff --git a/deployments/helm-charts/charts/chat-api/values.yaml b/deployments/helm-charts/charts/chat-api/values.yaml index bd8b8b39..4aa41161 100644 --- a/deployments/helm-charts/charts/chat-api/values.yaml +++ b/deployments/helm-charts/charts/chat-api/values.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Default values for chat-api. # This is a YAML-formatted file. # Declare variables to be passed into your templates. diff --git a/deployments/helm-charts/charts/chat-rpc/Chart.yaml b/deployments/helm-charts/charts/chat-rpc/Chart.yaml index 32af6b4e..a3ffcbbd 100644 --- a/deployments/helm-charts/charts/chat-rpc/Chart.yaml +++ b/deployments/helm-charts/charts/chat-rpc/Chart.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v2 name: chat-rpc description: A Helm chart for Kubernetes diff --git a/deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml b/deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml index d73eb945..da9df7e1 100644 --- a/deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml +++ b/deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: apps/v1 kind: Deployment metadata: diff --git a/deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml b/deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml index 4ff77848..f5418754 100644 --- a/deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml +++ b/deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.autoscaling.enabled }} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler diff --git a/deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml b/deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml index 8b742fe7..1b292c08 100644 --- a/deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml +++ b/deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.ingress.enabled -}} {{- $fullName := include "chat-rpc.fullname" . -}} {{- $svcPort := .Values.service.port -}} diff --git a/deployments/helm-charts/charts/chat-rpc/templates/service.yaml b/deployments/helm-charts/charts/chat-rpc/templates/service.yaml index 5056fc7f..a2460036 100644 --- a/deployments/helm-charts/charts/chat-rpc/templates/service.yaml +++ b/deployments/helm-charts/charts/chat-rpc/templates/service.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v1 kind: Service metadata: diff --git a/deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml b/deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml index 085101f9..8705421d 100644 --- a/deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml +++ b/deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount diff --git a/deployments/helm-charts/charts/chat-rpc/values.yaml b/deployments/helm-charts/charts/chat-rpc/values.yaml index 1da19de4..719f8553 100644 --- a/deployments/helm-charts/charts/chat-rpc/values.yaml +++ b/deployments/helm-charts/charts/chat-rpc/values.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Default values for chat-rpc. # This is a YAML-formatted file. # Declare variables to be passed into your templates. diff --git a/deployments/helm-charts/config.yaml b/deployments/helm-charts/config.yaml index b6dc0e3e..9b4c569e 100644 --- a/deployments/helm-charts/config.yaml +++ b/deployments/helm-charts/config.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + image: repository: registry.cn-shenzhen.aliyuncs.com/huanglin_hub/admin-api pullPolicy: Always diff --git a/deployments/helm-charts/templates/app-cm.yaml b/deployments/helm-charts/templates/app-cm.yaml index 0d03ce71..e01c895a 100644 --- a/deployments/helm-charts/templates/app-cm.yaml +++ b/deployments/helm-charts/templates/app-cm.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v1 kind: ConfigMap metadata: diff --git a/deployments/helm-charts/templates/deployment.yaml b/deployments/helm-charts/templates/deployment.yaml index 361ac165..a8cd54f3 100644 --- a/deployments/helm-charts/templates/deployment.yaml +++ b/deployments/helm-charts/templates/deployment.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: apps/v1 kind: Deployment metadata: diff --git a/deployments/helm-charts/templates/hpa.yaml b/deployments/helm-charts/templates/hpa.yaml index 60d7bd20..3ffac34d 100644 --- a/deployments/helm-charts/templates/hpa.yaml +++ b/deployments/helm-charts/templates/hpa.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.autoscaling.enabled }} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler diff --git a/deployments/helm-charts/templates/ingress.yaml b/deployments/helm-charts/templates/ingress.yaml index 2ea7af21..2580e9cd 100644 --- a/deployments/helm-charts/templates/ingress.yaml +++ b/deployments/helm-charts/templates/ingress.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.ingress.enabled -}} {{- $fullName := include "admin-api.fullname" . -}} {{- $svcPort := .Values.service.port -}} diff --git a/deployments/helm-charts/templates/service.yaml b/deployments/helm-charts/templates/service.yaml index f4e3506b..e5d385f7 100644 --- a/deployments/helm-charts/templates/service.yaml +++ b/deployments/helm-charts/templates/service.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: v1 kind: Service metadata: diff --git a/deployments/helm-charts/templates/serviceaccount.yaml b/deployments/helm-charts/templates/serviceaccount.yaml index 04801cd7..c0c05657 100644 --- a/deployments/helm-charts/templates/serviceaccount.yaml +++ b/deployments/helm-charts/templates/serviceaccount.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount diff --git a/deployments/helm-charts/values.yaml b/deployments/helm-charts/values.yaml index e483907b..2664d3d8 100644 --- a/deployments/helm-charts/values.yaml +++ b/deployments/helm-charts/values.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Default values for admin-api. # This is a YAML-formatted file. # Declare variables to be passed into your templates. diff --git a/deployments/templates/config.yaml b/deployments/templates/config.yaml index 12c63143..f9f8ad2e 100644 --- a/deployments/templates/config.yaml +++ b/deployments/templates/config.yaml @@ -1,3 +1,17 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # OpenIM Server should be started before this configuration is applied envs: discovery: "zookeeper" # ENVS_DISCOVERY, e.g., zookeeper, etcd... diff --git a/internal/rpc/chat/log.go b/internal/rpc/chat/log.go index 34d476cd..c7a1d45f 100644 --- a/internal/rpc/chat/log.go +++ b/internal/rpc/chat/log.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package chat import ( diff --git a/pkg/common/db/model/chat/log.go b/pkg/common/db/model/chat/log.go index df138f5f..024542aa 100644 --- a/pkg/common/db/model/chat/log.go +++ b/pkg/common/db/model/chat/log.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package chat import ( diff --git a/pkg/common/db/table/chat/log.go b/pkg/common/db/table/chat/log.go index d19d0b89..8f670e0d 100644 --- a/pkg/common/db/table/chat/log.go +++ b/pkg/common/db/table/chat/log.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package chat import ( diff --git a/pkg/common/version/base.go b/pkg/common/version/base.go index 6d2c2dc8..0ca04cd8 100644 --- a/pkg/common/version/base.go +++ b/pkg/common/version/base.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package version // Base version information. diff --git a/pkg/common/version/types.go b/pkg/common/version/types.go index 3778220b..c2bd8bb4 100644 --- a/pkg/common/version/types.go +++ b/pkg/common/version/types.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package version // Info contains versioning information. diff --git a/pkg/common/version/version.go b/pkg/common/version/version.go index f2fb64d9..24cfee7a 100644 --- a/pkg/common/version/version.go +++ b/pkg/common/version/version.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package version import ( diff --git a/pkg/discovery_register/k8s_discovery_register.go b/pkg/discovery_register/k8s_discovery_register.go index a8ee5fff..979b8475 100644 --- a/pkg/discovery_register/k8s_discovery_register.go +++ b/pkg/discovery_register/k8s_discovery_register.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package discovery_register import ( diff --git a/pkg/email/mail_test.go b/pkg/email/mail_test.go index daf40c67..67f7f1fc 100644 --- a/pkg/email/mail_test.go +++ b/pkg/email/mail_test.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package email import ( diff --git a/tools/component/component.go b/tools/component/component.go index a6edfe13..f7e37bca 100644 --- a/tools/component/component.go +++ b/tools/component/component.go @@ -1,3 +1,17 @@ +// Copyright © 2023 OpenIM open source community. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package component import ( From 597dc018acf30d0dcee4f7ac30bcf7212cdde381 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong (cubxxw)" <3293172751nss@gmail.com> Date: Sat, 16 Dec 2023 17:53:28 +0800 Subject: [PATCH 4/4] fix: docker compose Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --- README.md | 2 +- scripts/init-config.sh | 95 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 79 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f14cdb6d..100b5674 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ sudo docker compose up -d **Setting configuration items:** ```bash -cp ./deployments/templates/config.yaml ./config/config.yaml +make init ``` > Then modify the configuration file `config/config.yaml` according to your needs diff --git a/scripts/init-config.sh b/scripts/init-config.sh index f89a6800..27062609 100755 --- a/scripts/init-config.sh +++ b/scripts/init-config.sh @@ -1,19 +1,4 @@ -#!/usr/bin/env bash -# Copyright © 2023 OpenIM. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script automatically initializes various configuration files and can generate example files. +#!/bin/bash set -o errexit set -o nounset @@ -23,4 +8,80 @@ set -o pipefail SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. -cp ${OPENIM_ROOT}/deployments/templates/config.yaml ${OPENIM_ROOT}/config/config.yaml \ No newline at end of file +config_file="${OPENIM_ROOT}/config/config.yaml" + +# Initialize flags +FORCE=false +SKIP=false + +show_help() { + echo "Usage: init-config.sh [options]" + echo "Options:" + echo " -h, --help Show this help message" + echo " --force Overwrite existing files without prompt" + echo " --skip Skip generation if file exists" + echo " --clean-config Clean all configuration files" +} + +clean_config() { + echo "Cleaning configuration files..." + rm -f "${config_file}" + echo "Configuration files cleaned." +} + +generate_config() { + echo "Generating configuration file..." + cp "${OPENIM_ROOT}/deployments/templates/config.yaml" "${config_file}" + echo "Configuration file generated." +} + +overwrite_prompt() { + while true; do + read -p "Configuration file exists. Overwrite? [Y/N]: " yn + case $yn in + [Yy]* ) generate_config; break;; + [Nn]* ) echo "Skipping generation."; exit;; + * ) echo "Please answer yes or no.";; + esac + done +} + +# Parse command line arguments +for i in "$@" +do +case $i in + -h|--help) + show_help + exit 0 + ;; + --force) + FORCE=true + shift + ;; + --skip) + SKIP=true + shift + ;; + --clean-config) + clean_config + exit 0 + ;; + *) + # unknown option + show_help + exit 1 + ;; +esac +done + +if [[ "${FORCE}" == "true" ]]; then + generate_config +elif [[ "${SKIP}" == "true" ]] && [[ -f "${config_file}" ]]; then + echo "Configuration file already exists. Skipping generation." +else + if [[ -f "${config_file}" ]]; then + overwrite_prompt + else + generate_config + fi +fi