From f27b1e43f57c2a0f49fad387fe6e486930845fce Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751@qq.com> Date: Sun, 7 Jan 2024 15:02:59 +0800 Subject: [PATCH] Enhancements to Script Variables and Logic in OpenIM, Including dig Detection and Mongo Startup Checks (#1696) * update openim and optimize openim docs and dig check Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim and optimize openim docs and dig check Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim and optimize openim docs and dig check Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * fix openim config mongo passwd env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * update openim environment and status Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: sava openim cicd Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> * feat: add openim mongo logic Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --- .github/workflows/docker-buildx.yml | 130 ++++++++++++++++++++++++ .github/workflows/e2e-test.yml | 37 ++++++- .github/workflows/openimci.yml | 60 +++++++++-- deployments/templates/env-template.yaml | 18 +++- docker-compose.yml | 4 +- docs/contrib/environment.md | 17 ++-- docs/contrib/images.md | 1 + docs/contrib/version.md | 21 ++++ pkg/common/config/version | 2 +- pkg/msgprocessor/conversation.go | 1 + pkg/msgprocessor/options.go | 1 + scripts/genconfig.sh | 12 +-- scripts/install-im-server.sh | 14 +++ scripts/install/environment.sh | 4 +- scripts/lib/util.sh | 9 +- scripts/make-rules/common.mk | 2 +- scripts/mongo-init.sh | 2 - 17 files changed, 291 insertions(+), 44 deletions(-) diff --git a/.github/workflows/docker-buildx.yml b/.github/workflows/docker-buildx.yml index 6113cfae5..b3b0b5683 100644 --- a/.github/workflows/docker-buildx.yml +++ b/.github/workflows/docker-buildx.yml @@ -106,6 +106,16 @@ jobs: ghcr.io/openimsdk/openim-api openim/openim-api registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-api + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-api uses: docker/build-push-action@v5 @@ -127,6 +137,16 @@ jobs: ghcr.io/openimsdk/openim-cmdutils openim/openim-cmdutils registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-cmdutils + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-cmdutils uses: docker/build-push-action@v5 @@ -148,6 +168,16 @@ jobs: ghcr.io/openimsdk/openim-crontask openim/openim-crontask registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-crontask + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-crontask uses: docker/build-push-action@v5 @@ -169,6 +199,16 @@ jobs: ghcr.io/openimsdk/openim-msggateway openim/openim-msggateway registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-msggateway + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-msggateway uses: docker/build-push-action@v5 @@ -190,6 +230,16 @@ jobs: ghcr.io/openimsdk/openim-msgtransfer openim/openim-msgtransfer registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-msgtransfer + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-msgtransfer uses: docker/build-push-action@v5 @@ -211,6 +261,16 @@ jobs: ghcr.io/openimsdk/openim-push openim/openim-push registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-push + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-push uses: docker/build-push-action@v5 @@ -232,6 +292,16 @@ jobs: ghcr.io/openimsdk/openim-rpc-auth openim/openim-rpc-auth registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-rpc-auth + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-rpc-auth uses: docker/build-push-action@v5 @@ -253,6 +323,16 @@ jobs: ghcr.io/openimsdk/openim-rpc-conversation openim/openim-rpc-conversation registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-rpc-conversation + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-rpc-conversation uses: docker/build-push-action@v5 @@ -274,6 +354,16 @@ jobs: ghcr.io/openimsdk/openim-rpc-friend openim/openim-rpc-friend registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-rpc-friend + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-rpc-friend uses: docker/build-push-action@v5 @@ -295,6 +385,16 @@ jobs: ghcr.io/openimsdk/openim-rpc-group openim/openim-rpc-group registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-rpc-group + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-rpc-group uses: docker/build-push-action@v5 @@ -316,6 +416,16 @@ jobs: ghcr.io/openimsdk/openim-rpc-msg openim/openim-rpc-msg registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-rpc-msg + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-rpc-msg uses: docker/build-push-action@v5 @@ -337,6 +447,16 @@ jobs: ghcr.io/openimsdk/openim-rpc-third openim/openim-rpc-third registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-rpc-third + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-rpc-third uses: docker/build-push-action@v5 @@ -358,6 +478,16 @@ jobs: ghcr.io/openimsdk/openim-rpc-user openim/openim-rpc-user registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-rpc-user + tags: | + type=ref,event=tag + 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: Build and push Docker image for openim-rpc-user uses: docker/build-push-action@v5 diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 2f6d7fe05..6d8112eb4 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -92,11 +92,40 @@ jobs: - name: Exec OpenIM API test run: | - sudo make test-api - - - name: Exec OpenIM E2E test + touch /tmp/test.md + echo "# OpenIM Test" >> /tmp/test.md + echo "## OpenIM API Test" >> /tmp/test.md + echo "
Command Output for OpenIM API Test" >> /tmp/test.md + echo "
" >> /tmp/test.md
+        sudo make test-api | tee -a /tmp/test.md
+        echo "
" >> /tmp/test.md + echo "
" >> /tmp/test.md + + - name: Exec OpenIM E2E Test run: | - sudo make test-e2e + echo "" >> /tmp/test.md + echo "## OpenIM E2E Test" >> /tmp/test.md + echo "
Command Output for OpenIM E2E Test" >> /tmp/test.md + echo "
" >> /tmp/test.md
+        sudo make test-e2e | tee -a /tmp/test.md
+        echo "
" >> /tmp/test.md + echo "
" >> /tmp/test.md + + - name: Comment PR with file + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: /tmp/test.md + comment_tag: nrt_file + reactions: eyes, rocket + mode: recreate + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + continue-on-error: true + + - name: Check outputs + run: | + echo "id : ${{ steps.nrt_message.outputs.id }}" + echo "body : ${{ steps.nrt_message.outputs.body }}" + echo "html_url : ${{ steps.nrt_message.outputs.html_url }}" - name: Exec OpenIM System uninstall run: | diff --git a/.github/workflows/openimci.yml b/.github/workflows/openimci.yml index 45541f5f4..96e03f214 100644 --- a/.github/workflows/openimci.yml +++ b/.github/workflows/openimci.yml @@ -36,21 +36,19 @@ env: GO_VERSION: "1.19" GOLANGCI_VERSION: "v1.50.1" - jobs: openim: name: Test with go ${{ matrix.go_version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} permissions: contents: write + pull-requests: write environment: name: openim - strategy: matrix: go_version: ["1.19","1.20","1.21"] os: [ubuntu-latest] - steps: - name: Setup uses: actions/checkout@v4 @@ -111,6 +109,9 @@ jobs: openim-start: name: Test OpenIM install/start on ${{ matrix.os }} runs-on: ${{ matrix.os }} + permissions: + contents: write + pull-requests: write environment: name: openim strategy: @@ -128,12 +129,46 @@ jobs: - name: Run OpenIM make install start run: | sudo make install - sudo docker images - sudo docker ps + + # - name: Check the OpenIM environment and status + # run: | + # sudo docker images + # sudo docker ps + + - name: Check the OpenIM environment and status + id: docker_info + run: | + sleep 30 + echo "images<> $GITHUB_ENV + sudo docker images >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + echo "containers<> $GITHUB_ENV + sudo docker ps >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Comment PR + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + > [!TIP] + > Run make install to check the status + + ### Docker Images: + ``` + ${{ env.images }} + ``` + ### Docker Processes: + ``` + ${{ env.containers }} + ``` + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} execute-scripts: name: Execute OpenIM Script On ${{ matrix.os }} runs-on: ${{ matrix.os }} + permissions: + contents: write + pull-requests: write environment: name: openim strategy: @@ -203,10 +238,9 @@ jobs: - name: Build, Start, Check Services and Print Logs for Ubuntu if: runner.os == 'Linux' run: | - sudo make build && \ - sudo make start && \ - sudo make check || \ - (echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null) + sudo make build + sudo make start + sudo make check - name: Restart Services and Print Logs for Ubuntu if: runner.os == 'Linux' @@ -222,6 +256,9 @@ jobs: openim-test-build-image: name: Build OpenIM Docker Image runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write environment: name: openim steps: @@ -243,4 +280,9 @@ jobs: run: | sudo make init sudo make image + + - name: Get OpenIM Docker Images Status + id: docker_processes + run: | sudo docker images + sudo docker ps \ No newline at end of file diff --git a/deployments/templates/env-template.yaml b/deployments/templates/env-template.yaml index 09349aab0..e7166ff2d 100644 --- a/deployments/templates/env-template.yaml +++ b/deployments/templates/env-template.yaml @@ -1,3 +1,17 @@ +# Copyright © 2024 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. + # ----------------------------------------------------------------------------- # General Configuration # This section contains general configuration options for the entire environment. @@ -88,10 +102,6 @@ ZOOKEEPER_PORT=${ZOOKEEPER_PORT} # Default: MONGO_PORT=37017 # MONGO_PORT=${MONGO_PORT} -# Username for MongoDB admin user. Used for service authentication. -# Default: MONGO_USERNAME=root -# MONGO_USERNAME=${MONGO_USERNAME} - # Password for MongoDB admin user. Used for service authentication. # Default: MONGO_PASSWORD=openIM123 MONGO_PASSWORD=${MONGO_PASSWORD} diff --git a/docker-compose.yml b/docker-compose.yml index b5c80188c..defc910c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,15 +10,13 @@ networks: - subnet: '${DOCKER_BRIDGE_SUBNET:-172.28.0.0/16}' gateway: '${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}' - - services: mongodb: image: mongo:${MONGODB_IMAGE_VERSION-6.0.2} ports: - "${MONGO_PORT:-37017}:27017" container_name: mongo - command: --wiredTigerCacheSizeGB 1 --auth + command: ["/bin/bash", "-c", "/docker-entrypoint-initdb.d/mongo-init.sh || true; docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth"] volumes: - "${DATA_DIR:-./}/components/mongodb/data/db:/data/db" - "${DATA_DIR:-./}/components/mongodb/data/logs:/data/logs" diff --git a/docs/contrib/environment.md b/docs/contrib/environment.md index 8db462688..7425c8022 100644 --- a/docs/contrib/environment.md +++ b/docs/contrib/environment.md @@ -104,8 +104,8 @@ Docker deployment offers a slightly more intricate template. Within the [openim- Configuration file modifications can be made by specifying corresponding environment variables, for instance: ```bash -export CHAT_IMAGE_VERSION="main" -export SERVER_IMAGE_VERSION="main" +export CHAT_IMAGE_VERSION="main" +export SERVER_IMAGE_VERSION="main" ``` These variables are stored within the [`environment.sh`](https://github.com/OpenIMSDK/openim-docker/blob/main/scripts/install/environment.sh) configuration: @@ -114,6 +114,9 @@ These variables are stored within the [`environment.sh`](https://github.com/Open readonly CHAT_IMAGE_VERSION=${CHAT_IMAGE_VERSION:-'main'} readonly SERVER_IMAGE_VERSION=${SERVER_IMAGE_VERSION:-'main'} ``` +> [!IMPORTANT] +> Can learn to read our mirror version strategy: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md + Setting a variable, e.g., `export CHAT_IMAGE_VERSION="release-v1.3"`, will prioritize `CHAT_IMAGE_VERSION="release-v1.3"` as the variable value. Ultimately, the chosen image version is determined, and rendering is achieved through `make init` (or `./scripts/init-config.sh`). @@ -127,7 +130,7 @@ For convenience, configuration through modifying environment variables is recomm + PASSWORD - + **Description**: Password for mysql, mongodb, redis, and minio. + + **Description**: Password for mongodb, redis, and minio. + **Default**: `openIM123` + Notes: + Minimum password length: 8 characters. @@ -139,20 +142,22 @@ For convenience, configuration through modifying environment variables is recomm + OPENIM_USER - + **Description**: Username for mysql, mongodb, redis, and minio. + + **Description**: Username for redis, and minio. + **Default**: `root` ```bash export OPENIM_USER="root" ``` -+ API_URL +> mongo is `openIM`, use `export MONGO_OPENIM_USERNAME="openIM"` to modify + ++ OPENIM_IP + **Description**: API address. + **Note**: If the server has an external IP, it will be automatically obtained. For internal networks, set this variable to the IP serving internally. ```bash - export API_URL="http://ip:10002" + export OPENIM_IP="ip" ``` + DATA_DIR diff --git a/docs/contrib/images.md b/docs/contrib/images.md index 44bd7b5bf..d1a83d639 100644 --- a/docs/contrib/images.md +++ b/docs/contrib/images.md @@ -26,6 +26,7 @@ We provide multiple versions of our images to meet different project requirement 1. `main`: This image corresponds to the latest version of the main branch in OpenIM. It is updated frequently, making it perfect for users who want to stay at the cutting edge of our features. 2. `release-v3.*`: This is the image that corresponds to the latest version of OpenIM's stable release branch. It's ideal for users who prefer a balance between new features and stability. 3. `v3.*.*`: These images are specific to each tag in OpenIM. They are preserved in their original state and are never overwritten. These are the go-to images for users who need a specific, unchanging version of OpenIM. +4. The image versions adhere to Semantic Versioning 2.0.0 strategy. Taking the `openim-server` image as an example, available at [openim-server container package](https://github.com/openimsdk/open-im-server/pkgs/container/openim-server): upon tagging with v3.5.0, the CI automatically releases the following tags - `openim-server:3`, `openim-server:3.5`, `openim-server:3.5.0`, `openim-server:v3.5.0`, `openim-server:latest`, and `sha-e0244d9`. It's important to note that only `sha-e0244d9` is absolutely unique, whereas `openim-server:v3.5.0` and `openim-server:3.5.0` maintain a degree of uniqueness. ### Multi-Architecture Images diff --git a/docs/contrib/version.md b/docs/contrib/version.md index 0e03b8d8b..574badf59 100644 --- a/docs/contrib/version.md +++ b/docs/contrib/version.md @@ -1,6 +1,7 @@ # OpenIM Branch Management and Versioning: A Blueprint for High-Grade Software Development [📚 **OpenIM TOC**](#openim-branch-management-and-versioning-a-blueprint-for-high-grade-software-development) +- [OpenIM Branch Management and Versioning: A Blueprint for High-Grade Software Development](#openim-branch-management-and-versioning-a-blueprint-for-high-grade-software-development) - [Unfolding the Mechanism of OpenIM Version Maintenance](#unfolding-the-mechanism-of-openim-version-maintenance) - [Main Branch: The Heart of OpenIM Development](#main-branch-the-heart-of-openim-development) - [Release Branch: The Beacon of Stability](#release-branch-the-beacon-of-stability) @@ -8,8 +9,21 @@ - [Release Management: A Guided Tour](#release-management-a-guided-tour) - [Milestones, Branching, and Addressing Major Bugs](#milestones-branching-and-addressing-major-bugs) - [Version Skew Policy](#version-skew-policy) + - [Supported version skew](#supported-version-skew) + - [OpenIM Versioning, Branching, and Tag Strategy](#openim-versioning-branching-and-tag-strategy) + - [Supported Version Skew](#supported-version-skew-1) + - [openim-api](#openim-api) + - [openim-rpc-\* Components](#openim-rpc--components) + - [Other OpenIM Services](#other-openim-services) + - [Supported Component Upgrade Order](#supported-component-upgrade-order) + - [openim-api](#openim-api-1) + - [openim-rpc-\* Components](#openim-rpc--components-1) + - [Other OpenIM Services](#other-openim-services-1) + - [Conclusion](#conclusion) - [Applying Principles: A Git Workflow Example](#applying-principles-a-git-workflow-example) + - [Release Process](#release-process) - [Docker Images Version Management](#docker-images-version-management) + - [More](#more) At OpenIM, we acknowledge the profound impact of implementing a robust and efficient version management system, hence we abide by the established standards of [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/). @@ -213,3 +227,10 @@ Throughout this process, active communication within the team is pivotal to main ## Docker Images Version Management For more details on managing Docker image versions, visit [OpenIM Docker Images Administration](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md). + +## More + +More on multi-branch version management design and version management design at helm charts: + ++ https://github.com/openimsdk/open-im-server/issues/1695 ++ https://github.com/openimsdk/open-im-server/issues/1662 \ No newline at end of file diff --git a/pkg/common/config/version b/pkg/common/config/version index e682ea429..4d0729e54 100644 --- a/pkg/common/config/version +++ b/pkg/common/config/version @@ -1 +1 @@ -v3.3.0 \ No newline at end of file +v3.5.0 \ No newline at end of file diff --git a/pkg/msgprocessor/conversation.go b/pkg/msgprocessor/conversation.go index 56255f37c..7477bea7a 100644 --- a/pkg/msgprocessor/conversation.go +++ b/pkg/msgprocessor/conversation.go @@ -52,6 +52,7 @@ func GetChatConversationIDByMsg(msg *sdkws.MsgData) string { case constant.NotificationChatType: return "sn_" + msg.SendID + "_" + msg.RecvID } + return "" } diff --git a/pkg/msgprocessor/options.go b/pkg/msgprocessor/options.go index ea383a1af..c6e209b98 100644 --- a/pkg/msgprocessor/options.go +++ b/pkg/msgprocessor/options.go @@ -37,6 +37,7 @@ func NewOptions(opts ...OptionsOpt) Options { for _, opt := range opts { opt(options) } + return options } diff --git a/scripts/genconfig.sh b/scripts/genconfig.sh index 2371edc9d..8ded38b22 100755 --- a/scripts/genconfig.sh +++ b/scripts/genconfig.sh @@ -29,16 +29,8 @@ if [ $# -ne 2 ];then exit 1 fi -openim::util::require-dig -result=$? -if [ $result -ne 0 ]; then - openim::log::info "Please install 'dig' to use this feature." - openim::log::info "Installation instructions:" - openim::log::info " For Ubuntu/Debian: sudo apt-get install dnsutils" - openim::log::info " For CentOS/RedHat: sudo yum install bind-utils" - openim::log::info " For macOS: 'dig' should be preinstalled. If missing, try: brew install bind" - openim::log::info " For Windows: Install BIND9 tools from https://www.isc.org/download/" - openim::log::error_exit "Error: 'dig' command is required but not installed." +if [ -z "${OPENIM_IP}" ]; then + openim::util::require-dig fi source "${env_file}" diff --git a/scripts/install-im-server.sh b/scripts/install-im-server.sh index 16ac625ee..9afbb97c9 100755 --- a/scripts/install-im-server.sh +++ b/scripts/install-im-server.sh @@ -1,4 +1,18 @@ #!/usr/bin/env bash +# Copyright © 2024 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. + # # OpenIM Docker Deployment Script # diff --git a/scripts/install/environment.sh b/scripts/install/environment.sh index a95bf6a93..9d9fc4028 100755 --- a/scripts/install/environment.sh +++ b/scripts/install/environment.sh @@ -171,13 +171,13 @@ def "MONGO_URI" # MongoDB的URI def "MONGO_PORT" "37017" # MongoDB的端口 def "MONGO_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MongoDB的地址 def "MONGO_DATABASE" "${DATABASE_NAME}" # MongoDB的数据库名 -def "MONGO_USERNAME" "root" # MongoDB的管理员身份用户名 +def "MONGO_USERNAME" "root" # MongoDB的管理员身份用户名 # MongoDB的管理员身份密码 readonly MONGO_PASSWORD=${MONGO_PASSWORD:-"${PASSWORD}"} # Mongo OpenIM 身份用户名 def "MONGO_OPENIM_USERNAME" "openIM" # Mongo OpenIM 身份密码 -readonly MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD:-'openIM123456'} +readonly MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD:-"${PASSWORD}"} def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小 diff --git a/scripts/lib/util.sh b/scripts/lib/util.sh index b8d76edeb..4de240972 100755 --- a/scripts/lib/util.sh +++ b/scripts/lib/util.sh @@ -1146,8 +1146,13 @@ function openim::util::require-jq { # Checks whether dig is installed and provides installation instructions if it is not. function openim::util::require-dig { if ! command -v dig &>/dev/null; then - openim::log::error "dig command not found." - return 1 + openim::log::error "Please install 'dig' to use this feature." + openim::log::error "Installation instructions:" + openim::log::error " For Ubuntu/Debian: sudo apt-get install dnsutils" + openim::log::error " For CentOS/RedHat: sudo yum install bind-utils" + openim::log::error " For macOS: 'dig' should be preinstalled. If missing, try: brew install bind" + openim::log::error " For Windows: Install BIND9 tools from https://www.isc.org/download/" + openim::log::error_exit "dig command not found." fi return 0 } diff --git a/scripts/make-rules/common.mk b/scripts/make-rules/common.mk index 81b44826b..c56f9f071 100644 --- a/scripts/make-rules/common.mk +++ b/scripts/make-rules/common.mk @@ -129,7 +129,7 @@ FIND := find . ! -path './utils/*' ! -path './vendor/*' ! -path './third_party/* XARGS := xargs -r --no-run-if-empty # Linux command settings-CODE DIRS Copyright -CODE_DIRS := $(ROOT_DIR)/pkg $(ROOT_DIR)/cmd $(ROOT_DIR)/config $(ROOT_DIR)/.docker-compose_cfg $(ROOT_DIR)/internal $(ROOT_DIR)/scripts $(ROOT_DIR)/test $(ROOT_DIR)/.github $(ROOT_DIR)/build $(ROOT_DIR)/tools $(ROOT_DIR)/deployments +CODE_DIRS := $(ROOT_DIR)/pkg $(ROOT_DIR)/cmd $(ROOT_DIR)/config $(ROOT_DIR)/internal $(ROOT_DIR)/scripts $(ROOT_DIR)/test $(ROOT_DIR)/.github $(ROOT_DIR)/build $(ROOT_DIR)/tools $(ROOT_DIR)/deployments FINDS := find $(CODE_DIRS) # Makefile settings: Select different behaviors by determining whether V option is set diff --git a/scripts/mongo-init.sh b/scripts/mongo-init.sh index bb9519648..41d9ca0aa 100755 --- a/scripts/mongo-init.sh +++ b/scripts/mongo-init.sh @@ -18,7 +18,6 @@ mongosh <