mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 22:39:18 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2286f03e5 | |||
| f937419175 |
@@ -1,21 +0,0 @@
|
||||
# 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.
|
||||
|
||||
directory: ./
|
||||
file_types:
|
||||
- .go
|
||||
- .yaml
|
||||
- .yml
|
||||
languages:
|
||||
- Chinese
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Sync Issue to PR
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Invite user to join our group
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
|
||||
@@ -23,9 +23,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Comment cherry-pick command
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
const pr = context.payload.pull_request;
|
||||
if (!pr.merged) {
|
||||
@@ -64,4 +63,5 @@ jobs:
|
||||
repo: context.repo.repo,
|
||||
issue_number: pr.number,
|
||||
body: cherryPickCmd
|
||||
});
|
||||
});
|
||||
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
@@ -12,57 +12,23 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: Github Robot for Cherry Pick On Comment
|
||||
|
||||
name: Github Rebot for Cherry Pick On Comment
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
cherry-pick:
|
||||
name: Cherry Pick
|
||||
# && github.event.comment.user.login=='kubbot'
|
||||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/cherry-pick')
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout the latest code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
fetch-depth: 0 # To ensure all history is available for cherry-picking
|
||||
|
||||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
||||
- name: Automatic Cherry Pick
|
||||
uses: vendoo/gha-cherry-pick@v1
|
||||
with:
|
||||
# Assuming the cherry-pick commit SHA is passed in the comment like '/cherry-pick sha'
|
||||
commit-sha: ${{ github.event.comment.body }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
|
||||
- name: Create a new branch for PR
|
||||
run: |
|
||||
PR_BRANCH="cherry-pick-${GITHUB_SHA}-to-${{ github.base_ref }}"
|
||||
git checkout -b $PR_BRANCH
|
||||
git push origin $PR_BRANCH
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: actions/github-script@v5
|
||||
with:
|
||||
script: |
|
||||
const prTitle = "Cherry-pick to ${{ github.base_ref }}"
|
||||
const prBody = "Automated cherry-pick of ${{ github.event.comment.body }}\n\n/cc @kubbot"
|
||||
const base = "${{ github.base_ref }}"
|
||||
const head = "cherry-pick-${{ github.sha }}-to-${{ github.base_ref }}"
|
||||
const createPr = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: prTitle,
|
||||
body: prBody,
|
||||
head: head,
|
||||
base: base,
|
||||
maintainer_can_modify: true, // Allows maintainers to edit the PR
|
||||
})
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
# docker.io/openim/openim-server:latest
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: openim/openim-server
|
||||
# generate Docker tags based on the following events/attributes
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
# registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta2
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server
|
||||
# generate Docker tags based on the following events/attributes
|
||||
@@ -130,7 +130,7 @@ jobs:
|
||||
# ghcr.io/openimsdk/openim-server:latest
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta3
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: ghcr.io/openimsdk/openim-server
|
||||
# generate Docker tags based on the following events/attributes
|
||||
|
||||
@@ -56,4 +56,4 @@ jobs:
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload Coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@v3
|
||||
|
||||
@@ -33,7 +33,7 @@ env:
|
||||
OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md
|
||||
OPEN_IM_SERVER_SIGNATURES_PATH: signatures/${{ github.event.repository.name }}/cla.json
|
||||
|
||||
OPEN_IM_SERVER_ALLOWLIST: kubbot,openimbot,bot*,dependabot,sweep-ai,*bot,bot-*,bot/*,bot-/*,bot,*[bot]
|
||||
OPEN_IM_SERVER_ALLOWLIST: kubbot,bot*,bot-*,bot/*,bot-/*,bot,*[bot]
|
||||
|
||||
jobs:
|
||||
CLAAssistant:
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# 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.
|
||||
|
||||
name: Language Check Workflow Test
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
comment-language-detector:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Code Language Detector
|
||||
uses: kubecub/comment-lang-detector@v1.0.0
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
uses: github/codeql-action/init@v2
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
languages: go
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below).
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
@@ -73,4 +73,4 @@ jobs:
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
uses: github/codeql-action/analyze@v2
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
|
||||
- name: Push CHANGELOG to Main
|
||||
if: steps.create-and-commit-changelog.outputs.changes == 'true'
|
||||
uses: ad-m/github-push-action@v0.8.0
|
||||
uses: ad-m/github-push-action@v0.6.0
|
||||
with:
|
||||
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
branch: main
|
||||
|
||||
@@ -15,4 +15,4 @@ jobs:
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@v4
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@v4
|
||||
uses: actions/dependency-review-action@v3
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
install: true
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
@@ -100,22 +100,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-api
|
||||
id: meta1
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -131,22 +121,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-cmdutils
|
||||
id: meta2
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -162,22 +142,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-crontask
|
||||
id: meta3
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -193,22 +163,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-msggateway
|
||||
id: meta4
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -224,22 +184,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-msgtransfer
|
||||
id: meta5
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -255,22 +205,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-push
|
||||
id: meta6
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -286,22 +226,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-rpc-auth
|
||||
id: meta7
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -317,22 +247,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-rpc-conversation
|
||||
id: meta8
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -348,22 +268,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-rpc-friend
|
||||
id: meta9
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -379,22 +289,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-rpc-group
|
||||
id: meta10
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -410,22 +310,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-rpc-msg
|
||||
id: meta11
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -441,22 +331,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-rpc-third
|
||||
id: meta12
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
@@ -472,22 +352,12 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker openim-rpc-user
|
||||
id: meta13
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
uses: docker/metadata-action@v5.0.0
|
||||
with:
|
||||
images: |
|
||||
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
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
name: OpenIM E2E And API Test
|
||||
name: OpenIM Linux System E2E Test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.21
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.21
|
||||
id: go
|
||||
@@ -60,7 +60,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
id: go
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
sudo make tidy
|
||||
sudo make tools.verify.go-gitlint
|
||||
|
||||
- name: Build, Start(make build && make start)
|
||||
- name: Build, Start
|
||||
run: |
|
||||
sudo ./scripts/install/install.sh -i
|
||||
|
||||
@@ -90,48 +90,14 @@ jobs:
|
||||
run: |
|
||||
sudo ./scripts/install/install.sh -s
|
||||
|
||||
- name: Exec OpenIM API test (make test-api)
|
||||
- name: Exec OpenIM API test
|
||||
run: |
|
||||
mkdir -p ./tmp
|
||||
touch ./tmp/test.md
|
||||
echo "# OpenIM Test" >> ./tmp/test.md
|
||||
echo "## OpenIM API Test" >> ./tmp/test.md
|
||||
echo "<details><summary>Command Output for OpenIM API Test</summary>" >> ./tmp/test.md
|
||||
echo "<pre><code>" >> ./tmp/test.md
|
||||
sudo make test-api | tee -a ./tmp/test.md
|
||||
echo "</code></pre>" >> ./tmp/test.md
|
||||
echo "</details>" >> ./tmp/test.md
|
||||
|
||||
sudo make test-api
|
||||
|
||||
- name: Exec OpenIM E2E Test (make test-e2e)
|
||||
|
||||
- name: Exec OpenIM E2E test
|
||||
run: |
|
||||
echo "" >> ./tmp/test.md
|
||||
echo "## OpenIM E2E Test" >> ./tmp/test.md
|
||||
echo "<details><summary>Command Output for OpenIM E2E Test</summary>" >> ./tmp/test.md
|
||||
echo "<pre><code>" >> ./tmp/test.md
|
||||
sudo make test-e2e | tee -a ./tmp/test.md
|
||||
echo "</code></pre>" >> ./tmp/test.md
|
||||
echo "</details>" >> ./tmp/test.md
|
||||
|
||||
sudo make test-e2e
|
||||
|
||||
- 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: |
|
||||
sudo ./scripts/install/install.sh -u
|
||||
@@ -145,4 +111,4 @@ jobs:
|
||||
PUBLISH_BRANCH: gh-pages
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
continue-on-error: true
|
||||
continue-on-error: true
|
||||
@@ -24,14 +24,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.21'
|
||||
cache: false
|
||||
- name: OpenIM Scripts Verification(make verify)
|
||||
run: sudo make verify
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v4.0.0
|
||||
uses: golangci/golangci-lint-action@v3.7.0
|
||||
with:
|
||||
# Require: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
||||
version: v1.54
|
||||
@@ -49,4 +47,4 @@ jobs:
|
||||
only-new-issues: true
|
||||
|
||||
# Optional:The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
|
||||
# install-mode: "goinstall"
|
||||
# install-mode: "goinstall"
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/first-interaction@v1.3.0
|
||||
- uses: actions/first-interaction@v1.2.0
|
||||
with:
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
pr-message: |
|
||||
|
||||
@@ -17,7 +17,6 @@ on:
|
||||
issues:
|
||||
types:
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
add-comment:
|
||||
if: github.event.label.name == 'help wanted' || github.event.label.name == 'good first issue'
|
||||
@@ -26,7 +25,7 @@ jobs:
|
||||
issues: write
|
||||
steps:
|
||||
- name: Add comment
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
|
||||
- name: Link Checker
|
||||
id: lychee
|
||||
uses: lycheeverse/lychee-action@v1.9.3
|
||||
uses: lycheeverse/lychee-action@v1.8.0
|
||||
with:
|
||||
# For parameter description, see https://github.com/lycheeverse/lychee#commandline-parameters
|
||||
# Actions Link address -> https://github.com/lycheeverse/lychee-action
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
|
||||
- name: Create Issue From File
|
||||
if: env.lychee_exit_code != 0
|
||||
uses: peter-evans/create-issue-from-file@v5
|
||||
uses: peter-evans/create-issue-from-file@v4
|
||||
with:
|
||||
title: Bug reports for links in OpenIM docs
|
||||
content-filepath: ./lychee/out.md
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v5
|
||||
- uses: dessant/lock-threads@v4
|
||||
with:
|
||||
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
issue-inactive-days: '365'
|
||||
|
||||
@@ -39,9 +39,8 @@ jobs:
|
||||
statuses: none
|
||||
|
||||
steps:
|
||||
- uses: actions/github-script@v7 # v6
|
||||
- uses: actions/github-script@v6 # v6
|
||||
with:
|
||||
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
if (!context.payload.pull_request.merged) {
|
||||
console.log('PR was not merged, skipping.');
|
||||
@@ -57,10 +56,9 @@ jobs:
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'open',
|
||||
sort: 'title',
|
||||
direction: 'desc'
|
||||
sort: 'due_on',
|
||||
direction: 'asc'
|
||||
})
|
||||
|
||||
if (milestones.data.length === 0) {
|
||||
console.log('There are no milestones, skipping.');
|
||||
return;
|
||||
|
||||
@@ -28,10 +28,10 @@ jobs:
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Setup Node.js Environment
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: di-sukharev/opencommit@github-action-v1.0.4
|
||||
|
||||
@@ -18,48 +18,45 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release-*
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "README.md"
|
||||
- "README_zh-CN.md"
|
||||
- "**.md"
|
||||
- "docs/**"
|
||||
- "CONTRIBUTING.md"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- release-*
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
- "README_zh-CN.md"
|
||||
- "CONTRIBUTING/**"
|
||||
- "**.md"
|
||||
- "CONTRIBUTING.md"
|
||||
- "docs/**"
|
||||
|
||||
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
|
||||
|
||||
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
id: go
|
||||
@@ -70,9 +67,6 @@ jobs:
|
||||
version: '3.x' # If available, use the latest major version that's compatible
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Code Typecheck Detector
|
||||
uses: kubecub/typecheck@main
|
||||
|
||||
- name: Module Operations
|
||||
run: |
|
||||
sudo make tidy
|
||||
@@ -89,14 +83,16 @@ jobs:
|
||||
- name: Build Source
|
||||
run: sudo make build
|
||||
|
||||
- name: Build multiarch PLATFORMS
|
||||
if: startsWith(github.ref, 'refs/heads/release-')
|
||||
run: |
|
||||
sudo make multiarch
|
||||
|
||||
- name: Cleanup Build
|
||||
run: sudo make clean
|
||||
|
||||
- name: Push Changes to Main
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "cicd: robot automated Change"
|
||||
branch: main
|
||||
continue-on-error: true
|
||||
|
||||
- name: Set Current Directory
|
||||
id: set_directory
|
||||
run: echo "::set-output name=directory::$(pwd)"
|
||||
@@ -113,11 +109,8 @@ jobs:
|
||||
continue-on-error: true
|
||||
|
||||
openim-start:
|
||||
name: Test OpenIM install/start on ${{ matrix.os }}-${{ matrix.arch }}
|
||||
name: Test OpenIM install/start on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
environment:
|
||||
name: openim
|
||||
strategy:
|
||||
@@ -136,65 +129,21 @@ jobs:
|
||||
run: |
|
||||
sudo make install
|
||||
|
||||
# - name: Check the OpenIM environment and status
|
||||
# run: |
|
||||
# sudo docker images
|
||||
# sudo docker ps
|
||||
|
||||
- name: Check the OpenIM environment and status
|
||||
if: runner.os == 'Linux' && matrix.arch == 'amd64'
|
||||
id: docker_info
|
||||
run: |
|
||||
sleep 30
|
||||
echo "images<<EOF" >> $GITHUB_ENV
|
||||
sudo docker images >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
echo "containers<<EOF" >> $GITHUB_ENV
|
||||
sudo docker ps >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Comment PR
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
if: runner.os == 'Linux' && matrix.arch == 'amd64'
|
||||
with:
|
||||
message: |
|
||||
> [!TIP]
|
||||
> Run make install to check the status
|
||||
|
||||
### Docker Images:
|
||||
<details><summary>Click to expand docker images</summary>
|
||||
```bash
|
||||
${{ env.images }}
|
||||
```
|
||||
</details>
|
||||
|
||||
### Docker Processes:
|
||||
<details><summary>Click to expand docker ps</summary>
|
||||
```bash
|
||||
${{ env.containers }}
|
||||
```
|
||||
</details>
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
|
||||
execute-scripts:
|
||||
name: Execute OpenIM Script On ${{ matrix.os }}-${{ matrix.arch }}
|
||||
name: Execute OpenIM Script On ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
environment:
|
||||
name: openim
|
||||
strategy:
|
||||
matrix:
|
||||
go_version: ["1.21"]
|
||||
go_version: ["1.20"]
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
arch: [arm64, armv7, amd64]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
id: go
|
||||
@@ -206,7 +155,7 @@ jobs:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# - name: Install latest Bash (macOS only)
|
||||
# if: runner.os == 'macOS' && matrix.arch == 'arm64'
|
||||
# if: runner.os == 'macOS'
|
||||
# run: |
|
||||
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
# brew update
|
||||
@@ -226,7 +175,7 @@ jobs:
|
||||
sudo sleep 20
|
||||
|
||||
# - name: Set up Docker for macOS
|
||||
# if: runner.os == 'macOS' && matrix.arch == 'arm64'
|
||||
# if: runner.os == 'macOS'
|
||||
# run: |
|
||||
# brew install --cask docker
|
||||
# open /Applications/Docker.app
|
||||
@@ -252,34 +201,37 @@ 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
|
||||
sudo make init && \
|
||||
sudo make build && \
|
||||
sudo make start && \
|
||||
sudo make check || \
|
||||
(echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null)
|
||||
|
||||
- name: Restart Services and Print Logs for Ubuntu
|
||||
if: runner.os == 'Linux' && matrix.arch == 'amd64'
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo make restart
|
||||
sudo make check
|
||||
|
||||
- name: Build, Start, Check Services and Print Logs for macOS
|
||||
if: runner.os == 'macOS' && matrix.arch == 'arm64'
|
||||
run: |
|
||||
make build
|
||||
# - name: Build, Start, Check Services and Print Logs for macOS
|
||||
# if: runner.os == 'macOS'
|
||||
# run: |
|
||||
# make init && \
|
||||
# make build && \
|
||||
# make start && \
|
||||
# make check || \
|
||||
# (echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null)
|
||||
|
||||
openim-test-build-image:
|
||||
name: Build OpenIM Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
environment:
|
||||
name: openim
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
id: go
|
||||
@@ -294,9 +246,3 @@ jobs:
|
||||
run: |
|
||||
sudo make init
|
||||
sudo make image
|
||||
|
||||
- name: Get OpenIM Docker Images Status
|
||||
id: docker_processes
|
||||
run: |
|
||||
sudo docker images
|
||||
sudo docker ps
|
||||
|
||||
@@ -24,16 +24,13 @@ on:
|
||||
pull_request:
|
||||
types:
|
||||
- assigned
|
||||
branches-ignore:
|
||||
- 'asf-auto-updates'
|
||||
- 'ignore'
|
||||
|
||||
jobs:
|
||||
move-assigned-card:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: alex-page/github-project-automation-plus@v0.9.0
|
||||
- uses: alex-page/github-project-automation-plus@v0.8.3
|
||||
with:
|
||||
project: openim-powerful
|
||||
column: In Progress
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
@@ -14,6 +14,12 @@
|
||||
|
||||
name: Github Pull Request
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'CONTRIBUTING.md'
|
||||
- 'docs/**'
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
@@ -31,18 +37,24 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get League branch Patch
|
||||
run: |
|
||||
git config user.name 'openimbot'
|
||||
git config user.email 'openimsdk@qq.com'
|
||||
BRANCH_NAME="auto-pr-$(date +'%Y%m%d%H%M%S')"
|
||||
git checkout -b $BRANCH_NAME
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v4
|
||||
- name: Run go modules tidy
|
||||
run: |
|
||||
sudo apt-get install jq
|
||||
sudo make tidy
|
||||
sudo make tools.verify.go-gitlint
|
||||
echo "Run go modules tidy successfully"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run go format and lint
|
||||
- name: Run go format
|
||||
run: |
|
||||
sudo make format
|
||||
echo "Run go format successfully"
|
||||
@@ -57,32 +69,7 @@ jobs:
|
||||
- name: Generate all necessary files, such as error code files
|
||||
run: |
|
||||
make generate
|
||||
echo "Generate all necessary files successfully"
|
||||
continue-on-error: true
|
||||
|
||||
- name: make init
|
||||
run: |
|
||||
export OPENIM_IP=127.0.0.1
|
||||
export LOG_STORAGE_LOCATION="../logs/"
|
||||
./scripts/init-config.sh --examples --force
|
||||
echo "Generate all necessary files successfully"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Generate Vertions
|
||||
run: |
|
||||
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
||||
echo $latest_tag > pkg/common/config/version
|
||||
continue-on-error: true
|
||||
|
||||
- name: Gen CHANGELOG file
|
||||
run: |
|
||||
current_tag=$(git describe --tags --abbrev=0)
|
||||
version=$(echo "$current_tag" | sed -E 's/^v?([0-9]+)\.([0-9]+)\..*$/\1.\2/')
|
||||
echo "OpenIM Version: $version"
|
||||
make tools.install.git-chglog
|
||||
cd CHANGELOG
|
||||
git-chglog --tag-filter-pattern "v${version}.*" -o CHANGELOG-${version}.md
|
||||
cd ..
|
||||
echo "Generate all necessary files successfully"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run unit test and get test coverage
|
||||
@@ -91,39 +78,38 @@ jobs:
|
||||
echo "Run unit test and get test coverage successfully"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
|
||||
- name: OpenIM verify copyright
|
||||
run: |
|
||||
sudo make verify-copyright
|
||||
sudo make add-copyright
|
||||
echo "OpenIM verify successfully"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
commit-message: "cicd: bump League Patch"
|
||||
author: kubbot <3293172751ysy@gmail.com>
|
||||
committer: kubbot <3293172751ysy@gmail.com>
|
||||
# signoff: false
|
||||
# draft: false
|
||||
branch: "asf-auto-updates"
|
||||
author: kubbot <kubbot@3293172751ysy@gmail.com>
|
||||
signoff: false
|
||||
draft: false
|
||||
branch: ''
|
||||
assignees: cubxxw
|
||||
reviewers: cubxxw
|
||||
title: "[Auto PR 🤖] Bump League Patch auto PR"
|
||||
delete-branch: true
|
||||
title: "Bump League Patch auto PR: $(date +'%Y%m%d')"
|
||||
body: |
|
||||
I am a PR generated by robot automation.
|
||||
|
||||
Review criteria:
|
||||
|
||||
- [ ] Disenchanter can connect and issue actions
|
||||
|
||||
Github Actions Status:
|
||||
|
||||
[](https://github.com/openimsdk/open-im-server/actions/workflows/pull-request.yml)
|
||||
|
||||
This is an automated PR.
|
||||
This is an automated PR. @ $(date +'%Y%m%d')
|
||||
<sub>[workflow](https://github.com/openimsdk/open-im-server/blob/main/.github/workflows/pull-request.yml).</sub>
|
||||
base: main
|
||||
labels: |
|
||||
kind/documentation
|
||||
enhancement
|
||||
report
|
||||
report
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
|
||||
|
||||
# Drafts your next Release notes as Pull Requests are merged into "master"
|
||||
- uses: release-drafter/release-drafter@v6
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
|
||||
# with:
|
||||
# config-name: my-config.yml
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: git fetch --force --tags
|
||||
- uses: actions/setup-go@v5
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: stable
|
||||
# More assembly might be required: Docker logins, GPG, etc. It all depends
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
version: 3.x
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: docker/setup-qemu-action@326560df218a7ea9cf6ab49bbc88b8b306bb437e # v2
|
||||
- uses: actions/cache@a2ed59d39b352305bdd2f628719a53b2cc4f9613 # v3
|
||||
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
|
||||
with:
|
||||
path: |
|
||||
./_output/dist/*.deb
|
||||
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@v8
|
||||
with:
|
||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
days-before-stale: 60
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
# https://github.com/BetaHuhn/repo-file-sync-action
|
||||
name: Synchronize OpenIM Release Branch Public Code To Other Repositories
|
||||
name: Synchronize kubecub public code to other repositories
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
@@ -41,4 +41,3 @@ jobs:
|
||||
automerge
|
||||
ASSIGNEES: |
|
||||
kubbot
|
||||
continue-on-error: true
|
||||
@@ -3,7 +3,7 @@
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
# https://github.com/BetaHuhn/repo-file-sync-action
|
||||
name: Synchronize OpenIM Main Branch Public Code To Other Repositories
|
||||
name: Synchronize kubecub public code to other repositories
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -36,5 +36,4 @@ jobs:
|
||||
file-sync
|
||||
automerge
|
||||
ASSIGNEES: |
|
||||
kubbot
|
||||
continue-on-error: true
|
||||
kubbot
|
||||
@@ -34,7 +34,6 @@ deployments/charts/generated-configs/
|
||||
### OpenIM Config ###
|
||||
.env
|
||||
config/config.yaml
|
||||
config/openim.yaml
|
||||
config/alertmanager.yml
|
||||
config/prometheus.yml
|
||||
config/email.tmpl
|
||||
|
||||
+18
-48
@@ -40,14 +40,10 @@ run:
|
||||
# "/" will be replaced by current OS file path separator to properly work
|
||||
# on Windows.
|
||||
skip-dirs:
|
||||
- components
|
||||
- docs
|
||||
- util
|
||||
- .*~
|
||||
- api/swagger/docs
|
||||
- server/docs
|
||||
- components/mnt/config/certs
|
||||
- logs
|
||||
|
||||
# default is true. Enables skipping of directories:
|
||||
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
|
||||
@@ -62,12 +58,6 @@ run:
|
||||
skip-files:
|
||||
- ".*\\.my\\.go$"
|
||||
- _test.go
|
||||
- ".*_test.go"
|
||||
- "mocks/"
|
||||
- ".github/"
|
||||
- "logs/"
|
||||
- "_output/"
|
||||
- "components/"
|
||||
|
||||
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
|
||||
# If invoked with -mod=readonly, the go command is disallowed from the implicit
|
||||
@@ -118,6 +108,7 @@ linters-settings:
|
||||
right-to-left-isolate: true
|
||||
first-strong-isolate: true
|
||||
pop-directional-isolate: true
|
||||
dogsled:
|
||||
# checks assignments with too many blank identifiers; default is 2
|
||||
max-blank-identifiers: 2
|
||||
dupl:
|
||||
@@ -140,8 +131,8 @@ linters-settings:
|
||||
|
||||
# path to a file containing a list of functions to exclude from checking
|
||||
# see https://github.com/kisielk/errcheck#excluding-functions for details
|
||||
# exclude: errcheck.txt
|
||||
|
||||
#exclude: errcheck.txt
|
||||
|
||||
errorlint:
|
||||
# Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
|
||||
errorf: true
|
||||
@@ -427,7 +418,7 @@ linters-settings:
|
||||
|
||||
govet:
|
||||
# report about shadowed variables
|
||||
check-shadowing: false
|
||||
check-shadowing: true
|
||||
|
||||
# settings per analyzer
|
||||
settings:
|
||||
@@ -498,9 +489,9 @@ linters-settings:
|
||||
- github.com\/user\/package\/v4\.Type
|
||||
|
||||
lll:
|
||||
# max line length, lines longer will be reported. Default is 250.
|
||||
# max line length, lines longer will be reported. Default is 120.
|
||||
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
||||
line-length: 250
|
||||
line-length: 240
|
||||
# tab width in spaces. Default to 1.
|
||||
tab-width: 4
|
||||
maligned:
|
||||
@@ -724,33 +715,17 @@ linters:
|
||||
# enable-all: true
|
||||
disable-all: true
|
||||
enable:
|
||||
- typecheck # Basic type checking
|
||||
- gofmt # Format check
|
||||
- govet # Go's standard linting tool
|
||||
- gosimple # Suggestions for simplifying code
|
||||
- errcheck
|
||||
- decorder
|
||||
- ineffassign
|
||||
- revive
|
||||
- reassign
|
||||
- tparallel
|
||||
- unconvert
|
||||
- dupl
|
||||
- dupword
|
||||
- errname
|
||||
- gci
|
||||
- goheader
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- misspell # Spelling mistakes
|
||||
- staticcheck # Static analysis
|
||||
- unused # Checks for unused code
|
||||
# - goimports # Checks if imports are correctly sorted and formatted
|
||||
- godot # Checks for comment punctuation
|
||||
- bodyclose # Ensures HTTP response body is closed
|
||||
- stylecheck # Style checker for Go code
|
||||
- unused # Checks for unused code
|
||||
- errcheck # Checks for missed error returns
|
||||
- typecheck # 基本的类型检查
|
||||
- gofmt # 格式检查
|
||||
- govet # Go 语言的标准检查工具
|
||||
- gosimple # 简化代码的建议
|
||||
- misspell # 拼写错误
|
||||
- staticcheck # 静态检查
|
||||
- unused # 未使用的代码检查
|
||||
- goimports # 检查导入是否正确排序和格式化
|
||||
- godot # 注释句点检查
|
||||
- bodyclose # 确保 HTTP response body 被关闭
|
||||
- errcheck # 检查是否遗漏了错误返回值
|
||||
fast: true
|
||||
|
||||
issues:
|
||||
@@ -817,11 +792,6 @@ issues:
|
||||
- lll
|
||||
source: "^//go:generate "
|
||||
|
||||
- text: ".*[\u4e00-\u9fa5]+.*"
|
||||
linters:
|
||||
- golint
|
||||
source: "^//.*$"
|
||||
|
||||
# Independently from option `exclude` we use default exclude patterns,
|
||||
# it can be disabled by this option. To list all
|
||||
# excluded by default patterns execute `golangci-lint run --help`.
|
||||
@@ -882,4 +852,4 @@ severity:
|
||||
rules:
|
||||
- linters:
|
||||
- dupl
|
||||
severity: info
|
||||
severity: info
|
||||
@@ -1,32 +0,0 @@
|
||||
# Version logging for OpenIM
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
||||
|
||||
<!-- END MUNGE: GENERATED_TOC -->
|
||||
|
||||
<a name="unreleased"></a>
|
||||
## [Unreleased]
|
||||
|
||||
|
||||
<a name="v3.4.2"></a>
|
||||
## [v3.4.2] - 2023-12-14
|
||||
|
||||
<a name="v3.4.0"></a>
|
||||
## [v3.4.0] - 2023-11-10
|
||||
|
||||
<a name="v3.4.0-rc.1"></a>
|
||||
## [v3.4.0-rc.1] - 2023-11-09
|
||||
|
||||
<a name="v3.4.0-rc.0"></a>
|
||||
## v3.4.0-rc.0 - 2023-11-09
|
||||
### Reverts
|
||||
- update etcd to v3.5.2 ([#206](https://github.com/openimsdk/open-im-server/issues/206))
|
||||
|
||||
### Pull Requests
|
||||
- Merge branch 'tuoyun'
|
||||
|
||||
|
||||
[Unreleased]: https://github.com/openimsdk/open-im-server/compare/v3.4.2...HEAD
|
||||
[v3.4.2]: https://github.com/openimsdk/open-im-server/compare/v3.4.0...v3.4.2
|
||||
[v3.4.0]: https://github.com/openimsdk/open-im-server/compare/v3.4.0-rc.1...v3.4.0
|
||||
[v3.4.0-rc.1]: https://github.com/openimsdk/open-im-server/compare/v3.4.0-rc.0...v3.4.0-rc.1
|
||||
@@ -1,84 +0,0 @@
|
||||
# Version logging for OpenIM
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
||||
|
||||
<!-- END MUNGE: GENERATED_TOC -->
|
||||
|
||||
<a name="unreleased"></a>
|
||||
## [Unreleased]
|
||||
|
||||
|
||||
<a name="v3.5.1-alpha.2"></a>
|
||||
## [v3.5.1-alpha.2] - 2024-01-26
|
||||
|
||||
<a name="v3.5.1-rc.1"></a>
|
||||
## [v3.5.1-rc.1] - 2024-01-23
|
||||
|
||||
<a name="v3.5.1-alpha.1"></a>
|
||||
## [v3.5.1-alpha.1] - 2024-01-09
|
||||
|
||||
<a name="v3.5.0"></a>
|
||||
## [v3.5.0] - 2024-01-02
|
||||
|
||||
<a name="v3.5.1"></a>
|
||||
## [v3.5.1] - 2024-01-02
|
||||
|
||||
<a name="v3.5.1-bate.1"></a>
|
||||
## [v3.5.1-bate.1] - 2024-01-02
|
||||
|
||||
<a name="v3.5.1-rc.0"></a>
|
||||
## [v3.5.1-rc.0] - 2023-12-30
|
||||
|
||||
<a name="v3.5.0-rc.8"></a>
|
||||
## [v3.5.0-rc.8] - 2023-12-28
|
||||
|
||||
<a name="v3.5.0-rc.7"></a>
|
||||
## [v3.5.0-rc.7] - 2023-12-18
|
||||
|
||||
<a name="v3.5.0-rc.6"></a>
|
||||
## [v3.5.0-rc.6] - 2023-12-15
|
||||
|
||||
<a name="v3.5.0-rc.5"></a>
|
||||
## [v3.5.0-rc.5] - 2023-12-15
|
||||
|
||||
<a name="v3.5.0-rc.4"></a>
|
||||
## [v3.5.0-rc.4] - 2023-12-14
|
||||
|
||||
<a name="v3.5.0-rc.3"></a>
|
||||
## [v3.5.0-rc.3] - 2023-12-14
|
||||
|
||||
<a name="v3.5.0-rc.2"></a>
|
||||
## [v3.5.0-rc.2] - 2023-12-14
|
||||
|
||||
<a name="v3.5.0-rc.1"></a>
|
||||
## [v3.5.0-rc.1] - 2023-12-14
|
||||
|
||||
<a name="v3.5.0-rc.0"></a>
|
||||
## [v3.5.0-rc.0] - 2023-12-14
|
||||
|
||||
<a name="v3.5.0-beta.1"></a>
|
||||
## v3.5.0-beta.1 - 2023-11-29
|
||||
### Reverts
|
||||
- update etcd to v3.5.2 ([#206](https://github.com/openimsdk/open-im-server/issues/206))
|
||||
|
||||
### Pull Requests
|
||||
- Merge branch 'tuoyun'
|
||||
|
||||
|
||||
[Unreleased]: https://github.com/openimsdk/open-im-server/compare/v3.5.1-alpha.2...HEAD
|
||||
[v3.5.1-alpha.2]: https://github.com/openimsdk/open-im-server/compare/v3.5.1-rc.1...v3.5.1-alpha.2
|
||||
[v3.5.1-rc.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.1-alpha.1...v3.5.1-rc.1
|
||||
[v3.5.1-alpha.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.0...v3.5.1-alpha.1
|
||||
[v3.5.0]: https://github.com/openimsdk/open-im-server/compare/v3.5.1...v3.5.0
|
||||
[v3.5.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.1-bate.1...v3.5.1
|
||||
[v3.5.1-bate.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.1-rc.0...v3.5.1-bate.1
|
||||
[v3.5.1-rc.0]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.8...v3.5.1-rc.0
|
||||
[v3.5.0-rc.8]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.7...v3.5.0-rc.8
|
||||
[v3.5.0-rc.7]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.6...v3.5.0-rc.7
|
||||
[v3.5.0-rc.6]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.5...v3.5.0-rc.6
|
||||
[v3.5.0-rc.5]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.4...v3.5.0-rc.5
|
||||
[v3.5.0-rc.4]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.3...v3.5.0-rc.4
|
||||
[v3.5.0-rc.3]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.2...v3.5.0-rc.3
|
||||
[v3.5.0-rc.2]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.1...v3.5.0-rc.2
|
||||
[v3.5.0-rc.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.0...v3.5.0-rc.1
|
||||
[v3.5.0-rc.0]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-beta.1...v3.5.0-rc.0
|
||||
@@ -1,20 +0,0 @@
|
||||
# Version logging for OpenIM
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
||||
|
||||
<!-- END MUNGE: GENERATED_TOC -->
|
||||
|
||||
<a name="unreleased"></a>
|
||||
## [Unreleased]
|
||||
|
||||
|
||||
<a name="v3.6.0"></a>
|
||||
## v3.6.0 - 2024-03-07
|
||||
### Reverts
|
||||
- update etcd to v3.5.2 ([#206](https://github.com/openimsdk/open-im-server/issues/206))
|
||||
|
||||
### Pull Requests
|
||||
- Merge branch 'tuoyun'
|
||||
|
||||
|
||||
[Unreleased]: https://github.com/openimsdk/open-im-server/compare/v3.6.0...HEAD
|
||||
@@ -1,33 +0,0 @@
|
||||
# How do I contribute code to OpenIM
|
||||
|
||||
<p align="center">
|
||||
<a href="./CONTRIBUTING.md">Englist</a> ·
|
||||
<a href="./CONTRIBUTING-zh_CN.md">中文</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-UA.md">Українська</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-CS.md">Česky</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-HU.md">Magyar</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ES.md">Español</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FA.md">فارسی</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FR.md">Français</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-DE.md">Deutsch</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-PL.md">Polski</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ID.md">Indonesian</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FI.md">Suomi</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ML.md">മലയാളം</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-JP.md">日本語</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-NL.md">Nederlands</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-IT.md">Italiano</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-RU.md">Русский</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-PTBR.md">Português (Brasil)</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-EO.md">Esperanto</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-KR.md">한국어</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-AR.md">العربي</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-VN.md">Tiếng Việt</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-DA.md">Dansk</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-GR.md">Ελληνικά</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-TR.md">Türkçe</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</p>
|
||||
+45
-164
@@ -1,38 +1,6 @@
|
||||
# How do I contribute code to OpenIM
|
||||
# Contributing to Open-IM-Server
|
||||
|
||||
<p align="center">
|
||||
<a href="./CONTRIBUTING.md">Englist</a> ·
|
||||
<a href="./CONTRIBUTING-zh_CN.md">中文</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-UA.md">Українська</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-CS.md">Česky</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-HU.md">Magyar</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ES.md">Español</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FA.md">فارسی</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FR.md">Français</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-DE.md">Deutsch</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-PL.md">Polski</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ID.md">Indonesian</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FI.md">Suomi</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ML.md">മലയാളം</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-JP.md">日本語</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-NL.md">Nederlands</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-IT.md">Italiano</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-RU.md">Русский</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-PTBR.md">Português (Brasil)</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-EO.md">Esperanto</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-KR.md">한국어</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-AR.md">العربي</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-VN.md">Tiếng Việt</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-DA.md">Dansk</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-GR.md">Ελληνικά</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-TR.md">Türkçe</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</p>
|
||||
|
||||
So, you want to hack on open-im-server? Yay!
|
||||
So, you want to hack on Open-IM-Server? Yay!
|
||||
|
||||
First of all, thank you for considering contributing to our project! We appreciate your time and effort, and we value any contribution, whether it's reporting a bug, suggesting a new feature, or submitting a pull request.
|
||||
|
||||
@@ -44,7 +12,7 @@ This document provides guidelines and best practices to help you contribute effe
|
||||
|
||||
## 📇Topics
|
||||
|
||||
- [How do I contribute code to OpenIM](#how-do-i-contribute-code-to-openim)
|
||||
- [Contributing to Open-IM-Server](#contributing-to-open-im-server)
|
||||
- [📇Topics](#topics)
|
||||
- [What we expect of you](#what-we-expect-of-you)
|
||||
- [Code of ConductCode of Conduct](#code-of-conductcode-of-conduct)
|
||||
@@ -64,13 +32,13 @@ This document provides guidelines and best practices to help you contribute effe
|
||||
|
||||
## What we expect of you
|
||||
|
||||
We hope that anyone can join open-im-server , even if you are a student, writer, translator
|
||||
We hope that anyone can join Open-IM-Server , even if you are a student, writer, translator
|
||||
|
||||
Please meet the minimum version of the Go language published in [go.mod](./go.mod). If you want to manage the Go language version, we provide tools tHow do I contribute code to OpenIMo install [gvm](https://github.com/moovweb/gvm) in our [Makefile](./Makefile)
|
||||
Please meet the minimum version of the Go language published in [go.mod](./go.mod). If you want to manage the Go language version, we provide tools to install [gvm](https://github.com/moovweb/gvm) in our [Makefile](./Makefile)
|
||||
|
||||
You'd better use Linux OR WSL as the development environment, Linux with [Makefile](./Makefile) can help you quickly build and test open-im-server project.
|
||||
You'd better use Linux OR WSL as the development environment, Linux with [Makefile](./Makefile) can help you quickly build and test Open-IM-Server project.
|
||||
|
||||
If you are familiar with [Makefile](./Makefile) , you can easily see the clever design of the open-im-server Makefile. Storing the necessary tools such as golangci in the `/tools` directory can avoid some tool version issues.
|
||||
If you are familiar with [Makefile](./Makefile) , you can easily see the clever design of the Open-IM-Server Makefile. Storing the necessary tools such as golangci in the `/tools` directory can avoid some tool version issues.
|
||||
|
||||
The [Makefile](./Makefile) is for every developer, even if you don't know how to use the Makefile tool, don't worry, we provide two great commands to get you up to speed with the Makefile architecture, `make help` and `make help-all`, it can reduce problems of the developing environment.
|
||||
|
||||
@@ -84,7 +52,7 @@ In accordance with the naming conventions adopted by OpenIM and drawing referenc
|
||||
|
||||
#### Code and doc contribution
|
||||
|
||||
Every action to make project open-im-server better is encouraged. On GitHub, every improvement for open-im-server could be via a [PR](https://github.com/openimsdk/open-im-server/pulls) (short for pull request).
|
||||
Every action to make project Open-IM-Server better is encouraged. On GitHub, every improvement for Open-IM-Server could be via a [PR](https://github.com/openimsdk/open-im-server/pulls) (short for pull request).
|
||||
|
||||
+ If you find a typo, try to fix it!
|
||||
+ If you find a bug, try to fix it!
|
||||
@@ -99,8 +67,8 @@ Every action to make project open-im-server better is encouraged. On GitHub, eve
|
||||
|
||||
#### Where should I start?
|
||||
|
||||
+ If you are new to the project, don't know how to contribute open-im-server, please check out the [good first issue](https://github.com/openimsdk/open-im-server/issues?q=is%3Aopen+label%3A"good+first+issue"+sort%3Aupdated-desc) label.
|
||||
+ You should be good at filtering the open-im-server issue tags and finding the ones you like, such as [RFC](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) for big initiatives, features for [feature](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+label%3Afeature) proposals, and [bug](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+label%3Abug+) fixes.
|
||||
+ If you are new to the project, don't know how to contribute Open-IM-Server, please check out the [good first issue](https://github.com/openimsdk/open-im-server/issues?q=is%3Aopen+label%3A"good+first+issue"+sort%3Aupdated-desc) label.
|
||||
+ You should be good at filtering the Open-IM-Server issue tags and finding the ones you like, such as [RFC](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) for big initiatives, features for [feature](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+label%3Afeature) proposals, and [bug](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+label%3Abug+) fixes.
|
||||
+ If you are looking for something to work on, check out our [open issues](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc).
|
||||
+ If you have an idea for a new feature, please [open an issue](https://github.com/openimsdk/open-im-server/issues/new/choose), and we can discuss it.
|
||||
|
||||
@@ -117,7 +85,7 @@ When documenting a new design, we recommend a 2-step approach:
|
||||
1. Use the short-form RFC template to outline your ideas and get early feedback.
|
||||
2. Once you have received sufficient feedback and consensus, you may use the longer-form design doc template to specify and discuss your design in more details.
|
||||
|
||||
In order to contribute a feature to open-im-server you'll need to go through the following steps:
|
||||
In order to contribute a feature to Open-IM-Server you'll need to go through the following steps:
|
||||
|
||||
+ Discuss your idea with the appropriate [working groups](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) on the working group's Slack channel.
|
||||
+ Once there is general agreement that the feature is useful, create a GitHub issue to track the discussion. The issue should include information about the requirements and use cases that it is trying to address.
|
||||
@@ -127,27 +95,13 @@ But keep in mind that there is no guarantee of it being accepted and so it is us
|
||||
|
||||
## Getting Started
|
||||
|
||||
To propose PR for the open-im-server item, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps:
|
||||
To propose PR for the Open-IM-Server item, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps:
|
||||
|
||||
1. Fork the repository(open-im-server)
|
||||
1. Fork the repository(Open-IM-Server)
|
||||
|
||||
2. **CLONE** your own repository to main locally. Use `git clone https://github.com/<your-username>/open-im-server.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make.
|
||||
2. **CLONE** your own repository to main locally. Use `git clone https://github.com/<your-username>/Open-IM-Server.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make.
|
||||
|
||||
3. **Initialize Git Hooks with `make init-githooks`**
|
||||
|
||||
After cloning the repository, it's recommended to set up Git hooks to streamline your workflow and ensure your contributions adhere to OpenIM's community standards. Git hooks are scripts that run automatically every time a particular event occurs in a Git repository, such as before a commit or push. To initialize Git hooks for the OpenIM server repository, use the `make init-githooks` command.
|
||||
|
||||
- **Enabling Git Hooks Mode**: By running `make init-githooks` and entering `1` when prompted, you enable Git hooks mode. This action will generate a series of hooks within the `.git/hooks/` directory. These hooks impose certain checks on your commits and pushes, ensuring they meet the quality and standards expected by the OpenIM community. For instance, commit hooks might enforce a specific commit message format, while push hooks could check for code style or linting issues.
|
||||
|
||||
- **Benefits for First-Time Contributors**: This setup is especially beneficial for new contributors. It guides you to make professional, community-standard-compliant Pull Requests (PRs) and PR descriptions right from your first contribution. By automating checks and balances, it reduces the chances of common mistakes and speeds up the review process.
|
||||
|
||||
- **Disabling Git Hooks**: If for any reason you wish to remove the Git hooks, simply run `make init-githooks` again and enter `2` when prompted. This will delete the existing Git hooks, removing the automatic checks and constraints from your Git operations. However, keep in mind that manually ensuring your contributions adhere to community standards without the aid of Git hooks requires diligence.
|
||||
|
||||
> [!NOTE] Utilizing Git hooks through the `make init-githooks` command is a straightforward yet powerful way to ensure your contributions are consistent and high-quality. It's a step towards fostering a professional and efficient development environment in the OpenIM project.
|
||||
|
||||
|
||||
|
||||
4. **Set Remote** upstream to be `https://github.com/openimsdk/open-im-server.git` using the following two commands:
|
||||
3. **Set Remote** upstream to be `https://github.com/openimsdk/open-im-server.git` using the following two commands:
|
||||
|
||||
```bash
|
||||
❯ git remote add upstream https://github.com/openimsdk/open-im-server.git
|
||||
@@ -158,18 +112,18 @@ To propose PR for the open-im-server item, we assume you have registered a GitHu
|
||||
|
||||
```bash
|
||||
❯ git remote -v
|
||||
origin https://github.com/<your-username>/open-im-server.git (fetch)
|
||||
origin https://github.com/<your-username>/open-im-server.git (push)
|
||||
origin https://github.com/<your-username>/Open-IM-Server.git (fetch)
|
||||
origin https://github.com/<your-username>/Open-IM-Server.git (push)
|
||||
upstream https://github.com/openimsdk/open-im-server.git (fetch)
|
||||
upstream no-pushing (push)
|
||||
```
|
||||
|
||||
Adding this, we can easily synchronize local branches with upstream branches.
|
||||
|
||||
5. Create a new branch for your changes (use a descriptive name, such as `fix-bug-123` or `add-new-feature`).
|
||||
4. Create a new branch for your changes (use a descriptive name, such as `fix-bug-123` or `add-new-feature`).
|
||||
|
||||
```bash
|
||||
❯ cd open-im-server
|
||||
❯ cd Open-IM-Server
|
||||
❯ git fetch upstream
|
||||
❯ git checkout upstream/main
|
||||
```
|
||||
@@ -182,8 +136,7 @@ To propose PR for the open-im-server item, we assume you have registered a GitHu
|
||||
|
||||
Make any change on the `new-branch` then use [Makefile](./Makefile) build and test your codes.
|
||||
|
||||
|
||||
6. **Commit your changes** to your local branch, lint before committing and commit with sign-off
|
||||
5. **Commit your changes** to your local branch, lint before committing and commit with sign-off
|
||||
|
||||
```bash
|
||||
❯ git rebase upstream/main
|
||||
@@ -192,7 +145,7 @@ To propose PR for the open-im-server item, we assume you have registered a GitHu
|
||||
❯ git commit -a -s -m "message for your changes" # -s adds a Signed-off-by trailer
|
||||
```
|
||||
|
||||
7. **Push your branch** to your forked repository, it is recommended to have only one commit for a PR.
|
||||
6. **Push your branch** to your forked repository, it is recommended to have only one commit for a PR.
|
||||
|
||||
```bash
|
||||
# sync up with upstream
|
||||
@@ -224,78 +177,12 @@ To propose PR for the open-im-server item, we assume you have registered a GitHu
|
||||
❯ git rebase upstream/main # rebase the current branch to upstream/main branch
|
||||
❯ git add -A
|
||||
❯ git commit -m -s "feat: feature two"
|
||||
# then create pull request, and merge
|
||||
```
|
||||
|
||||
**Verifying Your Pull Request with `make all` Command**
|
||||
|
||||
Before verifying, you may need to complete the basic deployment of OpenIM to get familiar with the deployment status of OpenIM. Please read [this deployment document](https://docs.openim.io/zh-Hans/guides/gettingStarted/imSourceCodeDeployment), which will tell you how to deploy OpenIM middleware and OpenIM services in detail
|
||||
|
||||
Before submitting your Pull Request (PR), it's crucial to ensure that it passes all the necessary checks and verifications to maintain the quality and integrity of the OpenIM server project. To facilitate this process, we have encapsulated a series of validation steps into the `make all` command.
|
||||
|
||||
- **Purpose of `make all` Command**: The `make all` command serves as a comprehensive pre-PR verification tool. It sequentially executes a variety of tasks designed to scrutinize your changes from multiple angles, ensuring they are ready for submission.
|
||||
|
||||
- **Included Commands**:
|
||||
- `tidy`: Cleans up the module by removing unused dependencies.
|
||||
- `gen`: Generates necessary files from templates or specifications, ensuring that your codebase is up-to-date with its dependencies.
|
||||
- `add-copyright`: Checks for and adds copyright notices to files, ensuring compliance with legal requirements.
|
||||
- `verify`: Verifies the integrity and consistency of the code, dependencies, and various checks.
|
||||
- `test-api`: Runs API tests to ensure that your changes do not break any existing functionality and adhere to the expected behaviors.
|
||||
- `lint`: Analyzes the code for potential stylistic or programming errors, enforcing the project's coding standards.
|
||||
- `cover`: Measures the code coverage of tests, helping you understand how much of the code is being tested.
|
||||
- `restart`: (Optionally) restarts services or applications to ensure that changes are correctly applied and functioning in a live environment.
|
||||
|
||||
- **Executing the Command**: To run the `make all` command, simply navigate to the root directory of your cloned repository in your terminal and execute:
|
||||
```bash
|
||||
make all
|
||||
```
|
||||
This command will sequentially perform all the listed actions, outputting any warnings or errors encountered during the process. It's a vital step to catch any issues early and ensure your contribution meets the quality standards set by the OpenIM community.
|
||||
|
||||
- **Benefits**: By using `make all` for pre-PR verification, you significantly increase the likelihood of your PR being accepted on the first review. It not only demonstrates your commitment to quality but also streamlines the review process by minimizing back-and-forth due to common issues that can be caught automatically.
|
||||
|
||||
|
||||
**Troubleshooting Git Push Failures**
|
||||
|
||||
When working with Git, encountering errors during push operations is not uncommon. Two primary reasons you might face push failures are due to firewall restrictions or authentication issues. Here’s how you can troubleshoot and resolve these problems.
|
||||
|
||||
**Firewall Errors**
|
||||
|
||||
If you're behind a corporate firewall or your network restricts certain types of traffic, you might encounter issues when trying to push your changes via HTTPS. This is because firewalls can block the ports used by the HTTPS protocol. To resolve this issue, you can configure Git to use a proxy.
|
||||
|
||||
If you have a local proxy server set up, you can direct Git to use it by setting the `https_proxy` and `http_proxy` environment variables. Open your terminal or command prompt and run the following commands:
|
||||
|
||||
```bash
|
||||
export https_proxy="http://127.0.0.1:7890"
|
||||
export http_proxy="http://127.0.0.1:7890"
|
||||
```
|
||||
|
||||
Replace `127.0.0.1:7890` with the address and port of your proxy server. These commands set the proxy for the current session. If you want to make these changes permanent, add them to your `.bashrc`, `.bash_profile`, or equivalent shell configuration file.
|
||||
|
||||
**Using SSH Instead of HTTPS**
|
||||
|
||||
An alternative to using HTTPS is to set up an SSH connection for Git operations. SSH connections are often not blocked by firewalls and do not require proxy settings. Additionally, SSH provides a secure channel and can simplify the authentication process since it relies on SSH keys rather than username and password credentials.
|
||||
|
||||
To use SSH with Git, you first need to generate an SSH key pair and add the public key to your GitHub account (or another Git hosting service).
|
||||
|
||||
1. **Generate SSH Key Pair**: Open your terminal and run `ssh-keygen -t rsa -b 4096 -C "your_email@example.com"`, replacing `your_email@example.com` with your email. Press enter to accept the default file location and passphrase prompts.
|
||||
|
||||
2. **Add SSH Key to SSH-Agent**: Ensure the ssh-agent is running with `eval "$(ssh-agent -s)"` and then add your SSH private key to the ssh-agent using `ssh-add ~/.ssh/id_rsa`.
|
||||
|
||||
3. **Add SSH Key to GitHub**: Copy your SSH public key to your clipboard with `cat ~/.ssh/id_rsa.pub | clip` (Windows) or `pbcopy < ~/.ssh/id_rsa.pub` (Mac). Go to GitHub, navigate to Settings > SSH and GPG keys, and add a new SSH key, pasting your key into the field provided.
|
||||
|
||||
4. **Switch to SSH in Your Repository**: Change your repository's remote URL from HTTPS to SSH. You can find the SSH URL in your repository settings on GitHub and use `git remote set-url origin git@github.com:username/repository.git` to switch.
|
||||
|
||||
**Authentication Errors**
|
||||
|
||||
If you're experiencing authentication errors, it might be due to missing or incorrect credentials. Ensure you have added your SSH key to your Git hosting service. You can test your SSH connection with `ssh -T git@github.com` (replace `github.com` with your Git hosting service's domain). If successful, you'll receive a welcome message.
|
||||
|
||||
For HTTPS users, check that your username and password (or personal access token for services like GitHub that no longer accept password authentication for Git operations) are correct.
|
||||
|
||||
8. **Open a pull request** to `openimsdk/open-im-server:main`
|
||||
7. **Open a pull request** to `openimsdk/open-im-server:main`
|
||||
|
||||
It is recommended to review your changes before filing a pull request. Check if your code doesn't conflict with the main branch and no redundant code is included.
|
||||
|
||||
> [!TIP] There is a [good blog post documenting](https://nsddd.top/posts/participating-in-this-project/) the entire push contribution process.
|
||||
|
||||
|
||||
## Style and Specification
|
||||
|
||||
@@ -303,15 +190,15 @@ We divide the problem into security and general problems:
|
||||
|
||||
#### Reporting security issues
|
||||
|
||||
Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of open-im-server, please do not discuss it in public and even do not open a public issue.
|
||||
Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of Open-IM-Server, please do not discuss it in public and even do not open a public issue.
|
||||
|
||||
Instead we encourage you to send us a private email to info@openim.io to report this.
|
||||
|
||||
#### Reporting general issues
|
||||
|
||||
To be honest, we regard every user of open-im-serveras a very kind contributor. After experiencing open-im-server, you may have some feedback for the project. Then feel free to open an issue via [NEW ISSUE](https://github.com/openimsdk/open-im-server/issues/new/choose).
|
||||
To be honest, we regard every user of Open-IM-Serveras a very kind contributor. After experiencing Open-IM-Server, you may have some feedback for the project. Then feel free to open an issue via [NEW ISSUE](https://github.com/openimsdk/open-im-server/issues/new/choose).
|
||||
|
||||
Since we collaborate project open-im-server in a distributed way, we appreciate **WELL-WRITTEN**, **DETAILED**, **EXPLICIT** issue reports. To make the communication more efficient, we wish everyone could search if your issue is an existing one in the searching list. If you find it existing, please add your details in comments under the existing issue instead of opening a brand new one.
|
||||
Since we collaborate project Open-IM-Server in a distributed way, we appreciate **WELL-WRITTEN**, **DETAILED**, **EXPLICIT** issue reports. To make the communication more efficient, we wish everyone could search if your issue is an existing one in the searching list. If you find it existing, please add your details in comments under the existing issue instead of opening a brand new one.
|
||||
|
||||
To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](https://github.com/OpenIMSDK/.github/tree/main/.github/ISSUE_TEMPLATE) for issue reporters. You can find three kinds of issue templates there: question, bug report and feature request. Please **BE SURE** to follow the instructions to fill fields in template.
|
||||
|
||||
@@ -319,20 +206,20 @@ To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](
|
||||
|
||||
+ bug report
|
||||
+ feature request
|
||||
+ open-im-server performance issues
|
||||
+ Open-IM-Server performance issues
|
||||
+ feature proposal
|
||||
+ feature design
|
||||
+ help wanted
|
||||
+ doc incomplete
|
||||
+ test improvement
|
||||
+ any questions on open-im-server project
|
||||
+ any questions on Open-IM-Server project
|
||||
+ and so on
|
||||
|
||||
Also, we must be reminded when submitting a new question about open-im-server, please remember to remove the sensitive data from your post. Sensitive data could be password, secret key, network locations, private business data and so on.
|
||||
Also, we must be reminded when submitting a new question about Open-IM-Server, please remember to remove the sensitive data from your post. Sensitive data could be password, secret key, network locations, private business data and so on.
|
||||
|
||||
#### Commit Rules
|
||||
|
||||
Actually in open-im-server, we take two rules serious when committing:
|
||||
Actually in Open-IM-Server, we take two rules serious when committing:
|
||||
|
||||
**🥇 Commit Message:**
|
||||
|
||||
@@ -375,7 +262,7 @@ An example for this could be:
|
||||
|
||||
#### PR Description
|
||||
|
||||
PR is the only way to make change to open-im-server project files. To help reviewers better get your purpose, PR description could not be too detailed. We encourage contributors to follow the [PR template](https://github.com/OpenIMSDK/.github/tree/main/.github/PULL_REQUEST_TEMPLATE.md) to finish the pull request.
|
||||
PR is the only way to make change to Open-IM-Server project files. To help reviewers better get your purpose, PR description could not be too detailed. We encourage contributors to follow the [PR template](https://github.com/OpenIMSDK/.github/tree/main/.github/PULL_REQUEST_TEMPLATE.md) to finish the pull request.
|
||||
|
||||
You can find some very formal PR in [RFC](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) issues and learn about them.
|
||||
|
||||
@@ -424,11 +311,11 @@ git() {
|
||||
|
||||
#### Docs Contribution
|
||||
|
||||
The documentation for open-im-server includes:
|
||||
The documentation for Open-IM-Server includes:
|
||||
|
||||
+ [README.md](https://github.com/openimsdk/open-im-server/blob/main/README.md): This file includes the basic information and instructions for getting started with open-im-server.
|
||||
+ [CONTRIBUTING.md](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md): This file contains guidelines for contributing to open-im-server's codebase, such as how to submit issues, pull requests, and code reviews.
|
||||
+ [Official Documentation](https://doc.rentsoft.cn/): This is the official documentation for open-im-server, which includes comprehensive information on all of its features, configuration options, and troubleshooting tips.
|
||||
+ [README.md](https://github.com/openimsdk/open-im-server/blob/main/README.md): This file includes the basic information and instructions for getting started with Open-IM-Server.
|
||||
+ [CONTRIBUTING.md](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md): This file contains guidelines for contributing to Open-IM-Server's codebase, such as how to submit issues, pull requests, and code reviews.
|
||||
+ [Official Documentation](https://doc.rentsoft.cn/): This is the official documentation for Open-IM-Server, which includes comprehensive information on all of its features, configuration options, and troubleshooting tips.
|
||||
|
||||
Please obey the following rules to better format the docs, which would greatly improve the reading experience.
|
||||
|
||||
@@ -441,20 +328,20 @@ Please obey the following rules to better format the docs, which would greatly i
|
||||
|
||||
## Engage to help anything
|
||||
|
||||
We choose GitHub as the primary place for open-im-server to collaborate. So the latest updates of open-im-server are always here. Although contributions via PR is an explicit way to help, we still call for any other ways.
|
||||
We choose GitHub as the primary place for Open-IM-Server to collaborate. So the latest updates of Open-IM-Server are always here. Although contributions via PR is an explicit way to help, we still call for any other ways.
|
||||
|
||||
+ reply to other's [issues](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) if you could;
|
||||
+ help solve other user's problems;
|
||||
+ help review other's [PR](https://github.com/openimsdk/open-im-server/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) design;
|
||||
+ discuss about open-im-server to make things clearer;
|
||||
+ advocate [open-im-server](https://google.com/search?q=open-im-server) technology beyond GitHub;
|
||||
+ write blogs on open-im-server and so on.
|
||||
+ discuss about Open-IM-Server to make things clearer;
|
||||
+ advocate [Open-IM-Server](https://google.com/search?q=Open-IM-Server) technology beyond GitHub;
|
||||
+ write blogs on Open-IM-Server and so on.
|
||||
|
||||
In a word, **ANY HELP IS CONTRIBUTION.**
|
||||
|
||||
## Release version
|
||||
|
||||
Releases of open-im-server are done using [Release Please](https://github.com/googleapis/release-please) and [GoReleaser](https://goreleaser.com/). The workflow looks like this:
|
||||
Releases of Open-IM-Server are done using [Release Please](https://github.com/googleapis/release-please) and [GoReleaser](https://goreleaser.com/). The workflow looks like this:
|
||||
|
||||
🎯 A PR is merged to the `main` branch:
|
||||
|
||||
@@ -479,23 +366,17 @@ Such a commit can get produced as follows:
|
||||
❯ git commit --allow-empty -m "chore: release 0.0.3" -m "Release-As: 0.0.3
|
||||
````
|
||||
|
||||
For the complex release process, in fact, and encapsulation as CICD, you only need to tag locally, and then publish the tag to OpenIM github to complete the entire OpenIM release process.
|
||||
|
||||
In addition to CICD, we also do a complex release command locally, which can help you complete the full platform compilation, testing, and release to Minio, just by using the `make release` command.
|
||||
Please [read the detailed documents](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/release.md)
|
||||
|
||||
|
||||
## Contact Us
|
||||
|
||||
We value close connections with our users, developers, and contributors here at open-im-server. With a large community and maintainer team, we're always here to help and support you. Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.
|
||||
We value close connections with our users, developers, and contributors here at Open-IM-Server. With a large community and maintainer team, we're always here to help and support you. Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.
|
||||
|
||||
Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of open-im-server. You can ask technical questions, seek help, or share your experiences with other users of open-im-server.
|
||||
Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of Open-IM-Server. You can ask technical questions, seek help, or share your experiences with other users of Open-IM-Server.
|
||||
|
||||
In addition to Slack, we also offer the following ways to get in touch:
|
||||
|
||||
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/slack-%40OpenIMSDKCore-informational?logo=slack&style=flat-square"></a>: We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 open-im-server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel.
|
||||
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/slack-%40OpenIMSDKCore-informational?logo=slack&style=flat-square"></a>: We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel.
|
||||
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=4closetool3@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a>: Get in touch with us on [Gmail](info@openim.io). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
|
||||
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a>: Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with open-im-server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
|
||||
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a>: Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of open-im-server. We will process your request as soon as possible.
|
||||
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a>: Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
|
||||
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a>: Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible.
|
||||
|
||||
Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.
|
||||
|
||||
+3
-2
@@ -3,14 +3,15 @@ FROM golang:1.20 AS builder
|
||||
|
||||
# Set go mod installation source and proxy
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
ENV GO111MODULE=$GO111MODULE
|
||||
ENV GOPROXY=$GOPROXY
|
||||
|
||||
# Set up the working directory
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy all files to the container
|
||||
ADD . .
|
||||
|
||||
@@ -184,7 +184,7 @@ test-e2e:
|
||||
imports:
|
||||
@$(MAKE) go.imports
|
||||
|
||||
## clean: Delete all files created by the build, as well as all log files. ✨
|
||||
## clean: Remove all files that are created by building. ✨
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@$(MAKE) go.clean
|
||||
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
<p align="center">
|
||||
<a href="https://openim.io">
|
||||
<img src="./assets/logo-gif/openim-logo.gif" width="60%" height="30%"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h3 align="center" style="border-bottom: none">
|
||||
⭐️ Open source Instant Messaging Server ⭐️ <br>
|
||||
<h3>
|
||||
|
||||
|
||||
<p align=center>
|
||||
<a href="https://goreportcard.com/report/github.com/openimsdk/open-im-server"><img src="https://goreportcard.com/badge/github.com/openimsdk/open-im-server" alt="A+"></a>
|
||||
<a href="https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22"><img src="https://img.shields.io/github/issues/openimsdk/open-im-server/good%20first%20issue?logo=%22github%22" alt="good first"></a>
|
||||
<a href="https://github.com/openimsdk/open-im-server"><img src="https://img.shields.io/github/stars/openimsdk/open-im-server.svg?style=flat&logo=github&colorB=deeppink&label=stars"></a>
|
||||
<a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q"><img src="https://img.shields.io/badge/Slack-300%2B-blueviolet?logo=slack&logoColor=white"></a>
|
||||
<a href="https://github.com/openimsdk/open-im-server/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green"></a>
|
||||
<a href="https://golang.org/"><img src="https://img.shields.io/badge/Language-Go-blue.svg"></a>
|
||||
</p>
|
||||
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="./README.md"><b> English </b></a> •
|
||||
<a href="./README-zh_CN.md"><b> 简体中文 </b></a> •
|
||||
<a href="https://openim.io/en"><b> Docs </b></a>
|
||||
</p>
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
## 🟢 扫描微信进群交流
|
||||
<img src="./docs/images/Wechat.jpg" width="300">
|
||||
|
||||
|
||||
## Ⓜ️ 关于 OpenIM
|
||||
|
||||
OpenIM 不仅仅是一个开源的即时消息组件,它是你的应用程序生态系统的一个不可或缺的部分。查看下面的图表,了解 AppServer、AppClient、OpenIMServer 和 OpenIMSDK 是如何交互的。
|
||||
|
||||

|
||||
|
||||
## 🚀 关于 OpenIMSDK
|
||||
|
||||
**OpenIMSDK** 无缝集成到您的应用中,提供丰富、实时的消息体验,无需复杂的 UI 集成。它提供:
|
||||
|
||||
+ **本地存储**:用于快速数据检索和消息同步。
|
||||
+ **监听器回调**:确保实时消息交互性。
|
||||
+ **API 封装**:简化开发流程。
|
||||
+ **连接管理**:保证可靠的消息传递。
|
||||
|
||||
它使用 Golang 构建,并支持跨平台部署,确保在所有平台上提供一致的消息体验。
|
||||
|
||||
👉 **[探索 GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
||||
|
||||
## 🌐 关于 OpenIMServer
|
||||
|
||||
精心用 Golang 开发的 **OpenIMServer** 通过多重方式确保了卓越的即时消息服务器能力:
|
||||
|
||||
+ **模块组成**:它由多个模块组成,例如网关和多个 RPC 服务,提供一个多功能的消息环境。
|
||||
+ **微服务架构**:支持集群模式,确保出色的性能和可伸缩性,以有效管理各个实例间的通信。
|
||||
+ **多样的部署选项**:适应你的操作偏好,通过源代码、Kubernetes 或 Docker 提供部署选项。
|
||||
|
||||
### 增强的业务功能:
|
||||
|
||||
+ **REST API**:OpenIMServer 为业务系统提供 REST API,旨在通过后端接口为您的操作提供附加功能,如群组创建和消息推送。
|
||||
+ **回调**:为了扩展其在各种业务形式中的实用性,OpenIMServer 提供了回调能力。即,在事件发生之前或之后,它向业务服务器发送请求,比如发送消息,丰富通信过程中的交互和数据交换流。
|
||||
|
||||
👉 **[了解更多](https://doc.rentsoft.cn/guides/introduction/product)**
|
||||
|
||||
## :rocket: 快速开始
|
||||
|
||||
你只需要一个简单的命令,就可以快速学习 OpenIM 的工程解决方案:
|
||||
|
||||
```
|
||||
bashCopy code
|
||||
$ make demo
|
||||
```
|
||||
|
||||
🤲 为了方便用户体验,我们提供了多种部署解决方案,您可以根据下面的列表选择自己的部署方法:
|
||||
|
||||
+ **[源代码部署指南](https://doc.rentsoft.cn/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
+ **[Docker 部署指南](https://doc.rentsoft.cn/guides/gettingStarted/dockerCompose)**
|
||||
+ **[Kubernetes 部署指南](https://github.com/openimsdk/open-im-server/tree/main/deployments)**
|
||||
|
||||
## :hammer_and_wrench: 开始开发 OpenIM
|
||||
|
||||
OpenIM 我们的目标是建立一个顶级的开源社区。我们有一套标准,在[社区仓库](https://github.com/OpenIMSDK/community)中。
|
||||
|
||||
如果你想为这个 Open-IM-Server 仓库做贡献,请阅读我们的[贡献者文档](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md)。
|
||||
|
||||
在开始之前,请确保你的更改是有需求的。最好的方法是创建一个[新的讨论](https://github.com/openimsdk/open-im-server/discussions/new/choose) 或 [Slack 通信](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q),或者如果你发现一个问题,首先[报告它](https://github.com/openimsdk/open-im-server/issues/new/choose)。
|
||||
|
||||
+ [代码标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/go-code.md)
|
||||
|
||||
+ [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md)
|
||||
|
||||
+ [目录标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/directory.md)
|
||||
|
||||
+ [提交标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/commit.md)
|
||||
|
||||
+ [版本控制标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md)
|
||||
|
||||
+ [接口标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/interface.md)
|
||||
|
||||
+ [OpenIM配置和环境变量设置](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md)
|
||||
|
||||
> **Note**
|
||||
> 针对中国的用户,阅读我们的 [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md) 以便使用国内 aliyun 的镜像地址。OpenIM 也有针对中国的 gitee 同步仓库,你可以在 [gitee.com](https://gitee.com/openimsdk) 上找到它。
|
||||
|
||||
## :link: 链接
|
||||
|
||||
+ **[完整文档](https://doc.rentsoft.cn/)**
|
||||
+ **[更新日志](https://github.com/openimsdk/open-im-server/blob/main/CHANGELOG.md)**
|
||||
+ **[FAQ](https://github.com/openimsdk/open-im-server/blob/main/FAQ.md)**
|
||||
+ **[代码示例](https://github.com/openimsdk/open-im-server/blob/main/examples)**
|
||||
|
||||
## :handshake: 社区
|
||||
|
||||
+ **[GitHub Discussions](https://github.com/openimsdk/open-im-server/discussions)**
|
||||
+ **[Slack 通信](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)**
|
||||
+ **[GitHub Issues](https://github.com/openimsdk/open-im-server/issues)**
|
||||
|
||||
您可以加入这些平台,讨论问题,提出建议,或分享您的成功故事!
|
||||
|
||||
## :writing_hand: 贡献
|
||||
|
||||
我们欢迎任何形式的贡献!请确保在提交 Pull Request 之前阅读我们的[贡献者文档](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md)。
|
||||
|
||||
+ **[报告 Bug](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
|
||||
+ **[提出新特性](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
|
||||
+ **[提交 Pull Request](https://github.com/openimsdk/open-im-server/pulls)**
|
||||
|
||||
感谢您的贡献,我们一起打造一个强大的即时通信解决方案!
|
||||
|
||||
## :closed_book: 许可证
|
||||
|
||||
OpenIMSDK 在 Apache License 2.0 许可下可用。查看[LICENSE 文件](https://github.com/openimsdk/open-im-server/blob/main/LICENSE)了解更多信息。
|
||||
|
||||
## 🔮 Thanks to our contributors!
|
||||
|
||||
<a href="https://github.com/openimsdk/open-im-server/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=openimsdk/open-im-server" />
|
||||
</a>
|
||||
@@ -17,118 +17,187 @@
|
||||
[](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22)
|
||||
[](https://golang.org/)
|
||||
|
||||
|
||||
<p align="center">
|
||||
<a href="./README.md">Englist</a> ·
|
||||
<a href="./README_zh_CN.md">中文</a> ·
|
||||
<a href="./docs/readme/README_uk.md">Українська</a> ·
|
||||
<a href="./docs/readme/README_cs.md">Česky</a> ·
|
||||
<a href="./docs/readme/README_hu.md">Magyar</a> ·
|
||||
<a href="./docs/readme/README_es.md">Español</a> ·
|
||||
<a href="./docs/readme/README_fa.md">فارسی</a> ·
|
||||
<a href="./docs/readme/README_fr.md">Français</a> ·
|
||||
<a href="./docs/readme/README_de.md">Deutsch</a> ·
|
||||
<a href="./docs/readme/README_pl.md">Polski</a> ·
|
||||
<a href="./docs/readme/README_id.md">Indonesian</a> ·
|
||||
<a href="./docs/readme/README_fi.md">Suomi</a> ·
|
||||
<a href="./docs/readme/README_ml.md">മലയാളം</a> ·
|
||||
<a href="./docs/readme/README_ja.md">日本語</a> ·
|
||||
<a href="./docs/readme/README_nl.md">Nederlands</a> ·
|
||||
<a href="./docs/readme/README_it.md">Italiano</a> ·
|
||||
<a href="./docs/readme/README_ru.md">Русский</a> ·
|
||||
<a href="./docs/readme/README_pt_BR.md">Português (Brasil)</a> ·
|
||||
<a href="./docs/readme/README_eo.md">Esperanto</a> ·
|
||||
<a href="./docs/readme/README_ko.md">한국어</a> ·
|
||||
<a href="./docs/readme/README_ar.md">العربي</a> ·
|
||||
<a href="./docs/readme/README_vi.md">Tiếng Việt</a> ·
|
||||
<a href="./docs/readme/README_da.md">Dansk</a> ·
|
||||
<a href="./docs/readme/README_el.md">Ελληνικά</a> ·
|
||||
<a href="./docs/readme/README_tr.md">Türkçe</a>
|
||||
</p>
|
||||
|
||||
[**English**](./README.md) •
|
||||
[**简体中文**](./README-zh_CN.md) •
|
||||
[**Docs**](https://openim.io/en)
|
||||
|
||||
</div>
|
||||
|
||||
</p>
|
||||
|
||||
## :busts_in_silhouette: Community
|
||||
|
||||
+ 💬 [Follow our Twitter account](https://twitter.com/founder_im63606)
|
||||
+ 👫 [Join our Reddit](https://www.reddit.com/r/OpenIMessaging)
|
||||
+ 🚀 [Join our Slack community](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)
|
||||
+ :eyes: [Join our wechat (微信群)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||
+ 📚 [OpenIM Community](https://github.com/OpenIMSDK/community)
|
||||
+ 💕 [OpenIM Interest Group](https://github.com/Openim-sigs)
|
||||
|
||||
## Ⓜ️ About OpenIM
|
||||
|
||||
OpenIM is a service platform specifically designed for integrating chat, audio-video calls, notifications, and AI chatbots into applications. It provides a range of powerful APIs and Webhooks, enabling developers to easily incorporate these interactive features into their applications. OpenIM is not a standalone chat application, but rather serves as a platform to support other applications in achieving rich communication functionalities. The following diagram illustrates the interaction between AppServer, AppClient, OpenIMServer, and OpenIMSDK to explain in detail.
|
||||
OpenIM isn't just an open-source instant messaging component, it's an integral part of your application ecosystem. Check out this diagram to understand how AppServer, AppClient, OpenIMServer, and OpenIMSDK interact.
|
||||
|
||||

|
||||
|
||||
## 🚀 About OpenIMSDK
|
||||
|
||||
**OpenIMSDK** is an IM SDK designed for **OpenIMServer**, created specifically for embedding in client applications. Its main features and modules are as follows:
|
||||
**OpenIMSDK** seamlessly integrates into your application, delivering a rich, real-time messaging experience without requiring intricate UI integration. It provides:
|
||||
|
||||
+ 🌟 Main Features:
|
||||
+ **Local Storage**: For quick data retrieval and message synchronization.
|
||||
+ **Listener Callbacks**: Ensuring real-time message interactivity.
|
||||
+ **API Encapsulation**: Streamlining development processes.
|
||||
+ **Connection Management**: Guaranteeing reliable message delivery.
|
||||
|
||||
- 📦 Local storage
|
||||
- 🔔 Listener callbacks
|
||||
- 🛡️ API wrapping
|
||||
- 🌐 Connection management
|
||||
|
||||
+ 📚 Main Modules:
|
||||
|
||||
1. 🚀 Initialization and Login
|
||||
2. 👤 User Management
|
||||
3. 👫 Friend Management
|
||||
4. 🤖 Group Functions
|
||||
5. 💬 Conversation Handling
|
||||
|
||||
It is built using Golang and supports cross-platform deployment, ensuring a consistent access experience across all platforms.
|
||||
It's crafted in Golang and supports cross-platform deployment, ensuring a coherent messaging experience across all platforms.
|
||||
|
||||
👉 **[Explore GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
||||
|
||||
## 🌐 About OpenIMServer
|
||||
|
||||
+ **OpenIMServer** has the following characteristics:
|
||||
- 🌐 Microservice architecture: Supports cluster mode, including a gateway and multiple rpc services.
|
||||
- 🚀 Diverse deployment methods: Supports deployment via source code, Kubernetes, or Docker.
|
||||
- Support for massive user base: Super large groups with hundreds of thousands of users, tens of millions of users, and billions of messages.
|
||||
**OpenIMServer**, meticulously developed in Golang, ensures a stellar instant messaging server capability with a multifold approach:
|
||||
|
||||
### Enhanced Business Functionality:
|
||||
+ **Modular Composition**: It's comprised of several modules, such as the gateway and multiple RPC services, offering a versatile messaging environment.
|
||||
+ **Microservices Architecture**: Supporting cluster modes, it assures outstanding performance and scalability to manage communication effectively across various instances.
|
||||
+ **Diverse Deployment Options**: Adapts to your operational preferences, offering deployment via source code, Kubernetes, or Docker.
|
||||
|
||||
+ **REST API**: OpenIMServer offers REST APIs for business systems, aimed at empowering businesses with more functionalities, such as creating groups and sending push messages through backend interfaces.
|
||||
+ **Webhooks**: OpenIMServer provides callback capabilities to extend more business forms. A callback means that OpenIMServer sends a request to the business server before or after a certain event, like callbacks before or after sending a message.
|
||||
### Enhanced Business Functionalities:
|
||||
|
||||
👉 **[Learn more](https://docs.openim.io/guides/introduction/product)**
|
||||
+ **REST API**: OpenIMServer provides REST API for business systems, aiming to empower your operations with additional functionalities like group creation and message push via backend interfaces.
|
||||
+ **Callbacks**: To expand its utility across varied business forms, OpenIMServer offers callback capabilities. That is, it sends a request to the business server before or after an event occurs, such as sending a message, enriching the interaction and data exchange flow in the communication processes.
|
||||
|
||||
👉 **[Learn More](https://docs.openim.io/guides/introduction/product)**
|
||||
|
||||
<!--
|
||||
|
||||
## :star2: Why OpenIM
|
||||
|
||||
**🔍 Function screenshot display**
|
||||
|
||||
<div align="center">
|
||||
|
||||
| 💻🔄📱 Multi Terminal Synchronization 🔄🖥️ | 📅⚡ Efficient Meetings 🚀💼 |
|
||||
| :----------------------------------------------------------: | :---------------------------------------------------------: |
|
||||
|  |  |
|
||||
| 📲🔄 **One-to-one and Group Chats** 👥🗣️ | 🎁💻 **Special Features - Custom Messages** ✉️🎨|
|
||||
|  |  |
|
||||
|
||||
</div>
|
||||
|
||||
**OpenIM** offers a powerful and reliable instant messaging platform, ensuring versatile communication across multiple platforms with the following key features:
|
||||
|
||||
✅ **Versatile Messaging:** Support for text, images, emojis, voice, video, and more, alongside one-on-one and multi-person audio/video calls.
|
||||
|
||||
✅ **Robust Chat Capabilities:** Including roles (application administrator, group owner, etc.) and features like muting, group announcements, and dynamic message loading.
|
||||
|
||||
✅ **Unique Interaction Features:** Offering read-and-burn private chats and a message editing function to broaden social scenarios.
|
||||
|
||||
✅ **Open Source:** The code of OpenIM is open source and aims to build a leading global IM open source community. [GitHub Repository](https://github.com/OpenIMSDK)
|
||||
|
||||
✅ **Extensibility:** Implemented in Golang, OpenIM introduces an "everything is a message" communication model, simplifying custom messages and feature extension.
|
||||
|
||||
✅ **High Performance:** Supports a hierarchical governance architecture tested and abstracts the storage model of various message types.
|
||||
|
||||
✅ **Full Platform Support:** Native support for iOS, Android, Flutter, uni-app, ReactNative, Electron, and Web.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
## :rocket: Quick Start
|
||||
|
||||
You can quickly learn OpenIM engineering solutions, all it takes is one simple command:
|
||||
|
||||
```bash
|
||||
$ make demo
|
||||
```
|
||||
|
||||
🤲 In order to facilitate the user experience, we have provided a variety of deployment solutions, you can choose your own deployment method according to the list below:
|
||||
|
||||
<!--
|
||||
<details> <summary>Deploying with Docker Compose</summary>
|
||||
|
||||
It is recommended to use Docker Compose for deployment, which can easily and quickly deploy the entire OpenIM service on a single node
|
||||
|
||||
+ [https://github.com/openimsdk/openim-docker](https://github.com/openimsdk/openim-docker)
|
||||
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> If you don't know OpenIM's versioning policy, 📚Read our release policy: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md
|
||||
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Compile from Source</summary>
|
||||
|
||||
|
||||
Ur need `Go 1.20` or higher version, and `make`.
|
||||
|
||||
|
||||
```bash
|
||||
go version && make --version || echo "Error: One of the commands failed."
|
||||
```
|
||||
|
||||
Version Details: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md
|
||||
|
||||
You can get the version number from the command below or from [github releases](https://github.com/openimsdk/open-im-server/tags).
|
||||
|
||||
```bash
|
||||
$ curl --silent "https://api.github.com/repos/openimsdk/open-im-server/releases" | jq -r '.[].tag_name'
|
||||
```
|
||||
|
||||
We have our own version management policy, if you are interested in our version management, I recommend reading [📚 OpenIM Version](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md), We recommend using stable versions such as `v3.3.0` and `v3.2.0` whenever possible. `v3.1.1-alpha.3` as well as `v3.3.0-beta.0` and `v3.2.0-rc.0` are pre-release or beta versions and are not recommended.
|
||||
|
||||
Set `OPENIM_VERSION` environment variables for the latest `OPENIM_VERSION` number, or replace the `OPENIM_VERSION` for you to install the OpenIM-Server `OPENIM_VERSION`:
|
||||
|
||||
```bash
|
||||
$ OPENIM_VERSION=`curl -s https://api.github.com/repos/openimsdk/open-im-server/releases/latest | grep -oE '"tag_name": "[^"]+"' | head -n1 | cut -d'"' -f4`
|
||||
# OPENIM_VERSION=v3.3.0
|
||||
```
|
||||
|
||||
Deploy basic components at the click of a command:
|
||||
|
||||
```bash
|
||||
# install openim dependency
|
||||
$ git clone https://github.com/openimsdk/open-im-server openim/openim-server && export openim=$(pwd)/openim/openim-server && cd $openim/openim-server && git checkout $OPENIM_VERSION
|
||||
$ make init && docker compose up -d && make start && make check
|
||||
```
|
||||
|
||||
> `make help` to help you see the instructions supported by OpenIM.
|
||||
|
||||
|
||||
You can use the `make help-all` see OpenIM in action.
|
||||
|
||||
</details>
|
||||
|
||||
<details> <summary>Component Configuration Instructions</summary>
|
||||
|
||||
Read: Configuration center document:https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
<details> <summary>Deployed with kubernetes</summary>
|
||||
|
||||
+ https://github.com/openimsdk/open-im-server/blob/main/deployments/README.md
|
||||
|
||||
</details>
|
||||
-->
|
||||
|
||||
+ **[Source Code Deployment Guide](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
+ **[Production deployment of Linux systems](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/install-openim-linux-system.md)**
|
||||
+ **[Docker Deployment Guide](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||
+ **[Kubernetes Deployment Guide](https://github.com/openimsdk/open-im-server/tree/main/deployments)**
|
||||
|
||||
<!--
|
||||
## :link: OpenIM and your application
|
||||
|
||||
OpenIM isn't just an open-source instant messaging component, it's an integral part of your application ecosystem. Check out this diagram to understand how AppServer, AppClient, OpenIMServer, and OpenIMSDK interact.
|
||||
|
||||

|
||||
|
||||
## :building_construction: Overall Architecture
|
||||
|
||||
Delve into the heart of Open-IM-Server's functionality with our architecture diagram.
|
||||
|
||||

|
||||
 -->
|
||||
|
||||
|
||||
## :rocket: Quick Start
|
||||
|
||||
We support many platforms. Here are the addresses for quick experience on the web side:
|
||||
|
||||
👉 **[OpenIM online web demo](https://web-enterprise.rentsoft.cn/)**
|
||||
|
||||
🤲 To facilitate user experience, we offer various deployment solutions. You can choose your deployment method from the list below:
|
||||
|
||||
+ **[Source Code Deployment Guide](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
+ **[Docker Deployment Guide](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||
+ **[Kubernetes Deployment Guide](https://docs.openim.io/guides/gettingStarted/k8s-deployment)**
|
||||
+ **[Mac Developer Deployment Guide](https://docs.openim.io/guides/gettingstarted/mac-deployment-guide)**
|
||||
|
||||
## :hammer_and_wrench: To Start Developing OpenIM
|
||||
## :hammer_and_wrench: To start developing OpenIM
|
||||
|
||||
[](https://vscode.dev/github/openimsdk/open-im-server)
|
||||
|
||||
[](https://codespaces.new/openimsdk/open-im-server)
|
||||
|
||||
OpenIM Our goal is to build a top-level open source community. We have a set of standards, in the [Community repository](https://github.com/OpenIMSDK/community).
|
||||
|
||||
If you'd like to contribute to this Open-IM-Server repository, please read our [contributor documentation](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md).
|
||||
@@ -163,7 +232,13 @@ Before you start, please make sure your changes are in demand. The best for that
|
||||
- [OpenIM Script Utilities](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/util-scripts.md)
|
||||
- [OpenIM Versioning](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/version.md)
|
||||
- [Manage backend and monitor deployment](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/prometheus-grafana.md)
|
||||
- [Mac Developer Deployment Guide for OpenIM](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/mac-developer-deployment-guide.md)
|
||||
|
||||
## :busts_in_silhouette: Community
|
||||
|
||||
+ 📚 [OpenIM Community](https://github.com/OpenIMSDK/community)
|
||||
+ 💕 [OpenIM Interest Group](https://github.com/Openim-sigs)
|
||||
+ 🚀 [Join our Slack community](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)
|
||||
+ :eyes: [Join our wechat (微信群)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||
|
||||
## :calendar: Community Meetings
|
||||
|
||||
@@ -173,7 +248,7 @@ Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/share
|
||||
|
||||
We take notes of each [biweekly meeting](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) in [GitHub discussions](https://github.com/openimsdk/open-im-server/discussions/categories/meeting), Our historical meeting notes, as well as replays of the meetings are available at [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
|
||||
|
||||
## :eyes: Who Are Using OpenIM
|
||||
## :eyes: Who are using OpenIM
|
||||
|
||||
Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [📝comment](https://github.com/openimsdk/open-im-server/issues/379) and share your use case.
|
||||
|
||||
|
||||
-173
@@ -1,173 +0,0 @@
|
||||
<p align="center">
|
||||
<a href="https://openim.io">
|
||||
<img src="./assets/logo-gif/openim-logo.gif" width="60%" height="30%"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/openimsdk/open-im-server/stargazers)
|
||||
[](https://github.com/openimsdk/open-im-server/network/members)
|
||||
[](https://app.codecov.io/gh/openimsdk/open-im-server)
|
||||
[](https://goreportcard.com/report/github.com/openimsdk/open-im-server)
|
||||
[](https://pkg.go.dev/github.com/openimsdk/open-im-server/v3)
|
||||
[](https://github.com/openimsdk/open-im-server/blob/main/LICENSE)
|
||||
[](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)
|
||||
[](https://www.bestpractices.dev/projects/8045)
|
||||
[](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22)
|
||||
[](https://golang.org/)
|
||||
|
||||
|
||||
<p align="center">
|
||||
<a href="./README.md">Englist</a> ·
|
||||
<a href="./README_zh_CN.md">中文</a> ·
|
||||
<a href="./docs/readme/README_uk.md">Українська</a> ·
|
||||
<a href="./docs/readme/README_cs.md">Česky</a> ·
|
||||
<a href="./docs/readme/README_hu.md">Magyar</a> ·
|
||||
<a href="./docs/readme/README_es.md">Español</a> ·
|
||||
<a href="./docs/readme/README_fa.md">فارسی</a> ·
|
||||
<a href="./docs/readme/README_fr.md">Français</a> ·
|
||||
<a href="./docs/readme/README_de.md">Deutsch</a> ·
|
||||
<a href="./docs/readme/README_pl.md">Polski</a> ·
|
||||
<a href="./docs/readme/README_id.md">Indonesian</a> ·
|
||||
<a href="./docs/readme/README_fi.md">Suomi</a> ·
|
||||
<a href="./docs/readme/README_ml.md">മലയാളം</a> ·
|
||||
<a href="./docs/readme/README_ja.md">日本語</a> ·
|
||||
<a href="./docs/readme/README_nl.md">Nederlands</a> ·
|
||||
<a href="./docs/readme/README_it.md">Italiano</a> ·
|
||||
<a href="./docs/readme/README_ru.md">Русский</a> ·
|
||||
<a href="./docs/readme/README_pt_BR.md">Português (Brasil)</a> ·
|
||||
<a href="./docs/readme/README_eo.md">Esperanto</a> ·
|
||||
<a href="./docs/readme/README_ko.md">한국어</a> ·
|
||||
<a href="./docs/readme/README_ar.md">العربي</a> ·
|
||||
<a href="./docs/readme/README_vi.md">Tiếng Việt</a> ·
|
||||
<a href="./docs/readme/README_da.md">Dansk</a> ·
|
||||
<a href="./docs/readme/README_el.md">Ελληνικά</a> ·
|
||||
<a href="./docs/readme/README_tr.md">Türkçe</a>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</p>
|
||||
|
||||
## 🟢 扫描微信进群交流
|
||||
<img src="./docs/images/Wechat.jpg" width="300">
|
||||
|
||||
|
||||
## Ⓜ️ 关于 OpenIM
|
||||
|
||||
OpenIM 是一个专门设计用于在应用程序中集成聊天、音视频通话、通知以及AI聊天机器人等通信功能的服务平台。它通过提供一系列强大的API和Webhooks,使开发者可以轻松地在他们的应用中加入这些交互特性。OpenIM 本身并不是一个独立运行的聊天应用,而是作为一个平台,为其他应用提供支持,实现丰富的通信功能。下图展示 AppServer、AppClient、OpenIMServer 和 OpenIMSDK 之间的交互关系来具体说明。
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
## 🚀 关于 OpenIMSDK
|
||||
|
||||
**OpenIMSDK** 是为 **OpenIMServer** 设计的IM SDK,专为嵌入客户端应用而生。其主要功能及模块如下:
|
||||
|
||||
+ 🌟 主要功能:
|
||||
|
||||
- 📦 本地存储
|
||||
- 🔔 监听器回调
|
||||
- 🛡️ API封装
|
||||
- 🌐 连接管理
|
||||
|
||||
## 📚 主要模块:
|
||||
|
||||
1. 🚀 初始化及登录
|
||||
2. 👤 用户管理
|
||||
3. 👫 好友管理
|
||||
4. 🤖 群组功能
|
||||
5. 💬 会话处理
|
||||
|
||||
它使用 Golang 构建,并支持跨平台部署,确保在所有平台上提供一致的接入体验。
|
||||
|
||||
👉 **[探索 GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
||||
|
||||
## 🌐 关于 OpenIMServer
|
||||
|
||||
+ **OpenIMServer** 具有以下特点:
|
||||
- 🌐 微服务架构:支持集群模式,包括网关(gateway)和多个rpc服务。
|
||||
- 🚀 部署方式多样:支持源代码、kubernetes或docker部署。
|
||||
- 海量用户支持:十万超级大群,千万用户,及百亿消息
|
||||
|
||||
### 增强的业务功能:
|
||||
|
||||
+ **REST API**:OpenIMServer 提供了REST API供业务系统使用,旨在赋予业务更多功能,例如通过后台接口建立群组、发送推送消息等。
|
||||
+ **Webhooks**:OpenIMServer提供了回调能力以扩展更多的业务形态,所谓回调,即OpenIMServer会在某一事件发生之前或者之后,向业务服务器发送请求,如发送消息之前或之后的回调。
|
||||
|
||||
👉 **[了解更多](https://docs.openim.io/guides/introduction/product)**
|
||||
|
||||
## :rocket: 快速开始
|
||||
|
||||
在线体验iOS/Android/H5/PC/Web:
|
||||
|
||||
👉 **[OpenIM online demo](https://www.openim.io/zh/commercial)**
|
||||
|
||||
🤲 为了方便用户体验,我们提供了多种部署解决方案,您可以根据下面的列表选择自己的部署方法:
|
||||
|
||||
+ **[源代码部署指南](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||
+ **[Docker 部署指南](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||
+ **[Kubernetes 部署指南](https://docs.openim.io/guides/gettingStarted/k8s-deployment)**
|
||||
|
||||
## :hammer_and_wrench: 开始开发 OpenIM
|
||||
|
||||
OpenIM 我们的目标是建立一个顶级的开源社区。我们有一套标准,在[社区仓库](https://github.com/OpenIMSDK/community)中。
|
||||
|
||||
如果你想为这个 Open-IM-Server 仓库做贡献,请阅读我们的[贡献者文档](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md)。
|
||||
|
||||
在开始之前,请确保你的更改是有需求的。最好的方法是创建一个[新的讨论](https://github.com/openimsdk/open-im-server/discussions/new/choose) 或 [Slack 通信](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q),或者如果你发现一个问题,首先[报告它](https://github.com/openimsdk/open-im-server/issues/new/choose)。
|
||||
|
||||
+ [代码标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/go-code.md)
|
||||
|
||||
+ [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md)
|
||||
|
||||
+ [目录标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/directory.md)
|
||||
|
||||
+ [提交标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/commit.md)
|
||||
|
||||
+ [版本控制标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md)
|
||||
|
||||
+ [接口标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/interface.md)
|
||||
|
||||
+ [OpenIM配置和环境变量设置](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md)
|
||||
|
||||
> **Note**
|
||||
> 针对中国的用户,阅读我们的 [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md) 以便使用国内 aliyun 的镜像地址。OpenIM 也有针对中国的 gitee 同步仓库,你可以在 [gitee.com](https://gitee.com/openimsdk) 上找到它。
|
||||
|
||||
## :link: 链接
|
||||
|
||||
+ **[完整文档](https://doc.rentsoft.cn/)**
|
||||
+ **[更新日志](https://github.com/openimsdk/open-im-server/blob/main/CHANGELOG.md)**
|
||||
+ **[FAQ](https://github.com/openimsdk/open-im-server/blob/main/FAQ.md)**
|
||||
+ **[代码示例](https://github.com/openimsdk/open-im-server/blob/main/examples)**
|
||||
|
||||
## :handshake: 社区
|
||||
|
||||
+ **[GitHub Discussions](https://github.com/openimsdk/open-im-server/discussions)**
|
||||
+ **[Slack 通信](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q)**
|
||||
+ **[GitHub Issues](https://github.com/openimsdk/open-im-server/issues)**
|
||||
|
||||
您可以加入这些平台,讨论问题,提出建议,或分享您的成功故事!
|
||||
|
||||
## :writing_hand: 贡献
|
||||
|
||||
我们欢迎任何形式的贡献!请确保在提交 Pull Request 之前阅读我们的[贡献者文档](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md)。
|
||||
|
||||
+ **[报告 Bug](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
|
||||
+ **[提出新特性](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
|
||||
+ **[提交 Pull Request](https://github.com/openimsdk/open-im-server/pulls)**
|
||||
|
||||
感谢您的贡献,我们一起打造一个强大的即时通信解决方案!
|
||||
|
||||
## :closed_book: 许可证
|
||||
|
||||
OpenIMSDK 在 Apache License 2.0 许可下可用。查看[LICENSE 文件](https://github.com/openimsdk/open-im-server/blob/main/LICENSE)了解更多信息。
|
||||
|
||||
## 🔮 Thanks to our contributors!
|
||||
|
||||
<a href="https://github.com/openimsdk/open-im-server/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=openimsdk/open-im-server" />
|
||||
</a>
|
||||
+1
-1
@@ -25,7 +25,7 @@ assets/
|
||||
|
||||
## Copyright Notice:
|
||||
|
||||
The OpenIM logo, including its variations and animated versions, displayed in this repository [OpenIM](https://github.com/openimsdk/open-im-server) under the `/assets/logo` and `/assets/logo-gif` directories, are protected by copyright laws.
|
||||
The OpenIM logo, including its variations and animated versions, displayed in this repository [OpenIM](https://github.com/OpenIMSDK/openim) under the `/assets/logo` and `/assets/logo-gif` directories, are protected by copyright laws.
|
||||
|
||||
The logo design is credited to @Xx(席欣).
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# Official Colors
|
||||
|
||||
The openim logo has an official blue color. When reproducing the logo, please use the official color, when possible.
|
||||
|
||||
## Pantone
|
||||
|
||||
When possible, the Pantone color is preferred for print material. The official Pantone color is *285C*.
|
||||
|
||||
## RGB
|
||||
|
||||
When used digitally, the official RGB color code is *#326CE5*.
|
||||
+1
-25
@@ -3,36 +3,12 @@
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- make clean
|
||||
# You may remove this if you don't use go modules.
|
||||
- make tidy
|
||||
- make copyright.add
|
||||
# you may remove this if you don't need go generate
|
||||
- go generate ./...
|
||||
|
||||
git:
|
||||
# What should be used to sort tags when gathering the current and previous
|
||||
# tags if there are more than one tag in the same commit.
|
||||
#
|
||||
# Default: '-version:refname'
|
||||
tag_sort: -version:creatordate
|
||||
|
||||
# What should be used to specify prerelease suffix while sorting tags when gathering
|
||||
# the current and previous tags if there are more than one tag in the same commit.
|
||||
#
|
||||
# Since: v1.17
|
||||
prerelease_suffix: "-"
|
||||
|
||||
# Tags to be ignored by GoReleaser.
|
||||
# This means that GoReleaser will not pick up tags that match any of the
|
||||
# provided values as either previous or current tags.
|
||||
#
|
||||
# Templates: allowed.
|
||||
# Since: v1.21.
|
||||
ignore_tags:
|
||||
- nightly
|
||||
# - "{{.Env.IGNORE_TAG}}"
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ incpatch .Version }}-next"
|
||||
|
||||
@@ -519,4 +495,4 @@ checksum:
|
||||
algorithm: sha256
|
||||
|
||||
release:
|
||||
prerelease: auto
|
||||
prerelease: auto
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
ARG GO111MODULE=on
|
||||
ARG GOPROXY=https://goproxy.io,direct
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
WORKDIR /openim/openim-server
|
||||
|
||||
|
||||
+100
-3
@@ -15,17 +15,114 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/tools/discoveryregistry"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/internal/api"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
|
||||
kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister"
|
||||
ginProm "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
|
||||
)
|
||||
|
||||
func main() {
|
||||
apiCmd := cmd.NewApiCmd()
|
||||
apiCmd.AddPortFlag()
|
||||
apiCmd.AddPrometheusPortFlag()
|
||||
apiCmd.AddApi(run)
|
||||
if err := apiCmd.Execute(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
log.ZError(context.Background(), "API command execution failed", err)
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func run(port int, proPort int) error {
|
||||
log.ZInfo(context.Background(), "Openim api port:", "port", port, "proPort", proPort)
|
||||
|
||||
if port == 0 || proPort == 0 {
|
||||
err := "port or proPort is empty:" + strconv.Itoa(port) + "," + strconv.Itoa(proPort)
|
||||
log.ZError(context.Background(), err, nil)
|
||||
return fmt.Errorf(err)
|
||||
}
|
||||
|
||||
rdb, err := cache.NewRedis()
|
||||
if err != nil {
|
||||
log.ZError(context.Background(), "Failed to initialize Redis", err)
|
||||
return err
|
||||
}
|
||||
log.ZInfo(context.Background(), "api start init discov client")
|
||||
|
||||
var client discoveryregistry.SvcDiscoveryRegistry
|
||||
|
||||
// Determine whether zk is passed according to whether it is a clustered deployment
|
||||
client, err = kdisc.NewDiscoveryRegister(config.Config.Envs.Discovery)
|
||||
if err != nil {
|
||||
log.ZError(context.Background(), "Failed to initialize discovery register", err)
|
||||
return err
|
||||
}
|
||||
|
||||
if err = client.CreateRpcRootNodes(config.Config.GetServiceNames()); err != nil {
|
||||
log.ZError(context.Background(), "Failed to create RPC root nodes", err)
|
||||
return err
|
||||
}
|
||||
|
||||
log.ZInfo(context.Background(), "api register public config to discov")
|
||||
if err = client.RegisterConf2Registry(constant.OpenIMCommonConfigKey, config.Config.EncodeConfig()); err != nil {
|
||||
log.ZError(context.Background(), "Failed to register public config to discov", err)
|
||||
return err
|
||||
}
|
||||
|
||||
log.ZInfo(context.Background(), "api register public config to discov success")
|
||||
router := api.NewGinRouter(client, rdb)
|
||||
if config.Config.Prometheus.Enable {
|
||||
p := ginProm.NewPrometheus("app", prommetrics.GetGinCusMetrics("Api"))
|
||||
p.SetListenAddress(fmt.Sprintf(":%d", proPort))
|
||||
p.Use(router)
|
||||
}
|
||||
log.ZInfo(context.Background(), "api init router success")
|
||||
|
||||
var address string
|
||||
if config.Config.Api.ListenIP != "" {
|
||||
address = net.JoinHostPort(config.Config.Api.ListenIP, strconv.Itoa(port))
|
||||
} else {
|
||||
address = net.JoinHostPort("0.0.0.0", strconv.Itoa(port))
|
||||
}
|
||||
log.ZInfo(context.Background(), "start api server", "address", address, "OpenIM version", config.Version)
|
||||
|
||||
server := http.Server{Addr: address, Handler: router}
|
||||
go func() {
|
||||
err = server.ListenAndServe()
|
||||
if err != nil && err != http.ErrServerClosed {
|
||||
log.ZError(context.Background(), "api run failed", err, "address", address)
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||
<-sigs
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
|
||||
// graceful shutdown operation.
|
||||
if err := server.Shutdown(ctx); err != nil {
|
||||
log.ZError(context.Background(), "failed to api-server shutdown", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -55,6 +54,6 @@ func main() {
|
||||
// openIM clear msg --clearAll
|
||||
msgUtilsCmd.AddCommand(&getCmd.Command, &fixCmd.Command, &clearCmd.Command)
|
||||
if err := msgUtilsCmd.Execute(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/tools"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cronTaskCmd := cmd.NewCronTaskCmd()
|
||||
if err := cronTaskCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
if err := cronTaskCmd.Exec(tools.StartTask); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -24,7 +23,8 @@ func main() {
|
||||
msgGatewayCmd.AddWsPortFlag()
|
||||
msgGatewayCmd.AddPortFlag()
|
||||
msgGatewayCmd.AddPrometheusPortFlag()
|
||||
|
||||
if err := msgGatewayCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -24,6 +23,6 @@ func main() {
|
||||
msgTransferCmd.AddPrometheusPortFlag()
|
||||
msgTransferCmd.AddTransferProgressFlag()
|
||||
if err := msgTransferCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,17 @@ package main
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/push"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
pushCmd := cmd.NewRpcCmd(cmd.RpcPushServer, push.Start)
|
||||
pushCmd := cmd.NewRpcCmd(cmd.RpcPushServer)
|
||||
pushCmd.AddPortFlag()
|
||||
pushCmd.AddPrometheusPortFlag()
|
||||
if err := pushCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := pushCmd.StartSvr(config.Config.RpcRegisterName.OpenImPushName, push.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,17 @@ package main
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/auth"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
authCmd := cmd.NewRpcCmd(cmd.RpcAuthServer, auth.Start)
|
||||
authCmd := cmd.NewRpcCmd(cmd.RpcAuthServer)
|
||||
authCmd.AddPortFlag()
|
||||
authCmd.AddPrometheusPortFlag()
|
||||
if err := authCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := authCmd.StartSvr(config.Config.RpcRegisterName.OpenImAuthName, auth.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,17 @@ package main
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/conversation"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcConversationServer, conversation.Start)
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcConversationServer)
|
||||
rpcCmd.AddPortFlag()
|
||||
rpcCmd.AddPrometheusPortFlag()
|
||||
if err := rpcCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImConversationName, conversation.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,17 @@ package main
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/friend"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcFriendServer, friend.Start)
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcFriendServer)
|
||||
rpcCmd.AddPortFlag()
|
||||
rpcCmd.AddPrometheusPortFlag()
|
||||
if err := rpcCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImFriendName, friend.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,17 @@ package main
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/group"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcGroupServer, group.Start)
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcGroupServer)
|
||||
rpcCmd.AddPortFlag()
|
||||
rpcCmd.AddPrometheusPortFlag()
|
||||
if err := rpcCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImGroupName, group.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,17 @@ package main
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/msg"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcMsgServer, msg.Start)
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcMsgServer)
|
||||
rpcCmd.AddPortFlag()
|
||||
rpcCmd.AddPrometheusPortFlag()
|
||||
if err := rpcCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImMsgName, msg.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,17 @@ package main
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/third"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcThirdServer, third.Start)
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcThirdServer)
|
||||
rpcCmd.AddPortFlag()
|
||||
rpcCmd.AddPrometheusPortFlag()
|
||||
if err := rpcCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImThirdName, third.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,17 @@ package main
|
||||
import (
|
||||
"github.com/openimsdk/open-im-server/v3/internal/rpc/user"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcUserServer, user.Start)
|
||||
rpcCmd := cmd.NewRpcCmd(cmd.RpcUserServer)
|
||||
rpcCmd.AddPortFlag()
|
||||
rpcCmd.AddPrometheusPortFlag()
|
||||
if err := rpcCmd.Exec(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImUserName, user.Start); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# TODO: This config file is the template file
|
||||
# --| source: deployments/templates/config.yaml
|
||||
# --| source: deployments/templates/openim.yaml
|
||||
# --| env: scripts/install/environment
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
@@ -52,8 +52,8 @@ mongo:
|
||||
# Default MongoDB database name
|
||||
# Maximum connection pool size
|
||||
address: [ 172.28.0.1:37017 ]
|
||||
database: openim_v3
|
||||
username: openIM
|
||||
database: openIM_v3
|
||||
username: root
|
||||
password: openIM123
|
||||
maxPoolSize: 100
|
||||
|
||||
@@ -122,14 +122,14 @@ api:
|
||||
# minio.signEndpoint is minio public network address
|
||||
object:
|
||||
enable: "minio"
|
||||
apiURL: "http://172.28.0.1:10002"
|
||||
apiURL: "http://14.155.64.202:10002"
|
||||
minio:
|
||||
bucket: "openim"
|
||||
endpoint: "http://172.28.0.1:10005"
|
||||
accessKeyID: "root"
|
||||
secretAccessKey: "openIM123"
|
||||
sessionToken: ''
|
||||
signEndpoint: "http://172.28.0.1:10005"
|
||||
signEndpoint: "http://14.155.64.202:10005"
|
||||
publicRead: false
|
||||
cos:
|
||||
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
|
||||
@@ -153,13 +153,6 @@ object:
|
||||
accessKeySecret: ''
|
||||
sessionToken: ''
|
||||
publicRead: false
|
||||
aws:
|
||||
endpoint: ""
|
||||
region: ""
|
||||
bucket: "demo-9999999"
|
||||
accessKeyID: ''
|
||||
accessKeySecret: ''
|
||||
publicRead: false
|
||||
|
||||
###################### RPC Port Configuration ######################
|
||||
# RPC service ports
|
||||
@@ -200,7 +193,7 @@ rpcRegisterName:
|
||||
# Whether to output in json format
|
||||
# Whether to include stack trace in logs
|
||||
log:
|
||||
storageLocation: /workspaces/open-im-server/logs/
|
||||
storageLocation: /data/workspaces/open-im-server/logs/
|
||||
rotationTime: 24
|
||||
remainRotationCount: 2
|
||||
remainLogLevel: 6
|
||||
@@ -254,14 +247,6 @@ manager:
|
||||
userID: [ "openIM123456", "openIM654321", "openIMAdmin" ]
|
||||
nickname: [ "system1", "system2", "system3" ]
|
||||
|
||||
# chatAdmin, use for send notification
|
||||
#
|
||||
# Built-in app system notification account ID
|
||||
# Built-in app system notification account nickname
|
||||
im-admin:
|
||||
userID: [ "imAdmin" ]
|
||||
nickname: [ "imAdmin" ]
|
||||
|
||||
# Multi-platform login policy
|
||||
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
||||
multiLoginPolicy: 1
|
||||
@@ -322,21 +307,13 @@ iosPush:
|
||||
# Timeout in seconds
|
||||
# Whether to continue execution if callback fails
|
||||
callback:
|
||||
url: "http://127.0.0.1:10008/callbackExample"
|
||||
url: ""
|
||||
beforeSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeUpdateUserInfoEx:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterUpdateUserInfoEx:
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
afterSendSingleMsg:
|
||||
enable: true
|
||||
enable: false
|
||||
timeout: 5
|
||||
failedContinue: true
|
||||
beforeSendGroupMsg:
|
||||
@@ -520,8 +497,8 @@ callback:
|
||||
# The number of Prometheus ports per service needs to correspond to rpcPort
|
||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||
prometheus:
|
||||
enable: true
|
||||
grafanaUrl: http://172.28.0.1:13000/
|
||||
enable: false
|
||||
prometheusUrl: 172.28.0.1:13000
|
||||
apiPrometheusPort: [20100]
|
||||
userPrometheusPort: [ 20110 ]
|
||||
friendPrometheusPort: [ 20120 ]
|
||||
|
||||
+107
-84
@@ -1,4 +1,4 @@
|
||||
# Copyright © 2024 OpenIM. All rights reserved.
|
||||
# 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.
|
||||
@@ -12,26 +12,31 @@
|
||||
# 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.
|
||||
# These options can be set via environment variables. If both environment variables
|
||||
# and settings in this .env file exist, the environment variables take precedence.
|
||||
# -----------------------------------------------------------------------------
|
||||
# ==========================
|
||||
# General Configuration
|
||||
# ==========================
|
||||
# These settings apply to the overall environment.
|
||||
# ======================================
|
||||
# ========= Basic Configuration ========
|
||||
# ======================================
|
||||
|
||||
# Data storage directory for persistent data.
|
||||
# Example: DATA_DIR=/path/to/data
|
||||
DATA_DIR=/workspaces/open-im-server
|
||||
# The user for authentication or system operations.
|
||||
# Default: OPENIM_USER=root
|
||||
USER=root
|
||||
|
||||
# Docker image registry. Uncomment the preferred one.
|
||||
# Options: ghcr.io/openimsdk, openim, registry.cn-hangzhou.aliyuncs.com/openimsdk
|
||||
# IMAGE_REGISTRY="ghcr.io/openimsdk"
|
||||
# IMAGE_REGISTRY="openim"
|
||||
# IMAGE_REGISTRY="registry.cn-hangzhou.aliyuncs.com/openimsdk"
|
||||
# Password associated with the specified user for authentication.
|
||||
# Default: PASSWORD=openIM123
|
||||
PASSWORD=openIM123
|
||||
|
||||
# Base URL for the application programming interface (API).
|
||||
# Default: API_URL=http://172.28.0.1:10002
|
||||
API_URL=http://14.155.64.202:10002
|
||||
|
||||
# Directory path for storing data files or related information.
|
||||
# Default: DATA_DIR=./
|
||||
DATA_DIR=/data/workspaces/open-im-server
|
||||
|
||||
# Choose the appropriate image address, the default is GITHUB image,
|
||||
# you can choose docker hub, for Chinese users can choose Ali Cloud
|
||||
# export IMAGE_REGISTRY="ghcr.io/openimsdk"
|
||||
# export IMAGE_REGISTRY="openim"
|
||||
# export IMAGE_REGISTRY="registry.cn-hangzhou.aliyuncs.com/openimsdk"
|
||||
IMAGE_REGISTRY=ghcr.io/openimsdk
|
||||
|
||||
# ======================================
|
||||
@@ -42,9 +47,10 @@ IMAGE_REGISTRY=ghcr.io/openimsdk
|
||||
# Default: DOCKER_BRIDGE_SUBNET=172.28.0.0/16
|
||||
DOCKER_BRIDGE_SUBNET=172.28.0.0/16
|
||||
|
||||
# Set and specify the IP addresses of some containers. Generally speaking,
|
||||
# you do not need to modify these configurations to facilitate debugging
|
||||
# Gateway for the Docker network.
|
||||
# Default: DOCKER_BRIDGE_GATEWAY=172.28.0.1
|
||||
DOCKER_BRIDGE_GATEWAY=172.28.0.1
|
||||
|
||||
MONGO_NETWORK_ADDRESS=172.28.0.2
|
||||
REDIS_NETWORK_ADDRESS=172.28.0.3
|
||||
KAFKA_NETWORK_ADDRESS=172.28.0.4
|
||||
@@ -59,67 +65,45 @@ NODE_EXPORTER_NETWORK_ADDRESS=172.28.0.12
|
||||
OPENIM_ADMIN_FRONT_NETWORK_ADDRESS=172.28.0.13
|
||||
ALERT_MANAGER_NETWORK_ADDRESS=172.28.0.14
|
||||
|
||||
# ==============================================================================
|
||||
# Configuration Update Instructions
|
||||
# ==============================================================================
|
||||
# This header outlines the methods to update common variables in config.yaml and .env files.
|
||||
# These instructions are vital for maintaining the OpenIM environment's configuration.
|
||||
#
|
||||
# METHOD 1: Regenerate All Configurations
|
||||
# ----------------------------------------
|
||||
# Use this method to regenerate all configurations.
|
||||
# Steps:
|
||||
# 1. Delete existing config files:
|
||||
# - openim-server/config/config.yaml
|
||||
# - openim-chat/config/config.yaml
|
||||
# 2. Modify the .env file as required.
|
||||
# 3. Run 'docker compose up -d'. This will regenerate:
|
||||
# - config/config.yaml
|
||||
#
|
||||
# METHOD 2: Modify Individual Configuration Files
|
||||
# -----------------------------------------------
|
||||
# Use this method to update specific configuration files.
|
||||
# Steps:
|
||||
# 1. Modify the .env file as necessary.
|
||||
# 2. Update the corresponding entries in:
|
||||
# - config/config.yaml
|
||||
# 3. Restart the services with 'docker compose up -d'.
|
||||
# 4. Special Note: If you modify OPENIM_IP, API_OPENIM_PORT, or MINIO_PORT in .env,
|
||||
# ensure to update the corresponding services and configurations accordingly.
|
||||
#
|
||||
# It is essential to follow these methods to ensure consistent and correct application behavior.
|
||||
# ==============================================================================
|
||||
# Local IP address of the service. Modify if necessary.
|
||||
# Example: OPENIM_IP=172.28.0.1,
|
||||
OPENIM_IP=172.28.0.1
|
||||
# ===============================================
|
||||
# = Component Extension Configuration =
|
||||
# ===============================================
|
||||
|
||||
# ============ Component Extension Configuration ==========
|
||||
# ----- ZooKeeper Configuration -----
|
||||
# Address or hostname for the ZooKeeper service.
|
||||
# Default: ZOOKEEPER_ADDRESS=172.28.0.1
|
||||
ZOOKEEPER_ADDRESS=172.28.0.5
|
||||
|
||||
# Port for ZooKeeper service.
|
||||
# Default: ZOOKEEPER_PORT=12181
|
||||
ZOOKEEPER_PORT=12181
|
||||
|
||||
# MongoDB service port configuration.
|
||||
# ----- MongoDB Configuration -----
|
||||
# Address or hostname for the MongoDB service.
|
||||
# Default: MONGO_ADDRESS=172.28.0.1
|
||||
MONGO_ADDRESS=172.28.0.2
|
||||
|
||||
# Port on which MongoDB service is running.
|
||||
# Default: MONGO_PORT=37017
|
||||
# MONGO_PORT=37017
|
||||
|
||||
# Password for MongoDB admin user. Used for service authentication.
|
||||
# Username to authenticate with the MongoDB service.
|
||||
# Default: MONGO_USERNAME=root
|
||||
# MONGO_USERNAME=root
|
||||
|
||||
# Password to authenticate with the MongoDB service.
|
||||
# Default: MONGO_PASSWORD=openIM123
|
||||
MONGO_PASSWORD=openIM123
|
||||
|
||||
# Username for a regular OpenIM user in MongoDB.
|
||||
# Default: MONGO_OPENIM_USERNAME=openIM
|
||||
MONGO_OPENIM_USERNAME=openIM
|
||||
# Name of the database in MongoDB to be used.
|
||||
# Default: MONGO_DATABASE=openIM_v3
|
||||
MONGO_DATABASE=openIM_v3
|
||||
|
||||
# Password for a regular OpenIM user in MongoDB.
|
||||
# Default: MONGO_OPENIM_PASSWORD=openIM123456
|
||||
MONGO_OPENIM_PASSWORD=openIM123
|
||||
|
||||
# Specifies the database name to be used within MongoDB.
|
||||
# Default: MONGO_DATABASE=openim_v3
|
||||
MONGO_DATABASE=openim_v3
|
||||
|
||||
MONGO_MAX_POOL_SIZE=100
|
||||
# ----- Redis Configuration -----
|
||||
# Address or hostname for the Redis service.
|
||||
# Default: REDIS_ADDRESS=172.28.0.1
|
||||
REDIS_ADDRESS=172.28.0.3
|
||||
|
||||
# Port on which Redis in-memory data structure store is running.
|
||||
# Default: REDIS_PORT=16379
|
||||
@@ -129,6 +113,11 @@ REDIS_PORT=16379
|
||||
# Default: REDIS_PASSWORD=openIM123
|
||||
REDIS_PASSWORD=openIM123
|
||||
|
||||
# ----- Kafka Configuration -----
|
||||
# Address or hostname for the Kafka service.
|
||||
# Default: KAFKA_ADDRESS=172.28.0.1
|
||||
KAFKA_ADDRESS=172.28.0.4
|
||||
|
||||
# Kakfa username to authenticate with the Kafka service.
|
||||
# KAFKA_USERNAME=''
|
||||
|
||||
@@ -140,13 +129,20 @@ KAFKA_PORT=19094
|
||||
# Default: KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
|
||||
KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
|
||||
|
||||
# MINIO_PORT
|
||||
# ----------
|
||||
# MINIO_PORT sets the port for the MinIO object storage service.
|
||||
# Upon changing this port, the MinIO endpoint URLs in the file must be updated
|
||||
# to reflect this change. The endpoints include both the 'endpoint' and 'signEndpoint'
|
||||
# under the MinIO configuration.
|
||||
#
|
||||
# Topic in Kafka for pushing messages (e.g. notifications or updates).
|
||||
# Default: KAFKA_MSG_PUSH_TOPIC=msgToPush
|
||||
KAFKA_MSG_PUSH_TOPIC=msgToPush
|
||||
|
||||
# Topic in Kafka for storing offline messages in MongoDB.
|
||||
# Default: KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
|
||||
KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
|
||||
|
||||
# ----- MinIO Configuration ----
|
||||
# Address or hostname for the MinIO object storage service.
|
||||
# Default: MINIO_ADDRESS=172.28.0.1
|
||||
MINIO_ADDRESS=172.28.0.6
|
||||
|
||||
# Port on which MinIO object storage service is running.
|
||||
# Default: MINIO_PORT=10005
|
||||
MINIO_PORT=10005
|
||||
|
||||
@@ -159,11 +155,19 @@ MINIO_PORT=10005
|
||||
MINIO_SECRET_KEY=openIM123
|
||||
|
||||
# ----- Prometheus Configuration -----
|
||||
# Address or hostname for the Prometheus service.
|
||||
# Default: PROMETHEUS_ADDRESS=172.28.0.1
|
||||
PROMETHEUS_ADDRESS=172.28.0.10
|
||||
|
||||
# Port on which Prometheus service is running.
|
||||
# Default: PROMETHEUS_PORT=19090
|
||||
PROMETHEUS_PORT=19090
|
||||
|
||||
# ----- Grafana Configuration -----
|
||||
# Address or hostname for the Grafana service.
|
||||
# Default: GRAFANA_ADDRESS=172.28.0.1
|
||||
GRAFANA_ADDRESS=172.28.0.11
|
||||
|
||||
# Port on which Grafana service is running.
|
||||
# Default: GRAFANA_PORT=13000
|
||||
GRAFANA_PORT=13000
|
||||
@@ -172,41 +176,56 @@ GRAFANA_PORT=13000
|
||||
# ============ OpenIM Web ===============
|
||||
# ======================================
|
||||
|
||||
# Path to the OpenIM web distribution.
|
||||
# Default: OPENIM_WEB_DIST_PATH=/app/dist
|
||||
OPENIM_WEB_DIST_PATH=/app/dist
|
||||
|
||||
# Port on which OpenIM web service is running.
|
||||
# Default: OPENIM_WEB_PORT=11001
|
||||
OPENIM_WEB_PORT=11001
|
||||
|
||||
# Address or hostname for the OpenIM web service.
|
||||
# Default: OPENIM_WEB_ADDRESS=172.28.0.1
|
||||
OPENIM_WEB_ADDRESS=172.28.0.7
|
||||
|
||||
# ======================================
|
||||
# ========= OpenIM Server ==============
|
||||
# ======================================
|
||||
|
||||
# Address or hostname for the OpenIM server.
|
||||
# Default: OPENIM_SERVER_ADDRESS=172.28.0.1
|
||||
OPENIM_SERVER_ADDRESS=172.28.0.8
|
||||
|
||||
# Port for the OpenIM WebSockets.
|
||||
# Default: OPENIM_WS_PORT=10001
|
||||
OPENIM_WS_PORT=10001
|
||||
|
||||
# API_OPENIM_PORT
|
||||
# ---------------
|
||||
# This variable defines the port on which the OpenIM API service will listen.
|
||||
# When changing this port, it's essential to update the apiURL in the config.yaml file
|
||||
# to ensure the API service is accessible at the new port.
|
||||
#
|
||||
# Port for the OpenIM API.
|
||||
# Default: API_OPENIM_PORT=10002
|
||||
API_OPENIM_PORT=10002
|
||||
|
||||
|
||||
# ======================================
|
||||
# ========== OpenIM Chat ===============
|
||||
# ======================================
|
||||
|
||||
# Branch name for OpenIM chat.
|
||||
# Default: CHAT_IMAGE_VERSION=main
|
||||
# https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md
|
||||
CHAT_IMAGE_VERSION=main
|
||||
|
||||
# Address or hostname for the OpenIM chat service.
|
||||
# Default: OPENIM_CHAT_ADDRESS=172.28.0.1
|
||||
OPENIM_CHAT_ADDRESS=172.28.0.9
|
||||
|
||||
# Port for the OpenIM chat API.
|
||||
# Default: OPENIM_CHAT_API_PORT=10008
|
||||
OPENIM_CHAT_API_PORT=10008
|
||||
|
||||
# Port for the OpenIM admin API.
|
||||
# Default: OPENIM_ADMIN_API_PORT=10009
|
||||
OPENIM_ADMIN_API_PORT=10009
|
||||
# Directory path for storing data files or related information for OpenIM chat.
|
||||
# Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main
|
||||
OPENIM_CHAT_DATA_DIR=./openim-chat/main
|
||||
|
||||
|
||||
# ======================================
|
||||
# ========== OpenIM Admin ==============
|
||||
@@ -215,6 +234,10 @@ OPENIM_ADMIN_API_PORT=10009
|
||||
# Branch name for OpenIM server.
|
||||
# Default: SERVER_IMAGE_VERSION=main
|
||||
SERVER_IMAGE_VERSION=main
|
||||
|
||||
# Port for the OpenIM admin API.
|
||||
# Default: OPENIM_ADMIN_API_PORT=10009
|
||||
OPENIM_ADMIN_API_PORT=10009
|
||||
|
||||
# Port for the node exporter.
|
||||
# Default: NODE_EXPORTER_PORT=19100
|
||||
|
||||
@@ -169,4 +169,4 @@ server {
|
||||
|
||||
proxy_pass http://minio_console_2; # This uses the upstream directive definition to load balance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
},
|
||||
"id": 16,
|
||||
"panels": [],
|
||||
"title": "openim Custom Metrics",
|
||||
"title": "openim自定义指标",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
@@ -144,7 +144,7 @@
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Online population",
|
||||
"title": "在线人数",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
@@ -235,7 +235,7 @@
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Login/registration numbers",
|
||||
"title": "登入/注册人数",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
@@ -1345,7 +1345,7 @@
|
||||
"type": "timeseries"
|
||||
}
|
||||
],
|
||||
"title": "Traffic indicators of the application server",
|
||||
"title": "应用服务器流量指标",
|
||||
"type": "row"
|
||||
}
|
||||
],
|
||||
@@ -1471,4 +1471,4 @@
|
||||
"uid": "f5f5de9a-6ec5-499a-841e-6e901c33b1f7",
|
||||
"version": 16,
|
||||
"weekStart": ""
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ export MINIO_ENDPOINT="http://im-minio:9000"
|
||||
export MINIO_SIGN_ENDPOINT="https://openim.server.com/im-minio-api"
|
||||
|
||||
mkdir ./charts/generated-configs
|
||||
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/config.yaml > ./charts/generated-configs/config.yaml
|
||||
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/openim.yaml > ./charts/generated-configs/config.yaml
|
||||
cp ../config/notification.yaml ./charts/generated-configs/notification.yaml
|
||||
../scripts/genconfig.sh ../scripts/install/environment.sh ./templates/helm-image.yaml > ./charts/generated-configs/helm-image.yaml
|
||||
```
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
# Copyright © 2024 OpenIM. All rights reserved.
|
||||
# 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.
|
||||
@@ -12,26 +12,31 @@
|
||||
# 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.
|
||||
# These options can be set via environment variables. If both environment variables
|
||||
# and settings in this .env file exist, the environment variables take precedence.
|
||||
# -----------------------------------------------------------------------------
|
||||
# ==========================
|
||||
# General Configuration
|
||||
# ==========================
|
||||
# These settings apply to the overall environment.
|
||||
# ======================================
|
||||
# ========= Basic Configuration ========
|
||||
# ======================================
|
||||
|
||||
# Data storage directory for persistent data.
|
||||
# Example: DATA_DIR=/path/to/data
|
||||
# The user for authentication or system operations.
|
||||
# Default: OPENIM_USER=root
|
||||
USER=${OPENIM_USER}
|
||||
|
||||
# Password associated with the specified user for authentication.
|
||||
# Default: PASSWORD=openIM123
|
||||
PASSWORD=${PASSWORD}
|
||||
|
||||
# Base URL for the application programming interface (API).
|
||||
# Default: API_URL=http://172.28.0.1:10002
|
||||
API_URL=${API_URL}
|
||||
|
||||
# Directory path for storing data files or related information.
|
||||
# Default: DATA_DIR=./
|
||||
DATA_DIR=${DATA_DIR}
|
||||
|
||||
# Docker image registry. Uncomment the preferred one.
|
||||
# Options: ghcr.io/openimsdk, openim, registry.cn-hangzhou.aliyuncs.com/openimsdk
|
||||
# IMAGE_REGISTRY="ghcr.io/openimsdk"
|
||||
# IMAGE_REGISTRY="openim"
|
||||
# IMAGE_REGISTRY="registry.cn-hangzhou.aliyuncs.com/openimsdk"
|
||||
# Choose the appropriate image address, the default is GITHUB image,
|
||||
# you can choose docker hub, for Chinese users can choose Ali Cloud
|
||||
# export IMAGE_REGISTRY="ghcr.io/openimsdk"
|
||||
# export IMAGE_REGISTRY="openim"
|
||||
# export IMAGE_REGISTRY="registry.cn-hangzhou.aliyuncs.com/openimsdk"
|
||||
IMAGE_REGISTRY=${IMAGE_REGISTRY}
|
||||
|
||||
# ======================================
|
||||
@@ -42,9 +47,10 @@ IMAGE_REGISTRY=${IMAGE_REGISTRY}
|
||||
# Default: DOCKER_BRIDGE_SUBNET=172.28.0.0/16
|
||||
DOCKER_BRIDGE_SUBNET=${DOCKER_BRIDGE_SUBNET}
|
||||
|
||||
# Set and specify the IP addresses of some containers. Generally speaking,
|
||||
# you do not need to modify these configurations to facilitate debugging
|
||||
# Gateway for the Docker network.
|
||||
# Default: DOCKER_BRIDGE_GATEWAY=172.28.0.1
|
||||
DOCKER_BRIDGE_GATEWAY=${DOCKER_BRIDGE_GATEWAY}
|
||||
|
||||
MONGO_NETWORK_ADDRESS=${MONGO_NETWORK_ADDRESS}
|
||||
REDIS_NETWORK_ADDRESS=${REDIS_NETWORK_ADDRESS}
|
||||
KAFKA_NETWORK_ADDRESS=${KAFKA_NETWORK_ADDRESS}
|
||||
@@ -59,67 +65,45 @@ NODE_EXPORTER_NETWORK_ADDRESS=${NODE_EXPORTER_NETWORK_ADDRESS}
|
||||
OPENIM_ADMIN_FRONT_NETWORK_ADDRESS=${OPENIM_ADMIN_FRONT_NETWORK_ADDRESS}
|
||||
ALERT_MANAGER_NETWORK_ADDRESS=${ALERT_MANAGER_NETWORK_ADDRESS}
|
||||
|
||||
# ==============================================================================
|
||||
# Configuration Update Instructions
|
||||
# ==============================================================================
|
||||
# This header outlines the methods to update common variables in config.yaml and .env files.
|
||||
# These instructions are vital for maintaining the OpenIM environment's configuration.
|
||||
#
|
||||
# METHOD 1: Regenerate All Configurations
|
||||
# ----------------------------------------
|
||||
# Use this method to regenerate all configurations.
|
||||
# Steps:
|
||||
# 1. Delete existing config files:
|
||||
# - openim-server/config/config.yaml
|
||||
# - openim-chat/config/config.yaml
|
||||
# 2. Modify the .env file as required.
|
||||
# 3. Run 'docker compose up -d'. This will regenerate:
|
||||
# - config/config.yaml
|
||||
#
|
||||
# METHOD 2: Modify Individual Configuration Files
|
||||
# -----------------------------------------------
|
||||
# Use this method to update specific configuration files.
|
||||
# Steps:
|
||||
# 1. Modify the .env file as necessary.
|
||||
# 2. Update the corresponding entries in:
|
||||
# - config/config.yaml
|
||||
# 3. Restart the services with 'docker compose up -d'.
|
||||
# 4. Special Note: If you modify OPENIM_IP, API_OPENIM_PORT, or MINIO_PORT in .env,
|
||||
# ensure to update the corresponding services and configurations accordingly.
|
||||
#
|
||||
# It is essential to follow these methods to ensure consistent and correct application behavior.
|
||||
# ==============================================================================
|
||||
# Local IP address of the service. Modify if necessary.
|
||||
# Example: OPENIM_IP=172.28.0.1,
|
||||
OPENIM_IP=${OPENIM_IP}
|
||||
# ===============================================
|
||||
# = Component Extension Configuration =
|
||||
# ===============================================
|
||||
|
||||
# ============ Component Extension Configuration ==========
|
||||
# ----- ZooKeeper Configuration -----
|
||||
# Address or hostname for the ZooKeeper service.
|
||||
# Default: ZOOKEEPER_ADDRESS=172.28.0.1
|
||||
ZOOKEEPER_ADDRESS=${ZOOKEEPER_NETWORK_ADDRESS}
|
||||
|
||||
# Port for ZooKeeper service.
|
||||
# Default: ZOOKEEPER_PORT=12181
|
||||
ZOOKEEPER_PORT=${ZOOKEEPER_PORT}
|
||||
|
||||
# MongoDB service port configuration.
|
||||
# Default: MONGO_PORT=37017
|
||||
MONGO_PORT=${MONGO_PORT}
|
||||
# ----- MongoDB Configuration -----
|
||||
# Address or hostname for the MongoDB service.
|
||||
# Default: MONGO_ADDRESS=172.28.0.1
|
||||
MONGO_ADDRESS=${MONGO_NETWORK_ADDRESS}
|
||||
|
||||
# Password for MongoDB admin user. Used for service authentication.
|
||||
# Port on which MongoDB service is running.
|
||||
# Default: MONGO_PORT=37017
|
||||
# MONGO_PORT=${MONGO_PORT}
|
||||
|
||||
# Username to authenticate with the MongoDB service.
|
||||
# Default: MONGO_USERNAME=root
|
||||
# MONGO_USERNAME=${MONGO_USERNAME}
|
||||
|
||||
# Password to authenticate with the MongoDB service.
|
||||
# Default: MONGO_PASSWORD=openIM123
|
||||
MONGO_PASSWORD=${MONGO_PASSWORD}
|
||||
|
||||
# Username for a regular OpenIM user in MongoDB.
|
||||
# Default: MONGO_OPENIM_USERNAME=openIM
|
||||
MONGO_OPENIM_USERNAME=${MONGO_OPENIM_USERNAME}
|
||||
|
||||
# Password for a regular OpenIM user in MongoDB.
|
||||
# Default: MONGO_OPENIM_PASSWORD=openIM123456
|
||||
MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD}
|
||||
|
||||
# Specifies the database name to be used within MongoDB.
|
||||
# Default: MONGO_DATABASE=openim_v3
|
||||
# Name of the database in MongoDB to be used.
|
||||
# Default: MONGO_DATABASE=openIM_v3
|
||||
MONGO_DATABASE=${MONGO_DATABASE}
|
||||
|
||||
MONGO_MAX_POOL_SIZE=${MONGO_MAX_POOL_SIZE}
|
||||
# ----- Redis Configuration -----
|
||||
# Address or hostname for the Redis service.
|
||||
# Default: REDIS_ADDRESS=172.28.0.1
|
||||
REDIS_ADDRESS=${REDIS_NETWORK_ADDRESS}
|
||||
|
||||
# Port on which Redis in-memory data structure store is running.
|
||||
# Default: REDIS_PORT=16379
|
||||
@@ -129,6 +113,11 @@ REDIS_PORT=${REDIS_PORT}
|
||||
# Default: REDIS_PASSWORD=openIM123
|
||||
REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
|
||||
# ----- Kafka Configuration -----
|
||||
# Address or hostname for the Kafka service.
|
||||
# Default: KAFKA_ADDRESS=172.28.0.1
|
||||
KAFKA_ADDRESS=${KAFKA_NETWORK_ADDRESS}
|
||||
|
||||
# Kakfa username to authenticate with the Kafka service.
|
||||
# KAFKA_USERNAME=${KAFKA_USERNAME}
|
||||
|
||||
@@ -140,13 +129,20 @@ KAFKA_PORT=${KAFKA_PORT}
|
||||
# Default: KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
|
||||
KAFKA_LATESTMSG_REDIS_TOPIC=${KAFKA_LATESTMSG_REDIS_TOPIC}
|
||||
|
||||
# MINIO_PORT
|
||||
# ----------
|
||||
# MINIO_PORT sets the port for the MinIO object storage service.
|
||||
# Upon changing this port, the MinIO endpoint URLs in the config/config.yaml file must be updated
|
||||
# to reflect this change. The endpoints include both the 'endpoint' and 'signEndpoint'
|
||||
# under the MinIO configuration.
|
||||
#
|
||||
# Topic in Kafka for pushing messages (e.g. notifications or updates).
|
||||
# Default: KAFKA_MSG_PUSH_TOPIC=msgToPush
|
||||
KAFKA_MSG_PUSH_TOPIC=${KAFKA_MSG_PUSH_TOPIC}
|
||||
|
||||
# Topic in Kafka for storing offline messages in MongoDB.
|
||||
# Default: KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
|
||||
KAFKA_OFFLINEMSG_MONGO_TOPIC=${KAFKA_OFFLINEMSG_MONGO_TOPIC}
|
||||
|
||||
# ----- MinIO Configuration ----
|
||||
# Address or hostname for the MinIO object storage service.
|
||||
# Default: MINIO_ADDRESS=172.28.0.1
|
||||
MINIO_ADDRESS=${MINIO_NETWORK_ADDRESS}
|
||||
|
||||
# Port on which MinIO object storage service is running.
|
||||
# Default: MINIO_PORT=10005
|
||||
MINIO_PORT=${MINIO_PORT}
|
||||
|
||||
@@ -159,11 +155,19 @@ MINIO_PORT=${MINIO_PORT}
|
||||
MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
|
||||
|
||||
# ----- Prometheus Configuration -----
|
||||
# Address or hostname for the Prometheus service.
|
||||
# Default: PROMETHEUS_ADDRESS=172.28.0.1
|
||||
PROMETHEUS_ADDRESS=${PROMETHEUS_NETWORK_ADDRESS}
|
||||
|
||||
# Port on which Prometheus service is running.
|
||||
# Default: PROMETHEUS_PORT=19090
|
||||
PROMETHEUS_PORT=${PROMETHEUS_PORT}
|
||||
|
||||
# ----- Grafana Configuration -----
|
||||
# Address or hostname for the Grafana service.
|
||||
# Default: GRAFANA_ADDRESS=172.28.0.1
|
||||
GRAFANA_ADDRESS=${GRAFANA_NETWORK_ADDRESS}
|
||||
|
||||
# Port on which Grafana service is running.
|
||||
# Default: GRAFANA_PORT=13000
|
||||
GRAFANA_PORT=${GRAFANA_PORT}
|
||||
@@ -172,26 +176,35 @@ GRAFANA_PORT=${GRAFANA_PORT}
|
||||
# ============ OpenIM Web ===============
|
||||
# ======================================
|
||||
|
||||
# Path to the OpenIM web distribution.
|
||||
# Default: OPENIM_WEB_DIST_PATH=/app/dist
|
||||
OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH}
|
||||
|
||||
# Port on which OpenIM web service is running.
|
||||
# Default: OPENIM_WEB_PORT=11001
|
||||
OPENIM_WEB_PORT=${OPENIM_WEB_PORT}
|
||||
|
||||
# Address or hostname for the OpenIM web service.
|
||||
# Default: OPENIM_WEB_ADDRESS=172.28.0.1
|
||||
OPENIM_WEB_ADDRESS=${OPENIM_WEB_NETWORK_ADDRESS}
|
||||
|
||||
# ======================================
|
||||
# ========= OpenIM Server ==============
|
||||
# ======================================
|
||||
|
||||
# Address or hostname for the OpenIM server.
|
||||
# Default: OPENIM_SERVER_ADDRESS=172.28.0.1
|
||||
OPENIM_SERVER_ADDRESS=${OPENIM_SERVER_NETWORK_ADDRESS}
|
||||
|
||||
# Port for the OpenIM WebSockets.
|
||||
# Default: OPENIM_WS_PORT=10001
|
||||
OPENIM_WS_PORT=${OPENIM_WS_PORT}
|
||||
|
||||
# API_OPENIM_PORT
|
||||
# ---------------
|
||||
# This variable defines the port on which the OpenIM API service will listen.
|
||||
# When changing this port, it's essential to update the apiURL in the config.yaml file
|
||||
# to ensure the API service is accessible at the new port.
|
||||
#
|
||||
# Port for the OpenIM API.
|
||||
# Default: API_OPENIM_PORT=10002
|
||||
API_OPENIM_PORT=${API_OPENIM_PORT}
|
||||
|
||||
|
||||
# ======================================
|
||||
# ========== OpenIM Chat ===============
|
||||
# ======================================
|
||||
@@ -200,13 +213,18 @@ API_OPENIM_PORT=${API_OPENIM_PORT}
|
||||
# Default: CHAT_IMAGE_VERSION=main
|
||||
CHAT_IMAGE_VERSION=${CHAT_IMAGE_VERSION}
|
||||
|
||||
# Address or hostname for the OpenIM chat service.
|
||||
# Default: OPENIM_CHAT_ADDRESS=172.28.0.1
|
||||
OPENIM_CHAT_ADDRESS=${OPENIM_CHAT_NETWORK_ADDRESS}
|
||||
|
||||
# Port for the OpenIM chat API.
|
||||
# Default: OPENIM_CHAT_API_PORT=10008
|
||||
OPENIM_CHAT_API_PORT=${OPENIM_CHAT_API_PORT}
|
||||
|
||||
# Port for the OpenIM admin API.
|
||||
# Default: OPENIM_ADMIN_API_PORT=10009
|
||||
OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT}
|
||||
# Directory path for storing data files or related information for OpenIM chat.
|
||||
# Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main
|
||||
OPENIM_CHAT_DATA_DIR=${OPENIM_CHAT_DATA_DIR}
|
||||
|
||||
|
||||
# ======================================
|
||||
# ========== OpenIM Admin ==============
|
||||
@@ -215,6 +233,10 @@ OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT}
|
||||
# Branch name for OpenIM server.
|
||||
# Default: SERVER_IMAGE_VERSION=main
|
||||
SERVER_IMAGE_VERSION=${SERVER_IMAGE_VERSION}
|
||||
|
||||
# Port for the OpenIM admin API.
|
||||
# Default: OPENIM_ADMIN_API_PORT=10009
|
||||
OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT}
|
||||
|
||||
# Port for the node exporter.
|
||||
# Default: NODE_EXPORTER_PORT=19100
|
||||
@@ -234,4 +256,4 @@ OPENIM_ADMIN_FRONT_PORT=${OPENIM_ADMIN_FRONT_PORT}
|
||||
|
||||
# Port for the alertmanager.
|
||||
# Default: ALERT_MANAGER_PORT=19093
|
||||
ALERT_MANAGER_PORT=${ALERT_MANAGER_PORT}
|
||||
ALERT_MANAGER_PORT=${ALERT_MANAGER_PORT}
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# TODO: This config file is the template file
|
||||
# --| source: deployments/templates/config.yaml
|
||||
# --| source: deployments/templates/openim.yaml
|
||||
# --| env: scripts/install/environment
|
||||
# --| target: config/config.yaml
|
||||
# -----------------------------------------------------------------
|
||||
@@ -53,8 +53,8 @@ mongo:
|
||||
# Maximum connection pool size
|
||||
address: [ ${MONGO_ADDRESS}:${MONGO_PORT} ]
|
||||
database: ${MONGO_DATABASE}
|
||||
username: ${MONGO_OPENIM_USERNAME}
|
||||
password: ${MONGO_OPENIM_PASSWORD}
|
||||
username: ${MONGO_USERNAME}
|
||||
password: ${MONGO_PASSWORD}
|
||||
maxPoolSize: ${MONGO_MAX_POOL_SIZE}
|
||||
|
||||
###################### Redis configuration information ######################
|
||||
@@ -153,13 +153,6 @@ object:
|
||||
accessKeySecret: ${KODO_ACCESS_KEY_SECRET}
|
||||
sessionToken: ${KODO_SESSION_TOKEN}
|
||||
publicRead: ${KODO_PUBLIC_READ}
|
||||
aws:
|
||||
endpoint: "${AWS_ENDPOINT}" # This might not be necessary unless you're using a custom endpoint
|
||||
region: "${AWS_REGION}"
|
||||
bucket: "${AWS_BUCKET}"
|
||||
accessKeyID: ${AWS_ACCESS_KEY_ID}
|
||||
accessKeySecret: ${AWS_SECRET_ACCESS_KEY}
|
||||
publicRead: ${AWS_PUBLIC_READ}
|
||||
|
||||
###################### RPC Port Configuration ######################
|
||||
# RPC service ports
|
||||
@@ -250,10 +243,9 @@ push:
|
||||
#
|
||||
# Built-in app manager user IDs
|
||||
# Built-in app manager nicknames
|
||||
# Attention, this configure is discarded. If you have used him before, configure your own
|
||||
manager:
|
||||
userID:
|
||||
nickname:
|
||||
userID: [ "${MANAGER_USERID_1}", "${MANAGER_USERID_2}", "${MANAGER_USERID_3}" ]
|
||||
nickname: [ "${NICKNAME_1}", "${NICKNAME_2}", "${NICKNAME_3}" ]
|
||||
|
||||
# chatAdmin, use for send notification
|
||||
#
|
||||
@@ -323,19 +315,11 @@ iosPush:
|
||||
# Timeout in seconds
|
||||
# Whether to continue execution if callback fails
|
||||
callback:
|
||||
url: "http://127.0.0.1:10008/callbackExample"
|
||||
url: ""
|
||||
beforeSendSingleMsg:
|
||||
enable: ${CALLBACK_ENABLE}
|
||||
timeout: ${CALLBACK_TIMEOUT}
|
||||
failedContinue: ${CALLBACK_FAILED_CONTINUE}
|
||||
beforeUpdateUserInfoEx:
|
||||
enable: ${CALLBACK_ENABLE}
|
||||
timeout: ${CALLBACK_TIMEOUT}
|
||||
failedContinue: ${CALLBACK_FAILED_CONTINUE}
|
||||
afterUpdateUserInfoEx:
|
||||
enable: ${CALLBACK_ENABLE}
|
||||
timeout: ${CALLBACK_TIMEOUT}
|
||||
failedContinue: ${CALLBACK_FAILED_CONTINUE}
|
||||
afterSendSingleMsg:
|
||||
enable: ${CALLBACK_ENABLE}
|
||||
timeout: ${CALLBACK_TIMEOUT}
|
||||
@@ -522,7 +506,7 @@ callback:
|
||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||
prometheus:
|
||||
enable: ${PROMETHEUS_ENABLE}
|
||||
grafanaUrl: ${GRAFANA_URL}
|
||||
prometheusUrl: ${PROMETHEUS_URL}
|
||||
apiPrometheusPort: [${API_PROM_PORT}]
|
||||
userPrometheusPort: [ ${USER_PROM_PORT} ]
|
||||
friendPrometheusPort: [ ${FRIEND_PROM_PORT} ]
|
||||
@@ -535,39 +519,3 @@ prometheus:
|
||||
rtcPrometheusPort: [ ${RTC_PROM_PORT} ]
|
||||
thirdPrometheusPort: [ ${THIRD_PROM_PORT} ]
|
||||
messageTransferPrometheusPort: [ ${MSG_TRANSFER_PROM_PORT} ] # List of ports
|
||||
|
||||
###################### LocalCache configuration information ######################
|
||||
# topic: redis subscriber channel
|
||||
# slotNum: number of slots, multiple slots can prevent too many keys from competing for a lock
|
||||
# slotSize: number of slots, the number of cached keys per slot, the overall cache quantity is slotNum * slotSize
|
||||
# successExpire: successful cache time seconds
|
||||
# failedExpire: failed cache time seconds
|
||||
# disable local caching and annotate topic, slotNum, and slotSize
|
||||
localCache:
|
||||
user:
|
||||
topic: DELETE_CACHE_USER
|
||||
slotNum: 100
|
||||
slotSize: 2000
|
||||
successExpire: 300
|
||||
failedExpire: 5
|
||||
|
||||
group:
|
||||
topic: DELETE_CACHE_GROUP
|
||||
slotNum: 100
|
||||
slotSize: 2000
|
||||
successExpire: 300
|
||||
failedExpire: 5
|
||||
|
||||
friend:
|
||||
topic: DELETE_CACHE_FRIEND
|
||||
slotNum: 100
|
||||
slotSize: 2000
|
||||
successExpire: 300
|
||||
failedExpire: 5
|
||||
|
||||
conversation:
|
||||
topic: DELETE_CACHE_CONVERSATION
|
||||
slotNum: 100
|
||||
slotSize: 2000
|
||||
successExpire: 300
|
||||
failedExpire: 5
|
||||
@@ -1,298 +0,0 @@
|
||||
#fixme Clone openIM Server project before using docker-compose,project address:https://github.com/OpenIMSDK/Open-IM-Server.git
|
||||
# The command that triggers this file to pull the image is "docker compose up -f"
|
||||
version: '3'
|
||||
|
||||
networks:
|
||||
server:
|
||||
driver: bridge
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- 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: ["/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"
|
||||
- "${DATA_DIR:-./}/components/mongodb/data/conf:/etc/mongo"
|
||||
- "./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- wiredTigerCacheSizeGB=1
|
||||
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME:-root}
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD:-openIM123}
|
||||
- MONGO_INITDB_DATABASE=${MONGO_DATABASE:-openim_v3}
|
||||
- MONGO_OPENIM_USERNAME=${MONGO_OPENIM_USERNAME:-openIM} # Non-root username
|
||||
- MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD:-openIM123456} # Non-root password
|
||||
restart: always
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${MONGO_NETWORK_ADDRESS:-172.28.0.2}
|
||||
|
||||
redis:
|
||||
image: redis:${REDIS_IMAGE_VERSION:-7.0.0}
|
||||
container_name: redis
|
||||
ports:
|
||||
- "${REDIS_PORT:-16379}:6379"
|
||||
volumes:
|
||||
- "${DATA_DIR:-./}/components/redis/data:/data"
|
||||
- "${DATA_DIR:-./}/components/redis/config/redis.conf:/usr/local/redis/config/redis.conf"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
sysctls:
|
||||
net.core.somaxconn: 1024
|
||||
command: redis-server --requirepass ${REDIS_PASSWORD:-openIM123} --appendonly yes
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${REDIS_NETWORK_ADDRESS:-172.28.0.3}
|
||||
|
||||
zookeeper:
|
||||
image: bitnami/zookeeper:${ZOOKEEPER_IMAGE_VERSION:-3.8}
|
||||
container_name: zookeeper
|
||||
ports:
|
||||
- "${ZOOKEEPER_PORT:-12181}:2181"
|
||||
volumes:
|
||||
- "/etc/localtime:/etc/localtime"
|
||||
environment:
|
||||
- ALLOW_ANONYMOUS_LOGIN=yes
|
||||
- TZ="Asia/Shanghai"
|
||||
restart: always
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${ZOOKEEPER_NETWORK_ADDRESS:-172.28.0.5}
|
||||
|
||||
kafka:
|
||||
image: 'bitnami/kafka:${KAFKA_IMAGE_VERSION:-3.5.1}'
|
||||
container_name: kafka
|
||||
restart: always
|
||||
user: ${KAFKA_USER:-root}
|
||||
ports:
|
||||
- "${KAFKA_PORT:-19094}:9094"
|
||||
volumes:
|
||||
- ./scripts/create-topic.sh:/opt/bitnami/kafka/create-topic.sh
|
||||
- "${DATA_DIR:-./}/components/kafka:/bitnami/kafka"
|
||||
command: >
|
||||
bash -c "/opt/bitnami/scripts/kafka/run.sh & sleep 5; /opt/bitnami/kafka/create-topic.sh; wait"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- KAFKA_CFG_NODE_ID=0
|
||||
- KAFKA_CFG_PROCESS_ROLES=controller,broker
|
||||
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@<your_host>:9093
|
||||
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
|
||||
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}:${KAFKA_PORT:-19094}
|
||||
# - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://127.0.0.1:${KAFKA_PORT:-19094} # Mac Deployment
|
||||
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
|
||||
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${KAFKA_NETWORK_ADDRESS:-172.28.0.4}
|
||||
|
||||
minio:
|
||||
image: minio/minio:${MINIO_IMAGE_VERSION:-RELEASE.2024-01-11T07-46-16Z}
|
||||
ports:
|
||||
- "${MINIO_PORT:-10005}:9000"
|
||||
- "9090:9090"
|
||||
container_name: minio
|
||||
volumes:
|
||||
- "${DATA_DIR:-./}/components/mnt/data:/data"
|
||||
- "${DATA_DIR:-./}/components/mnt/config:/root/.minio"
|
||||
environment:
|
||||
MINIO_ROOT_USER: "${MINIO_ACCESS_KEY:-root}"
|
||||
MINIO_ROOT_PASSWORD: "${MINIO_SECRET_KEY:-openIM123}"
|
||||
restart: always
|
||||
command: minio server /data --console-address ':9090'
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${MINIO_NETWORK_ADDRESS:-172.28.0.6}
|
||||
|
||||
openim-web:
|
||||
image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-web:${OPENIM_WEB_IMAGE_VERSION:-v3.5.0-docker}
|
||||
container_name: openim-web
|
||||
platform: linux/amd64
|
||||
restart: always
|
||||
ports:
|
||||
- "${OPENIM_WEB_PORT:-11001}:80"
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS:-172.28.0.7}
|
||||
|
||||
openim-admin:
|
||||
# https://github.com/openimsdk/open-im-server/issues/1662
|
||||
image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-admin:${ADMIN_FRONT_VERSION:-toc-base-open-docker.35}
|
||||
container_name: openim-admin
|
||||
platform: linux/amd64
|
||||
restart: always
|
||||
ports:
|
||||
- "${OPENIM_ADMIN_FRONT_PORT:-11002}:80"
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${OPENIM_ADMIN_FRONT_NETWORK_ADDRESS:-172.28.0.13}
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
container_name: prometheus
|
||||
hostname: prometheus
|
||||
restart: always
|
||||
volumes:
|
||||
- "${DATA_DIR:-./}/config/instance-down-rules.yml:/etc/prometheus/instance-down-rules.yml"
|
||||
- "${DATA_DIR:-./}/config/prometheus.yml:/etc/prometheus/prometheus.yml"
|
||||
ports:
|
||||
- "${PROMETHEUS_PORT:-19090}:9090"
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${PROMETHEUS_NETWORK_ADDRESS:-172.28.0.10}
|
||||
|
||||
alertmanager:
|
||||
image: prom/alertmanager
|
||||
container_name: alertmanager
|
||||
hostname: alertmanager
|
||||
restart: always
|
||||
volumes:
|
||||
- ${DATA_DIR:-./}/config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
|
||||
- ${DATA_DIR:-./}/config/email.tmpl:/etc/alertmanager/email.tmpl
|
||||
ports:
|
||||
- "${ALERT_MANAGER_PORT:-19093}:9093"
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${ALERT_MANAGER_NETWORK_ADDRESS:-172.28.0.14}
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana
|
||||
container_name: grafana
|
||||
hostname: grafana
|
||||
user: root
|
||||
restart: always
|
||||
ports:
|
||||
- "${GRAFANA_PORT:-13000}:3000"
|
||||
volumes:
|
||||
- "${DATA_DIR:-./}/components/grafana:/var/lib/grafana"
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${GRAFANA_NETWORK_ADDRESS:-172.28.0.11}
|
||||
|
||||
node-exporter:
|
||||
image: quay.io/prometheus/node-exporter
|
||||
container_name: node-exporter
|
||||
hostname: node-exporter
|
||||
restart: always
|
||||
ports:
|
||||
- "${NODE_EXPORTER_PORT:-19100}:9100"
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${NODE_EXPORTER_NETWORK_ADDRESS:-172.28.0.12}
|
||||
|
||||
### Source code deployment does not require pulling the following mirrors
|
||||
|
||||
# openim-server:
|
||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-server:${SERVER_IMAGE_VERSION:-main}
|
||||
# container_name: openim-server
|
||||
# ports:
|
||||
# - "${OPENIM_WS_PORT:-10001}:${OPENIM_WS_PORT:-10001}"
|
||||
# - "${API_OPENIM_PORT:-10002}:${API_OPENIM_PORT:-10002}"
|
||||
# - "${API_PROM_PORT:-20100}:${API_PROM_PORT:-20100}"
|
||||
# - "${USER_PROM_PORT:-20110}:${USER_PROM_PORT:-20110}"
|
||||
# - "${FRIEND_PROM_PORT:-20120}:${FRIEND_PROM_PORT:-20120}"
|
||||
# - "${MESSAGE_PROM_PORT:-20130}:${MESSAGE_PROM_PORT:-20130}"
|
||||
# - "${MSG_GATEWAY_PROM_PORT:-20140}:${MSG_GATEWAY_PROM_PORT:-20140}"
|
||||
# - "${GROUP_PROM_PORT:-20150}:${GROUP_PROM_PORT:-20150}"
|
||||
# - "${AUTH_PROM_PORT:-20160}:${AUTH_PROM_PORT:-20160}"
|
||||
# - "${PUSH_PROM_PORT:-20170}:${PUSH_PROM_PORT:-20170}"
|
||||
# - "${CONVERSATION_PROM_PORT:-20230}:${CONVERSATION_PROM_PORT:-20230}"
|
||||
# - "${RTC_PROM_PORT:-21300}:${RTC_PROM_PORT:-21300}"
|
||||
# - "${THIRD_PROM_PORT:-21301}:${THIRD_PROM_PORT:-21301}"
|
||||
# - "21400-21403:21400-21403"
|
||||
# healthcheck:
|
||||
# test: ["CMD", "/openim/openim-server/scripts/check-all.sh"]
|
||||
# interval: 120s
|
||||
# timeout: 30s
|
||||
# retries: 5
|
||||
# env_file:
|
||||
# - .env
|
||||
# environment:
|
||||
# - OPENIM_IP=${OPENIM_IP:-127.0.0.1}
|
||||
# volumes:
|
||||
# - "${DATA_DIR:-./}/openim-server/logs:/openim/openim-server/logs"
|
||||
# - "${DATA_DIR:-./}/openim-server/_output/logs:/openim/openim-server/_output/logs"
|
||||
# - "${DATA_DIR:-./}/openim-server/config:/openim/openim-server/config"
|
||||
# restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# - mysql
|
||||
# - mongodb
|
||||
# - redis
|
||||
# - minio
|
||||
# logging:
|
||||
# driver: json-file
|
||||
# options:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
# networks:
|
||||
# server:
|
||||
# ipv4_address: ${OPENIM_SERVER_NETWORK_ADDRESS:-172.28.0.8}
|
||||
|
||||
### TODO: mysql is required to deploy the openim-chat component
|
||||
# mysql:
|
||||
# image: mysql:${MYSQL_IMAGE_VERSION:-5.7}
|
||||
# platform: linux/amd64
|
||||
# ports:
|
||||
# - "${MYSQL_PORT:-13306}:3306"
|
||||
# container_name: mysql
|
||||
# volumes:
|
||||
# - "${DATA_DIR:-./}/components/mysql/data:/var/lib/mysql"
|
||||
# - "/etc/localtime:/etc/localtime"
|
||||
# environment:
|
||||
# MYSQL_ROOT_PASSWORD: "${MYSQL_PASSWORD:-openIM123}"
|
||||
# restart: always
|
||||
# networks:
|
||||
# server:
|
||||
# ipv4_address: ${MYSQL_NETWORK_ADDRESS:-172.28.0.15}
|
||||
|
||||
# openim-chat:
|
||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-chat:${CHAT_IMAGE_VERSION:-main}
|
||||
# container_name: openim-chat
|
||||
# healthcheck:
|
||||
# test: ["CMD", "/openim/openim-chat/scripts/check_all.sh"]
|
||||
# interval: 60s
|
||||
# timeout: 30s
|
||||
# retries: 5
|
||||
# env_file:
|
||||
# - .env
|
||||
# environment:
|
||||
# - ZOOKEEPER_ADDRESS=${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}
|
||||
# - ZOOKEEPER_PORT=${ZOOKEEPER_PORT:-12181}
|
||||
# - OPENIM_SERVER_ADDRESS=http://${OPENIM_SERVER_ADDRESS:-172.28.0.1}
|
||||
# - API_OPENIM_PORT=${API_OPENIM_PORT:-10002}
|
||||
# - MYSQL_ADDRESS=${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}
|
||||
# - MYSQL_PORT=${MYSQL_PORT:-13306}
|
||||
# - REDIS_ADDRESS=${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}
|
||||
# - REDIS_PORT=${REDIS_PORT:-16379}
|
||||
# ports:
|
||||
# - "${OPENIM_CHAT_API_PORT:-10008}:10008"
|
||||
# - "${OPENIM_ADMIN_API_PORT:-10009}:10009"
|
||||
# volumes:
|
||||
# - "${DATA_DIR:-./}/components/openim-chat/logs:/openim/openim-chat/logs"
|
||||
# - "${DATA_DIR:-./}/components/openim-chat/_output/logs:/openim/openim-chat/_output/logs"
|
||||
# - "${DATA_DIR:-./}/components/openim-chat/config:/openim/openim-chat/config"
|
||||
# restart: always
|
||||
# # user: root:root
|
||||
# depends_on:
|
||||
# - mysql
|
||||
# - kafka
|
||||
# - redis
|
||||
# - zookeeper
|
||||
# logging:
|
||||
# driver: json-file
|
||||
# options:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
# networks:
|
||||
# server:
|
||||
# ipv4_address: ${OPENIM_CHAT_NETWORK_ADDRESS:-172.28.0.9}
|
||||
+21
-116
@@ -1,5 +1,4 @@
|
||||
#fixme Clone openIM Server project before using docker-compose,project address:https://github.com/OpenIMSDK/Open-IM-Server.git
|
||||
# The command that triggers this file to pull the image is "docker compose up -d".
|
||||
version: '3'
|
||||
|
||||
networks:
|
||||
@@ -17,20 +16,18 @@ services:
|
||||
ports:
|
||||
- "${MONGO_PORT:-37017}:27017"
|
||||
container_name: mongo
|
||||
command: ["/bin/bash", "-c", "/docker-entrypoint-initdb.d/mongo-init.sh || true; docker-entrypoint.sh mongod --wiredTigerCacheSizeGB 1 --auth"]
|
||||
command: --wiredTigerCacheSizeGB 1 --auth
|
||||
volumes:
|
||||
- "${DATA_DIR:-./}/components/mongodb/data/db:/data/db"
|
||||
- "${DATA_DIR:-./}/components/mongodb/data/logs:/data/logs"
|
||||
- "${DATA_DIR:-./}/components/mongodb/data/conf:/etc/mongo"
|
||||
- "./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro"
|
||||
- ./scripts/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- wiredTigerCacheSizeGB=1
|
||||
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME:-root}
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD:-openIM123}
|
||||
- MONGO_INITDB_DATABASE=${MONGO_DATABASE:-openim_v3}
|
||||
- MONGO_OPENIM_USERNAME=${MONGO_OPENIM_USERNAME:-openIM} # Non-root username
|
||||
- MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD:-openIM123456} # Non-root password
|
||||
- MONGO_INITDB_DATABASE=${MONGO_DATABASE:-openIM_v3}
|
||||
restart: always
|
||||
networks:
|
||||
server:
|
||||
@@ -88,7 +85,6 @@ services:
|
||||
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@<your_host>:9093
|
||||
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
|
||||
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}:${KAFKA_PORT:-19094}
|
||||
# - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://127.0.0.1:${KAFKA_PORT:-19094} # Mac Deployment
|
||||
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
|
||||
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
|
||||
networks:
|
||||
@@ -96,7 +92,7 @@ services:
|
||||
ipv4_address: ${KAFKA_NETWORK_ADDRESS:-172.28.0.4}
|
||||
|
||||
minio:
|
||||
image: minio/minio:${MINIO_IMAGE_VERSION:-RELEASE.2024-01-11T07-46-16Z}
|
||||
image: minio/minio:${MINIO_IMAGE_VERSION:-latest}
|
||||
ports:
|
||||
- "${MINIO_PORT:-10005}:9000"
|
||||
- "9090:9090"
|
||||
@@ -114,119 +110,28 @@ services:
|
||||
ipv4_address: ${MINIO_NETWORK_ADDRESS:-172.28.0.6}
|
||||
|
||||
openim-web:
|
||||
image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-web:${OPENIM_WEB_IMAGE_VERSION:-v3.5.0-docker}
|
||||
image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-web:${OPENIM_WEB_IMAGE_VERSION:-latest}
|
||||
container_name: openim-web
|
||||
platform: linux/amd64
|
||||
environment:
|
||||
- OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH:-/app/dist}
|
||||
- OPENIM_WEB_PORT=${OPENIM_WEB_PORT:-11001}
|
||||
restart: always
|
||||
ports:
|
||||
- "${OPENIM_WEB_PORT:-11001}:80"
|
||||
- "${OPENIM_WEB_PORT:-11001}:11001"
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS:-172.28.0.7}
|
||||
|
||||
openim-admin:
|
||||
# https://github.com/openimsdk/open-im-server/issues/1662
|
||||
image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-admin:${ADMIN_FRONT_VERSION:-toc-base-open-docker.35}
|
||||
container_name: openim-admin
|
||||
platform: linux/amd64
|
||||
restart: always
|
||||
ports:
|
||||
- "${OPENIM_ADMIN_FRONT_PORT:-11002}:80"
|
||||
networks:
|
||||
server:
|
||||
ipv4_address: ${OPENIM_ADMIN_FRONT_NETWORK_ADDRESS:-172.28.0.13}
|
||||
|
||||
### TODO: Uncomment, or deploy using openim docker: https://github.com/openimsdk/openim-docker
|
||||
### Uncomment and configure the following services as needed
|
||||
|
||||
# openim-server:
|
||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-server:${SERVER_IMAGE_VERSION:-main}
|
||||
# container_name: openim-server
|
||||
# ports:
|
||||
# - "${OPENIM_WS_PORT:-10001}:${OPENIM_WS_PORT:-10001}"
|
||||
# - "${API_OPENIM_PORT:-10002}:${API_OPENIM_PORT:-10002}"
|
||||
# - "${API_PROM_PORT:-20100}:${API_PROM_PORT:-20100}"
|
||||
# - "${USER_PROM_PORT:-20110}:${USER_PROM_PORT:-20110}"
|
||||
# - "${FRIEND_PROM_PORT:-20120}:${FRIEND_PROM_PORT:-20120}"
|
||||
# - "${MESSAGE_PROM_PORT:-20130}:${MESSAGE_PROM_PORT:-20130}"
|
||||
# - "${MSG_GATEWAY_PROM_PORT:-20140}:${MSG_GATEWAY_PROM_PORT:-20140}"
|
||||
# - "${GROUP_PROM_PORT:-20150}:${GROUP_PROM_PORT:-20150}"
|
||||
# - "${AUTH_PROM_PORT:-20160}:${AUTH_PROM_PORT:-20160}"
|
||||
# - "${PUSH_PROM_PORT:-20170}:${PUSH_PROM_PORT:-20170}"
|
||||
# - "${CONVERSATION_PROM_PORT:-20230}:${CONVERSATION_PROM_PORT:-20230}"
|
||||
# - "${RTC_PROM_PORT:-21300}:${RTC_PROM_PORT:-21300}"
|
||||
# - "${THIRD_PROM_PORT:-21301}:${THIRD_PROM_PORT:-21301}"
|
||||
# - "21400-21403:21400-21403"
|
||||
# healthcheck:
|
||||
# test: ["CMD", "/openim/openim-server/scripts/check-all.sh"]
|
||||
# interval: 120s
|
||||
# timeout: 30s
|
||||
# retries: 5
|
||||
# env_file:
|
||||
# - .env
|
||||
# environment:
|
||||
# - OPENIM_IP=${OPENIM_IP:-127.0.0.1}
|
||||
# volumes:
|
||||
# - "${DATA_DIR:-./}/openim-server/logs:/openim/openim-server/logs"
|
||||
# - "${DATA_DIR:-./}/openim-server/_output/logs:/openim/openim-server/_output/logs"
|
||||
# - "${DATA_DIR:-./}/openim-server/config:/openim/openim-server/config"
|
||||
# Uncomment and configure the following services as needed
|
||||
# openim-admin:
|
||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-admin-front:v3.4.0
|
||||
# container_name: openim-admin
|
||||
# restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# - mysql
|
||||
# - mongodb
|
||||
# - redis
|
||||
# - minio
|
||||
# logging:
|
||||
# driver: json-file
|
||||
# options:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
# ports:
|
||||
# - "${OPENIM_ADMIN_FRONT_PORT:-11002}:80"
|
||||
# networks:
|
||||
# server:
|
||||
# ipv4_address: ${OPENIM_SERVER_NETWORK_ADDRESS:-172.28.0.8}
|
||||
|
||||
# openim-chat:
|
||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-chat:${CHAT_IMAGE_VERSION:-main}
|
||||
# container_name: openim-chat
|
||||
# healthcheck:
|
||||
# test: ["CMD", "/openim/openim-chat/scripts/check_all.sh"]
|
||||
# interval: 60s
|
||||
# timeout: 30s
|
||||
# retries: 5
|
||||
# env_file:
|
||||
# - .env
|
||||
# environment:
|
||||
# - ZOOKEEPER_ADDRESS=${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}
|
||||
# - ZOOKEEPER_PORT=${ZOOKEEPER_PORT:-12181}
|
||||
# - OPENIM_SERVER_ADDRESS=http://${OPENIM_SERVER_ADDRESS:-172.28.0.1}
|
||||
# - API_OPENIM_PORT=${API_OPENIM_PORT:-10002}
|
||||
# - MYSQL_ADDRESS=${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}
|
||||
# - MYSQL_PORT=${MYSQL_PORT:-13306}
|
||||
# - REDIS_ADDRESS=${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}
|
||||
# - REDIS_PORT=${REDIS_PORT:-16379}
|
||||
# ports:
|
||||
# - "${OPENIM_CHAT_API_PORT:-10008}:10008"
|
||||
# - "${OPENIM_ADMIN_API_PORT:-10009}:10009"
|
||||
# volumes:
|
||||
# - "${DATA_DIR:-./}/components/openim-chat/logs:/openim/openim-chat/logs"
|
||||
# - "${DATA_DIR:-./}/components/openim-chat/_output/logs:/openim/openim-chat/_output/logs"
|
||||
# - "${DATA_DIR:-./}/components/openim-chat/config:/openim/openim-chat/config"
|
||||
# restart: always
|
||||
# # user: root:root
|
||||
# depends_on:
|
||||
# - mysql
|
||||
# - kafka
|
||||
# - redis
|
||||
# - zookeeper
|
||||
# logging:
|
||||
# driver: json-file
|
||||
# options:
|
||||
# max-size: "1g"
|
||||
# max-file: "2"
|
||||
# networks:
|
||||
# server:
|
||||
# ipv4_address: ${OPENIM_CHAT_NETWORK_ADDRESS:-172.28.0.9}
|
||||
# ipv4_address: ${OPENIM_ADMIN_FRONT_NETWORK_ADDRESS:-172.28.0.13}
|
||||
|
||||
# prometheus:
|
||||
# image: prom/prometheus
|
||||
@@ -234,8 +139,8 @@ services:
|
||||
# hostname: prometheus
|
||||
# restart: always
|
||||
# volumes:
|
||||
# - "${DATA_DIR:-./}/config/instance-down-rules.yml:/etc/prometheus/instance-down-rules.yml"
|
||||
# - "${DATA_DIR:-./}/config/prometheus.yml:/etc/prometheus/prometheus.yml"
|
||||
# - ./config/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
# - ./config/instance-down-rules.yml:/etc/prometheus/instance-down-rules.yml
|
||||
# ports:
|
||||
# - "${PROMETHEUS_PORT:-19090}:9090"
|
||||
# networks:
|
||||
@@ -248,8 +153,8 @@ services:
|
||||
# hostname: alertmanager
|
||||
# restart: always
|
||||
# volumes:
|
||||
# - ${DATA_DIR:-./}/config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
|
||||
# - ${DATA_DIR:-./}/config/email.tmpl:/etc/alertmanager/email.tmpl
|
||||
# - ./config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
|
||||
# - ./config/email.tmpl:/etc/alertmanager/email.tmpl
|
||||
# ports:
|
||||
# - "${ALERT_MANAGER_PORT:-19093}:9093"
|
||||
# networks:
|
||||
@@ -265,7 +170,7 @@ services:
|
||||
# ports:
|
||||
# - "${GRAFANA_PORT:-13000}:3000"
|
||||
# volumes:
|
||||
# - "${DATA_DIR:-./}/components/grafana:/var/lib/grafana"
|
||||
# - ${DATA_DIR:-./}/components/grafana:/var/lib/grafana
|
||||
# networks:
|
||||
# server:
|
||||
# ipv4_address: ${GRAFANA_NETWORK_ADDRESS:-172.28.0.11}
|
||||
|
||||
@@ -31,7 +31,7 @@ docs/guide/en-US/cmd/openim/openim-rpc-user_list.md
|
||||
docs/guide/en-US/cmd/openim/openim-rpc-user_update.md
|
||||
docs/guide/en-US/cmd/openim/openim_validate.md
|
||||
docs/guide/en-US/cmd/openim/openim_version.md
|
||||
docs/guide/en-US/yaml/openim/config.yaml
|
||||
docs/guide/en-US/yaml/openim/openim.yaml
|
||||
docs/guide/en-US/yaml/openim/openim_color.yaml
|
||||
docs/guide/en-US/yaml/openim/openim_completion.yaml
|
||||
docs/guide/en-US/yaml/openim/openim_info.yaml
|
||||
|
||||
@@ -7,6 +7,7 @@ Welcome to the OpenIM Documentation hub! This center provides a comprehensive ra
|
||||
1. [Contrib](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib) - Guidance on contributing and configurations for developers
|
||||
2. [Conversions](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib) - Coding conventions, logging policies, and other transformation tools
|
||||
|
||||
------
|
||||
|
||||
## Contrib
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
**PATH:** `scripts/lib/logging.sh`
|
||||
|
||||
|
||||
|
||||
### Introduction
|
||||
|
||||
OpenIM, an intricate project, requires a robust logging mechanism to diagnose issues, maintain system health, and provide insights. A custom-built logging system embedded within OpenIM ensures consistent and structured logs. Let's delve into the design of this logging system and understand its various functions and their usage scenarios.
|
||||
|
||||
@@ -3,15 +3,7 @@
|
||||
- [Code conventions](#code-conventions)
|
||||
- [POSIX shell](#posix-shell)
|
||||
- [Go](#go)
|
||||
- [OpenIM Naming Conventions Guide](#openim-naming-conventions-guide)
|
||||
- [1. General File Naming](#1-general-file-naming)
|
||||
- [2. Special File Types](#2-special-file-types)
|
||||
- [a. Script and Markdown Files](#a-script-and-markdown-files)
|
||||
- [b. Uppercase Markdown Documentation](#b-uppercase-markdown-documentation)
|
||||
- [3. Directory Naming](#3-directory-naming)
|
||||
- [4. Configuration Files](#4-configuration-files)
|
||||
- [Best Practices](#best-practices)
|
||||
- [Directory and File Conventions](#directory-and-file-conventions)
|
||||
- [Directory and file conventions](#directory-and-file-conventions)
|
||||
- [Testing conventions](#testing-conventions)
|
||||
|
||||
## POSIX shell
|
||||
@@ -75,13 +67,12 @@ Files within the OpenIM project should adhere to the following rules:
|
||||
+ Stick to lowercase naming where possible for consistency and to prevent issues with case-sensitive systems.
|
||||
+ Include version numbers or dates in file names if the file is subject to updates, following the format: `project-plan-v1.2.md` or `backup-2023-03-15.sql`.
|
||||
|
||||
## Directory and File Conventions
|
||||
|
||||
- Avoid generic utility packages. Instead of naming a package "util", choose a name that clearly describes its purpose. For instance, functions related to waiting operations are contained within the `wait` package, which includes methods like `Poll`, fully named as `wait.Poll`.
|
||||
- All filenames, script files, configuration files, and directories should be in lowercase and use dashes (`-`) as separators.
|
||||
- For Go language files, filenames should be in lowercase and use underscores (`_`).
|
||||
- Package names should match their directory names to ensure consistency. For example, within the `openim-api` directory, the Go file should be named `openim-api.go`, following the convention of using dashes for directory names and aligning package names with directory names.
|
||||
## Directory and file conventions
|
||||
|
||||
- Avoid general utility packages. Packages called "util" are suspect. Instead, derive a name that describes your desired function. For example, the utility functions dealing with waiting for operations are in the `wait` package and include functionality like `Poll`. The full name is `wait.Poll`.
|
||||
- All filenames should be lowercase.
|
||||
- All source files and directories should use underscores, not dashes.
|
||||
- Package directories should generally avoid using separators as much as possible. When package names are multiple words, they usually should be in nested subdirectories.
|
||||
|
||||
## Testing conventions
|
||||
|
||||
|
||||
+17
-19
@@ -89,7 +89,7 @@ While the first two methods will be our main focus, it's worth noting that the t
|
||||
|
||||
### 1.2. <a name='SourceCodeDeployment'></a>Source Code Deployment
|
||||
|
||||
In the source code deployment method, the configuration generation process involves executing `make init`, which fundamentally runs the script `./scripts/init-config.sh`. This script utilizes variables defined in the [`environment.sh`](https://github.com/openimsdk/open-im-server/blob/main/scripts/install/environment.sh) script to render the [`config.yaml`](https://github.com/openimsdk/open-im-server/blob/main/deployments/templates/config.yaml) template file, subsequently generating the [`config.yaml`](https://github.com/openimsdk/open-im-server/blob/main/config/config.yaml) configuration file.
|
||||
In the source code deployment method, the configuration generation process involves executing `make init`, which fundamentally runs the script `./scripts/init-config.sh`. This script utilizes variables defined in the [`environment.sh`](https://github.com/openimsdk/open-im-server/blob/main/scripts/install/environment.sh) script to render the [`openim.yaml`](https://github.com/openimsdk/open-im-server/blob/main/deployments/templates/openim.yaml) template file, subsequently generating the [`config.yaml`](https://github.com/openimsdk/open-im-server/blob/main/config/config.yaml) configuration file.
|
||||
|
||||
### 1.3. <a name='DockerComposeDeployment'></a>Docker Compose Deployment
|
||||
|
||||
@@ -104,19 +104,16 @@ 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/open-im-server/blob/main/scripts/install/environment.sh) configuration:
|
||||
These variables are stored within the [`environment.sh`](https://github.com/OpenIMSDK/openim-docker/blob/main/scripts/install/environment.sh) configuration:
|
||||
|
||||
```bash
|
||||
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`).
|
||||
|
||||
@@ -130,7 +127,7 @@ For convenience, configuration through modifying environment variables is recomm
|
||||
|
||||
+ PASSWORD
|
||||
|
||||
+ **Description**: Password for mongodb, redis, and minio.
|
||||
+ **Description**: Password for mysql, mongodb, redis, and minio.
|
||||
+ **Default**: `openIM123`
|
||||
+ Notes:
|
||||
+ Minimum password length: 8 characters.
|
||||
@@ -142,22 +139,20 @@ For convenience, configuration through modifying environment variables is recomm
|
||||
|
||||
+ OPENIM_USER
|
||||
|
||||
+ **Description**: Username for redis, and minio.
|
||||
+ **Description**: Username for mysql, mongodb, redis, and minio.
|
||||
+ **Default**: `root`
|
||||
|
||||
```bash
|
||||
export OPENIM_USER="root"
|
||||
```
|
||||
|
||||
> mongo is `openIM`, use `export MONGO_OPENIM_USERNAME="openIM"` to modify
|
||||
|
||||
+ OPENIM_IP
|
||||
+ API_URL
|
||||
|
||||
+ **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 OPENIM_IP="ip"
|
||||
export API_URL="http://ip:10002"
|
||||
```
|
||||
|
||||
+ DATA_DIR
|
||||
@@ -305,15 +300,12 @@ Feel free to explore the MinIO documentation for more advanced configurations an
|
||||
|
||||
This section involves setting up MongoDB, including its port, address, and credentials.
|
||||
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| -------------- | -------------- | ----------------------- |
|
||||
| MONGO_PORT | "27017" | Port used by MongoDB. |
|
||||
| MONGO_ADDRESS | [Generated IP] | IP address for MongoDB. |
|
||||
| MONGO_USERNAME | [User Defined] | Admin Username for MongoDB. |
|
||||
| MONGO_PASSWORD | [User Defined] | Admin Password for MongoDB. |
|
||||
| MONGO_OPENIM_USERNAME | [User Defined] | OpenIM Username for MongoDB. |
|
||||
| MONGO_OPENIM_PASSWORD | [User Defined] | OpenIM Password for MongoDB. |
|
||||
| MONGO_USERNAME | [User Defined] | Username for MongoDB. |
|
||||
| MONGO_PASSWORD | [User Defined] | Password for MongoDB. |
|
||||
|
||||
### 2.8. <a name='TencentCloudCOSConfiguration'></a>Tencent Cloud COS Configuration
|
||||
|
||||
@@ -449,7 +441,7 @@ This section involves configuring the log settings, including storage location,
|
||||
|
||||
| Parameter | Example Value | Description |
|
||||
| ------------------------- | ------------------------ | --------------------------------- |
|
||||
| LOG_STORAGE_LOCATION | "${OPENIM_ROOT}/_output/logs/" | Location for storing logs |
|
||||
| LOG_STORAGE_LOCATION | ""${OPENIM_ROOT}"/logs/" | Location for storing logs |
|
||||
| LOG_ROTATION_TIME | "24" | Log rotation time (in hours) |
|
||||
| LOG_REMAIN_ROTATION_COUNT | "2" | Number of log rotations to retain |
|
||||
| LOG_REMAIN_LOG_LEVEL | "6" | Log level to retain |
|
||||
@@ -478,6 +470,12 @@ This section involves setting up additional configuration variables for Websocke
|
||||
| JPNS_MASTER_SECRET | [User Defined] | JPNS Master Secret |
|
||||
| JPNS_PUSH_URL | [User Defined] | JPNS Push Notification URL |
|
||||
| JPNS_PUSH_INTENT | [User Defined] | JPNS Push Intent |
|
||||
| MANAGER_USERID_1 | "openIM123456" | Administrator ID 1 |
|
||||
| MANAGER_USERID_2 | "openIM654321" | Administrator ID 2 |
|
||||
| MANAGER_USERID_3 | "openIMAdmin" | Administrator ID 3 |
|
||||
| NICKNAME_1 | "system1" | Nickname 1 |
|
||||
| NICKNAME_2 | "system2" | Nickname 2 |
|
||||
| NICKNAME_3 | "system3" | Nickname 3 |
|
||||
| IM_ADMIN_USERID | "imAdmin" | IM Administrator ID |
|
||||
| IM_ADMIN_NAME | "imAdmin" | IM Administrator Nickname |
|
||||
| MULTILOGIN_POLICY | "1" | Multi-login Policy |
|
||||
|
||||
@@ -75,7 +75,7 @@ It is critical that our full community is actively engaged on enhancements in th
|
||||
|
||||
- Be aware the cherry pick script assumes you have a git remote called `upstream` that points at the openim-server github org.
|
||||
|
||||
Please see our [recommended Git workflow](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/github-workflow.md#workflow).
|
||||
Please see our [recommended Git workflow](https://github.com/openimsdk/open-im-server/blob/main/docs/contributors/github-workflow.md#workflow).
|
||||
|
||||
- You will need to run the cherry pick script separately for each patch release you want to cherry pick to. Cherry picks should be applied to all [active](https://github.com/openimsdk/open-im-server/releases) release branches where the fix is applicable.
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ description: |
|
||||
commit hygiene.
|
||||
---
|
||||
|
||||

|
||||
|
||||
## 1. Fork in the cloud
|
||||
|
||||
@@ -27,10 +28,10 @@ neither `$GOPATH/src/github.com/${your github profile name}/`
|
||||
nor any other pattern will work.
|
||||
|
||||
```sh
|
||||
export working_dir="$(go env GOPATH)/src/github.com/openimsdk"
|
||||
export working_dir="$(go env GOPATH)/src/k8s.io"
|
||||
```
|
||||
|
||||
If you already do Go development on github, the `github.com/openimsdk` directory
|
||||
If you already do Go development on github, the `k8s.io` directory
|
||||
will be a sibling to your existing `github.com` directory.
|
||||
|
||||
Set `user` to match your github profile name:
|
||||
|
||||
+63
-576
@@ -26,19 +26,19 @@ jwt "github.com/dgrijalva/jwt-go/v4"
|
||||
|
||||
```go
|
||||
import (
|
||||
// go standard package
|
||||
"fmt"
|
||||
|
||||
// third party package
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
// Anonymous packages are grouped separately, and anonymous package references are explained
|
||||
// import mysql driver
|
||||
_ "github.com/jinzhu/gorm/dialects/mysql"
|
||||
|
||||
// inner package
|
||||
// go standard package
|
||||
"fmt"
|
||||
|
||||
// third party package
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
// Anonymous packages are grouped separately, and anonymous package references are explained
|
||||
// import mysql driver
|
||||
_ "github.com/jinzhu/gorm/dialects/mysql"
|
||||
|
||||
// inner package
|
||||
)
|
||||
```
|
||||
|
||||
@@ -48,33 +48,33 @@ When multiple variables need to be used in a function, the `var` declaration can
|
||||
|
||||
```go
|
||||
var (
|
||||
Width int
|
||||
Height int
|
||||
Width int
|
||||
Height int
|
||||
)
|
||||
```
|
||||
|
||||
- When initializing a structure reference, please use `&T{}` instead of `new(T)` to make it consistent with structure initialization.
|
||||
|
||||
```go
|
||||
// bad
|
||||
sptr := new(T)
|
||||
sptr.Name = "bar"
|
||||
|
||||
// good
|
||||
sptr := &T{Name: "bar"}
|
||||
// bad
|
||||
sptr := new(T)
|
||||
sptr.Name = "bar"
|
||||
|
||||
// good
|
||||
sptr := &T{Name: "bar"}
|
||||
```
|
||||
|
||||
- The struct declaration and initialization format takes multiple lines and is defined as follows.
|
||||
|
||||
```go
|
||||
type User struct{
|
||||
Username string
|
||||
Email string
|
||||
}
|
||||
type User struct{
|
||||
Username string
|
||||
Email string
|
||||
}
|
||||
|
||||
user := User{
|
||||
Username: "belm",
|
||||
Email: "nosbelm@qq.com",
|
||||
user := User{
|
||||
Username: "belm",
|
||||
Email: "nosbelm@qq.com",
|
||||
}
|
||||
```
|
||||
|
||||
@@ -217,20 +217,20 @@ if err != nil {
|
||||
// bad
|
||||
v, err := foo()
|
||||
if err != nil || v == nil {
|
||||
// error handling
|
||||
return err
|
||||
// error handling
|
||||
return err
|
||||
}
|
||||
|
||||
//good
|
||||
v, err := foo()
|
||||
if err != nil {
|
||||
// error handling
|
||||
return err
|
||||
// error handling
|
||||
return err
|
||||
}
|
||||
|
||||
if v == nil {
|
||||
// error handling
|
||||
return errors. New("invalid value v")
|
||||
// error handling
|
||||
return errors. New("invalid value v")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -239,14 +239,13 @@ if v == nil {
|
||||
```go
|
||||
v, err := f()
|
||||
if err != nil {
|
||||
// error handling
|
||||
return // or continue.
|
||||
// error handling
|
||||
return // or continue.
|
||||
}
|
||||
```
|
||||
|
||||
- Bug description suggestions
|
||||
- Error descriptions start with a lowercase letter and do not end with punctuation, for example:
|
||||
|
||||
```go
|
||||
// bad
|
||||
errors.New("Redis connection failed")
|
||||
@@ -255,7 +254,6 @@ errors.New("redis connection failed.")
|
||||
// good
|
||||
errors.New("redis connection failed")
|
||||
```
|
||||
|
||||
- Tell users what they can do, not what they can't.
|
||||
- When declaring a requirement, use must instead of should. For example, `must be greater than 0, must match regex '[a-z]+'`.
|
||||
- When declaring that a format is incorrect, use must not. For example, `must not contain`.
|
||||
@@ -266,61 +264,13 @@ errors.New("redis connection failed")
|
||||
- When specifying ranges of numbers, use inclusive ranges whenever possible.
|
||||
- Go 1.13 or above is recommended, and the error generation method is `fmt.Errorf("module xxx: %w", err)`.
|
||||
|
||||
### 1.4 Panic Processing
|
||||
|
||||
The use of `panic` should be carefully controlled in Go applications to ensure program stability and predictable error handling. Following are revised guidelines emphasizing the restriction on using `panic` and promoting alternative strategies for error handling and program termination.
|
||||
|
||||
- **Prohibited in Business Logic:** Using `panic` within business logic processing is strictly prohibited. Business logic should handle errors gracefully and use error returns to propagate issues up the call stack.
|
||||
|
||||
- **Restricted Use in Main Package:** In the main package, the use of `panic` should be reserved for situations where the program is entirely inoperable, such as failure to open essential files, inability to connect to the database, or other critical startup issues. Even in these scenarios, prefer using structured error handling to terminate the program.
|
||||
|
||||
- **Use `log.Fatal` for Critical Errors:** Instead of panicking, use `log.Fatal` to log critical errors that prevent the program from operating normally. This approach allows the program to terminate while ensuring the error is properly logged for troubleshooting.
|
||||
|
||||
- **Prohibition on Exportable Interfaces:** Exportable interfaces must not invoke `panic`. They should handle errors gracefully and return errors as part of their contract.
|
||||
|
||||
- **Prefer Errors Over Panic:** It is recommended to use error returns instead of panic to convey errors within a package. This approach promotes error handling that integrates smoothly with Go's error handling idioms.
|
||||
|
||||
#### Alternative to Panic: Structured Program Termination
|
||||
|
||||
To enforce these guidelines, consider implementing structured functions to terminate the program gracefully in the face of unrecoverable errors, while providing clear error messages. Here are two recommended functions:
|
||||
|
||||
```go
|
||||
// ExitWithError logs an error message and exits the program with a non-zero status.
|
||||
func ExitWithError(err error) {
|
||||
progName := filepath.Base(os.Args[0])
|
||||
fmt.Fprintf(os.Stderr, "%s exit -1: %+v\n", progName, err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
// SIGTERMExit logs a warning message when the program receives a SIGTERM signal and exits with status 0.
|
||||
func SIGTERMExit() {
|
||||
progName := filepath.Base(os.Args[0])
|
||||
fmt.Fprintf(os.Stderr, "Warning %s receive process terminal SIGTERM exit 0\n", progName)
|
||||
}
|
||||
```
|
||||
|
||||
#### Example Usage:
|
||||
|
||||
```go
|
||||
import (
|
||||
_ "net/http/pprof"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
apiCmd := cmd.NewApiCmd()
|
||||
apiCmd.AddPortFlag()
|
||||
apiCmd.AddPrometheusPortFlag()
|
||||
if err := apiCmd.Execute(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In this example, `ExitWithError` is used to terminate the program when an unrecoverable error occurs, providing a clear error message to stderr and exiting with a non-zero status. This approach ensures that critical errors are logged and the program exits in a controlled manner, facilitating troubleshooting and maintaining the stability of the application.
|
||||
### 1.4 panic processing
|
||||
|
||||
- Panic is prohibited in business logic processing.
|
||||
- In the main package, panic is only used when the program is completely inoperable, for example, the file cannot be opened, the database cannot be connected, and the program cannot run normally.
|
||||
- In the main package, use `log.Fatal` to record errors, so that the program can be terminated by the log, or the exception thrown by the panic can be recorded in the log file, which is convenient for troubleshooting.
|
||||
- An exportable interface must not panic.
|
||||
- It is recommended to use error instead of panic to convey errors in the package.
|
||||
|
||||
### 1.5 Unit Tests
|
||||
|
||||
@@ -409,18 +359,18 @@ u := User{
|
||||
|
||||
For example:
|
||||
|
||||
```go
|
||||
```
|
||||
// Seeking to an offset before the start of the file is an error.
|
||||
// Seeking to any positive offset is legal, but the behavior of subsequent
|
||||
// I/O operations on the underlying object are implementation-dependent.
|
||||
type Seeker interface {
|
||||
Seek(offset int64, whence int) (int64, error)
|
||||
Seek(offset int64, whence int) (int64, error)
|
||||
}
|
||||
|
||||
// ReadWriter is the interface that groups the basic Read and Write methods.
|
||||
type ReadWriter interface {
|
||||
reader
|
||||
Writer
|
||||
reader
|
||||
Writer
|
||||
}
|
||||
```
|
||||
|
||||
@@ -436,7 +386,7 @@ type ReadWriter interface {
|
||||
|
||||
Some common nouns are listed below.
|
||||
|
||||
```go
|
||||
```
|
||||
// A GonicMapper that contains a list of common initialisms taken from golang/lint
|
||||
var LintGonicMapper = GonicMapper{
|
||||
"API": true,
|
||||
@@ -487,15 +437,10 @@ var allowGitHook bool
|
||||
- Local variables should be as short as possible, for example, use buf to refer to buffer, and use i to refer to index.
|
||||
- The code automatically generated by the code generation tool can exclude this rule (such as the Id in `xxx.pb.go`)
|
||||
|
||||
### 2.7 Constant Naming
|
||||
### 2.7 Constant naming
|
||||
|
||||
In Go, constants play a critical role in defining values that do not change throughout the execution of a program. Adhering to best practices in naming constants can significantly improve the readability and maintainability of your code. Here are some guidelines for constant naming:
|
||||
|
||||
- **Camel Case Naming:** The name of a constant must follow the camel case notation. The initial letter should be uppercase or lowercase based on the access control requirements. Uppercase indicates that the constant is exported (visible outside the package), while lowercase indicates package-private visibility (visible only within its own package).
|
||||
|
||||
- **Enumeration Type Constants:** For constants that represent a set of enumerated values, it's recommended to define a corresponding type first. This approach not only enhances type safety but also improves code readability by clearly indicating the purpose of the enumeration.
|
||||
|
||||
**Example:**
|
||||
- The constant name must follow the camel case, and the initial letter is uppercase or lowercase according to the access control decision.
|
||||
- If it is a constant of enumeration type, you need to create the corresponding type first:
|
||||
|
||||
```go
|
||||
// Code defines an error code type.
|
||||
@@ -505,40 +450,11 @@ type Code int
|
||||
const (
|
||||
// ErrUnknown - 0: An unknown error occurred.
|
||||
ErrUnknown Code = iota
|
||||
// ErrFatal - 1: A fatal error occurred.
|
||||
// ErrFatal - 1: An fatal error occurred.
|
||||
ErrFatal
|
||||
)
|
||||
```
|
||||
|
||||
In the example above, `Code` is defined as a new type based on `int`. The enumerated constants `ErrUnknown` and `ErrFatal` are then defined with explicit comments to indicate their purpose and values. This pattern is particularly useful for grouping related constants and providing additional context.
|
||||
|
||||
### Global Variables and Constants Across Packages
|
||||
|
||||
- **Use Constants for Global Variables:** When defining variables that are intended to be accessed across packages, prefer using constants to ensure immutability. This practice avoids unintended modifications to the value, which can lead to unpredictable behavior or hard-to-track bugs.
|
||||
|
||||
- **Lowercase for Package-Private Usage:** If a global variable or constant is intended for use only within its own package, it should start with a lowercase letter. This clearly signals its limited scope of visibility, adhering to Go's access control mechanism based on naming conventions.
|
||||
|
||||
**Guideline:**
|
||||
|
||||
- For global constants that need to be accessed across packages, declare them with an uppercase initial letter. This makes them exported, adhering to Go's visibility rules.
|
||||
- For constants used within the same package, start their names with a lowercase letter to limit their scope to the package.
|
||||
|
||||
**Example:**
|
||||
|
||||
```go
|
||||
package config
|
||||
|
||||
// MaxConnections - the maximum number of allowed connections. Visible across packages.
|
||||
const MaxConnections int = 100
|
||||
|
||||
// minIdleTime - the minimum idle time before a connection is considered stale. Only visible within the config package.
|
||||
const minIdleTime int = 30
|
||||
```
|
||||
|
||||
In this example, `MaxConnections` is a global constant meant to be accessed across packages, hence it starts with an uppercase letter. On the other hand, `minIdleTime` is intended for use only within the `config` package, so it starts with a lowercase letter.
|
||||
|
||||
Following these guidelines ensures that your Go code is more readable, maintainable, and consistent with Go's design philosophy and access control mechanisms.
|
||||
|
||||
### 2.8 Error naming
|
||||
|
||||
- The Error type should be written in the form of FooError.
|
||||
@@ -555,190 +471,6 @@ type ExitError struct {
|
||||
var ErrFormat = errors. New("unknown format")
|
||||
```
|
||||
|
||||
For non-standard Err naming, CICD will report an error
|
||||
|
||||
|
||||
### 2.9 Handling Errors Properly
|
||||
|
||||
In Go, proper error handling is crucial for creating reliable and maintainable applications. It's important to ensure that errors are not ignored or discarded, as this can lead to unpredictable behavior and difficult-to-debug issues. Here are the guidelines and examples regarding the proper handling of errors.
|
||||
|
||||
#### Guideline: Do Not Discard Errors
|
||||
|
||||
- **Mandatory Error Propagation:** When calling a function that returns an error, the calling function must handle or propagate the error, instead of ignoring it. This approach ensures that errors are not silently ignored, allowing higher-level logic to make informed decisions about error handling.
|
||||
|
||||
#### Incorrect Example: Discarding an Error
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
)
|
||||
|
||||
func ReadFileContent(filename string) string {
|
||||
content, _ := ioutil.ReadFile(filename) // Incorrect: Error is ignored
|
||||
return string(content)
|
||||
}
|
||||
|
||||
func main() {
|
||||
content := ReadFileContent("example.txt")
|
||||
log.Println(content)
|
||||
}
|
||||
```
|
||||
|
||||
In this incorrect example, the error returned by `ioutil.ReadFile` is ignored. This can lead to situations where the program continues execution even if the file doesn't exist or cannot be accessed, potentially causing more cryptic errors downstream.
|
||||
|
||||
#### Correct Example: Propagating an Error
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
)
|
||||
|
||||
// ReadFileContent attempts to read and return the content of the specified file.
|
||||
// It returns an error if reading fails.
|
||||
func ReadFileContent(filename string) (string, error) {
|
||||
content, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
// Correct: Propagate the error
|
||||
return "", err
|
||||
}
|
||||
return string(content), nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
content, err := ReadFileContent("example.txt")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to read file: %v", err)
|
||||
}
|
||||
log.Println(content)
|
||||
}
|
||||
```
|
||||
|
||||
In the correct example, the error returned by `ioutil.ReadFile` is propagated back to the caller. The `main` function then checks the error and terminates the program with an appropriate error message if an error occurred. This approach ensures that errors are handled appropriately, and the program does not proceed with invalid state.
|
||||
|
||||
### Best Practices for Error Handling
|
||||
|
||||
1. **Always check the error returned by a function.** Do not ignore it.
|
||||
2. **Propagate errors up the call stack unless they can be handled gracefully at the current level.**
|
||||
3. **Provide context for errors when propagating them, making it easier to trace the source of the error.** This can be achieved using `fmt.Errorf` with the `%w` verb or dedicated wrapping functions provided by some error handling packages.
|
||||
4. **Log the error at the point where it is handled or makes the program to terminate, to provide insight into the failure.**
|
||||
|
||||
By following these guidelines, you ensure that your Go applications handle errors in a consistent and effective manner, improving their reliability and maintainability.
|
||||
|
||||
|
||||
### 2.10 Using Context with IO or Inter-Process Communication (IPC)
|
||||
|
||||
In Go, `context.Context` is a powerful construct for managing deadlines, cancellation signals, and other request-scoped values across API boundaries and between processes. It is particularly important in I/O operations or inter-process communication (IPC), where operations might need to be cancelled or timed out.
|
||||
|
||||
#### Guideline: Use Context for IO and IPC
|
||||
|
||||
- **Mandatory Use of Context:** When performing I/O operations or inter-process communication, it's crucial to use `context.Context` to manage the lifecycle of these operations. This includes setting deadlines, handling cancellation signals, and passing request-scoped values.
|
||||
|
||||
#### Incorrect Example: Ignoring Context in an HTTP Call
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"log"
|
||||
)
|
||||
|
||||
// FetchData makes an HTTP GET request to the specified URL and returns the response body.
|
||||
// This function does not use context, making it impossible to cancel the request or set a deadline.
|
||||
func FetchData(url string) (string, error) {
|
||||
resp, err := http.Get(url) // Incorrect: Ignoring context
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(body), nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
data, err := FetchData("http://example.com")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to fetch data: %v", err)
|
||||
}
|
||||
log.Println(data)
|
||||
}
|
||||
```
|
||||
|
||||
In this incorrect example, the `FetchData` function makes an HTTP GET request without using a `context`. This approach does not allow the request to be cancelled or a timeout to be set, potentially leading to resources being wasted if the server takes too long to respond or if the operation needs to be aborted for any reason.
|
||||
|
||||
#### Correct Example: Using Context in an HTTP Call
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
// FetchDataWithContext makes an HTTP GET request to the specified URL using the provided context.
|
||||
// This allows the request to be cancelled or timed out according to the context's deadline.
|
||||
func FetchDataWithContext(ctx context.Context, url string) (string, error) {
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(body), nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Create a context with a 5-second timeout
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
data, err := FetchDataWithContext(ctx, "http://example.com")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to fetch data: %v", err)
|
||||
}
|
||||
log.Println(data)
|
||||
}
|
||||
```
|
||||
|
||||
In the correct example, `FetchDataWithContext` uses a context to make the HTTP GET request. This allows the operation to be cancelled or subjected to a timeout, as dictated by the context passed to it. The `context.WithTimeout` function is used in `main` to create a context that cancels the request if it takes longer than 5 seconds, demonstrating a practical use of context to manage operation lifecycle.
|
||||
|
||||
### Best Practices for Using Context
|
||||
|
||||
1. **Pass context as the first parameter of a function**, following the convention `func(ctx context.Context, ...)`.
|
||||
2. **Never ignore the context** provided to you in functions that support it. Always use it in your I/O or IPC operations.
|
||||
3. **Avoid storing context in a struct**. Contexts are meant to be passed around within the call stack, not stored.
|
||||
4. **Use context's cancellation and deadline features** to control the lifecycle of blocking operations, especially in network I/O and IPC scenarios.
|
||||
5. **Propagate context down the call stack** to any function that supports it, ensuring that your application can respond to cancellation signals and deadlines effectively.
|
||||
|
||||
By adhering to these guidelines and examples, you can ensure that your Go applications handle I/O and IPC operations more reliably and efficiently, with proper support for cancellation, timeouts, and request-scoped values.
|
||||
|
||||
|
||||
## 3. Comment specification
|
||||
|
||||
- Each exportable name must have a comment, which briefly introduces the exported variables, functions, structures, interfaces, etc.
|
||||
@@ -791,7 +523,6 @@ package genericclioptions
|
||||
// ErrSigningMethod defines invalid signing method error.
|
||||
var ErrSigningMethod = errors. New("Invalid signing method")
|
||||
```
|
||||
|
||||
- When there is a large block of constant or variable definition, you can comment a general description in front, and then comment the definition of the constant in detail before or at the end of each line of constant, for example:
|
||||
```go
|
||||
// Code must start with 1xxxxx.
|
||||
@@ -836,7 +567,7 @@ Each function or method that needs to be exported must have a comment, the forma
|
||||
// BeforeUpdate run before update database record.
|
||||
func (p *Policy) BeforeUpdate() (err error) {
|
||||
// normal code
|
||||
return nil
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1012,9 +743,9 @@ for i := 0; i < 10; i++ {
|
||||
```go
|
||||
// bad
|
||||
for file := range files {
|
||||
fd, err := os. Open(file)
|
||||
if err != nil {
|
||||
return err
|
||||
fd, err := os. Open(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fd. Close()
|
||||
// normal code
|
||||
@@ -1022,14 +753,14 @@ defer fd. Close()
|
||||
|
||||
//good
|
||||
for file := range files {
|
||||
func() {
|
||||
fd, err := os. Open(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fd. Close()
|
||||
// normal code
|
||||
}()
|
||||
func() {
|
||||
fd, err := os. Open(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fd. Close()
|
||||
// normal code
|
||||
}()
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1157,7 +888,6 @@ type LogHandler struct {
|
||||
}
|
||||
var_http.Handler = LogHandler{}
|
||||
```
|
||||
|
||||
- When the server processes a request, it should create a context, save the relevant information of the request (such as requestID), and pass it in the function call chain.
|
||||
|
||||
### 9.1 Performance
|
||||
@@ -1170,246 +900,3 @@ var_http.Handler = LogHandler{}
|
||||
- If you want to directly modify the value of the map, the value can only be a pointer, otherwise the original value must be overwritten.
|
||||
- map needs to be locked during concurrency.
|
||||
- The conversion of interface{} cannot be checked during compilation, it can only be checked at runtime, be careful to cause panic.
|
||||
|
||||
## 10 Golang CI Lint
|
||||
|
||||
- Golang CI Lint is a fast Go linters runner. It runs linters in parallel, uses caching, and works well with all environments, including CI.
|
||||
|
||||
**In local development, you can use the following command to install Golang CI Lint: **
|
||||
|
||||
```bash
|
||||
make lint
|
||||
```
|
||||
|
||||
**In CI/CD, Check the Github Actions status code below after you submit the code directly**
|
||||
|
||||
[](https://github.com/openimsdk/open-im-server/actions/workflows/golangci-lint.yml)
|
||||
|
||||
golangci lint can select the types of tools, refer to the official documentation: [https://golangci-lint.run/usage/linters/](https://golangci-lint.run/usage/linters/)
|
||||
|
||||
The types of comments we currently use include: [https://github.com/openimsdk/open-im-server/blob/main/.golangci.yml](https://github.com/openimsdk/open-im-server/blob/main/.golangci.yml) the `linters.enable` field in the file.
|
||||
|
||||
e.g:
|
||||
```yaml
|
||||
linters:
|
||||
# please, do not use `enable-all`: it's deprecated and will be removed soon.
|
||||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||
# enable-all: true
|
||||
disable-all: true
|
||||
enable:
|
||||
- typecheck # Basic type checking
|
||||
- gofmt # Format check
|
||||
- govet # Go's standard linting tool
|
||||
- gosimple # Suggestions for simplifying code
|
||||
- misspell # Spelling mistakes
|
||||
- staticcheck # Static analysis
|
||||
- unused # Checks for unused code
|
||||
- goimports # Checks if imports are correctly sorted and formatted
|
||||
- godot # Checks for comment punctuation
|
||||
- bodyclose # Ensures HTTP response body is closed
|
||||
- errcheck # Checks for missed error returns
|
||||
fast: true
|
||||
```
|
||||
|
||||
Add that Chinese comments are not allowed in go code, please write a complete golangci lint specification on the basis of the above.
|
||||
|
||||
|
||||
### 10.1 Configuration Document
|
||||
|
||||
This configuration document is designed to configure the operational parameters of OpenIM (a hypothetical or specific code analysis tool), customize output formats, and provide detailed settings for specific code checkers (linters). Below is a summary of the document drafted based on the provided configuration information.
|
||||
|
||||
#### 10.1 Runtime Options
|
||||
|
||||
- **Concurrency** (`concurrency`): Default to use the available CPU count, can be manually set to 4 for parallel analysis.
|
||||
- **Timeout** (`timeout`): Timeout duration for analysis operations, default is 1 minute, set here to 5 minutes.
|
||||
- **Issue Exit Code** (`issues-exit-code`): Exit code defaults to 1 if at least one issue is found.
|
||||
- **Test Files** (`tests`): Whether to include test files, defaults to true.
|
||||
- **Build Tags** (`build-tags`): Specify build tags used by all linters, defaults to an empty list. Example adds `mytag`.
|
||||
- **Skip Directories** (`skip-dirs`): Configure which directories' issues are not reported, defaults to empty, but some default directories are independently skipped.
|
||||
- **Skip Files** (`skip-files`): Specify files where issues should not be reported, supports regular expressions.
|
||||
|
||||
#### 10.2 Output Configuration
|
||||
|
||||
- **Format** (`format`): Set output format, default is "colored-line-number".
|
||||
- **Print Issued Lines** (`print-issued-lines`): Whether to print the lines where issues occur, defaults to true.
|
||||
- **Print Linter Name** (`print-linter-name`): Whether to print the linter name at the end of issue text, defaults to true.
|
||||
- **Uniqueness Filter** (`uniq-by-line`): Whether to make issue outputs unique per line, defaults to true.
|
||||
- **Path Prefix** (`path-prefix`): Prefix to add to output file references, defaults to no prefix.
|
||||
- **Sort Results** (`sort-results`): Sort results by file path, line number, and column number.
|
||||
|
||||
#### 10.3 Linters Settings
|
||||
|
||||
In the configuration file, the `linters-settings` section allows detailed configuration of individual linters. Below are examples of specific linters settings and their purposes:
|
||||
|
||||
- **bidichk**: Used to check bidirectional text characters, ensuring correct display direction of text, especially when dealing with mixed left-to-right (LTR) and right-to-left (RTL) text.
|
||||
|
||||
- **dogsled**: Monitors excessive use of blank identifiers (`_`) in assignment operations, which may obscure data processing errors or unclear logic.
|
||||
|
||||
- **dupl**: Identifies duplicate code blocks, helping developers avoid code redundancy. The `threshold` parameter in settings allows adjustment of code similarity threshold triggering warnings.
|
||||
|
||||
- **errcheck**: Checks for unhandled errors. In Go, error handling is achieved by checking function return values. This linter helps ensure all errors are properly handled.
|
||||
|
||||
- **exhaustive**: Checks if `switch` statements include all possible values of an enum type, ensuring exhaustiveness of code. This helps avoid forgetting to handle certain cases.
|
||||
|
||||
#### 10.4 Example: `errcheck`
|
||||
|
||||
**Incorrect Code Example**:
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
f, _ := os.Open("filename.ext")
|
||||
defer f.Close()
|
||||
}
|
||||
```
|
||||
|
||||
**Issue**: In the above code, the error return value of `os.Open` function is explicitly ignored. This is a common mistake as it may lead to unhandled errors and hard-to-trace bugs.
|
||||
|
||||
**Correct Form**:
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
f, err := os.Open("filename.ext")
|
||||
if err != nil {
|
||||
fmt.Printf("error opening file: %v\n", err)
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
}
|
||||
```
|
||||
|
||||
In the correct form, by checking the error (`err`) returned by `os.Open`, we gracefully handle error cases rather than simply ignoring them.
|
||||
|
||||
#### 10.5 Example: `gofmt`
|
||||
|
||||
**Incorrect Code Example**:
|
||||
```go
|
||||
package main
|
||||
import "fmt"
|
||||
func main() {
|
||||
fmt.Println("Hello, world!")
|
||||
}
|
||||
```
|
||||
|
||||
**Issue**: This code snippet doesn't follow Go's standard formatting rules, for example, incorrect indentation of `fmt.Println`.
|
||||
|
||||
**Correct Form**:
|
||||
```go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, world!")
|
||||
}
|
||||
```
|
||||
|
||||
Using `gofmt` tool can automatically fix such formatting issues, ensuring the code adheres to the coding standards of the Go community.
|
||||
|
||||
#### 10.6 Example: `unused`
|
||||
|
||||
**Incorrect Code Example**:
|
||||
```go
|
||||
package main
|
||||
|
||||
func helper() {}
|
||||
|
||||
func main() {}
|
||||
```
|
||||
|
||||
**Issue**: The `helper` function is defined but not called anywhere, indicating potential redundant code or missing functionality implementation.
|
||||
|
||||
**Correct Form**:
|
||||
```go
|
||||
package main
|
||||
|
||||
// If the helper function is indeed needed, ensure it's used properly.
|
||||
func helper() {
|
||||
// Implement the function's functionality or ensure it's called elsewhere
|
||||
}
|
||||
|
||||
func main() {
|
||||
helper()
|
||||
}
|
||||
```
|
||||
|
||||
To improve the section on Linters settings in the document, we'll expand with more detailed explanations and reinforce understanding through examples.
|
||||
|
||||
#### 10.7 Example: `dogsled`
|
||||
|
||||
**Incorrect Code Example**:
|
||||
```go
|
||||
func getValues() (int, int, int) {
|
||||
return 1, 2, 3
|
||||
}
|
||||
|
||||
func main() {
|
||||
_, _, val := getValues()
|
||||
fmt.Println(val) // Only interested in the third return value
|
||||
}
|
||||
```
|
||||
|
||||
**Explanation**: In the above code, we use two blank identifiers to ignore the first two return values. Excessive use of blank identifiers can make code reading difficult.
|
||||
|
||||
**Improved Code**:
|
||||
Consider refactoring the function or the usage of return values to reduce the need for blank identifiers or explicitly comment why ignoring certain values is safe.
|
||||
|
||||
#### 10.8: `exhaustive`
|
||||
|
||||
**Incorrect Code Example**:
|
||||
```go
|
||||
type Fruit int
|
||||
|
||||
const (
|
||||
Apple Fruit = iota
|
||||
Banana
|
||||
Orange
|
||||
)
|
||||
|
||||
func getFruitName(f Fruit) string {
|
||||
switch f {
|
||||
case Apple:
|
||||
return "Apple"
|
||||
case Banana:
|
||||
return "Banana"
|
||||
// Missing handling for Orange
|
||||
}
|
||||
return "Unknown"
|
||||
}
|
||||
```
|
||||
|
||||
**Explanation**: In this code, the `switch` statement doesn't cover all possible values of the `Fruit` type; the case for `Orange` is missing.
|
||||
|
||||
**Improved Code**:
|
||||
```go
|
||||
func getFruitName(f Fruit) string {
|
||||
switch f {
|
||||
case Apple:
|
||||
return "Apple"
|
||||
case Banana:
|
||||
return "Banana"
|
||||
case Orange:
|
||||
return "Orange"
|
||||
}
|
||||
return "Unknown"
|
||||
}
|
||||
```
|
||||
|
||||
By adding the missing `case`, we ensure the `switch` statement is exhaustive, handling every possible enum value.
|
||||
|
||||
#### 10.9 Optimization of Configuration Files and Application of Code Analysis Tools
|
||||
|
||||
Through these examples, we demonstrate how to improve code quality by identifying and fixing common coding issues. OpenIM's configuration files allow developers to customize linters' behavior according to project requirements, ensuring code compliance with predefined quality standards and style guidelines.
|
||||
|
||||
By employing these tools and configuration strategies, teams can reduce the number of bugs, enhance code maintainability, and facilitate efficient collaboration during code review processes.
|
||||
|
||||
@@ -26,7 +26,6 @@ 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
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ In the `scripts/init_config.sh` file, we defined some template files. These temp
|
||||
```
|
||||
# Defines an associative array where the keys are the template files and the values are the corresponding output files.
|
||||
declare -A TEMPLATES=(
|
||||
["${OPENIM_ROOT}/scripts/template/config-tmpl/env.template"]="${OPENIM_OUTPUT_SUBPATH}/bin/.env"
|
||||
["${OPENIM_ROOT}/scripts/template/config-tmpl/config.yaml"]="${OPENIM_OUTPUT_SUBPATH}/bin/config.yaml"
|
||||
[""${OPENIM_ROOT}"/scripts/template/config-tmpl/env.template"]="${OPENIM_OUTPUT_SUBPATH}/bin/.env"
|
||||
[""${OPENIM_ROOT}"/scripts/template/config-tmpl/config.yaml"]="${OPENIM_OUTPUT_SUBPATH}/bin/config.yaml"
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
+20
-386
@@ -1,386 +1,20 @@
|
||||
# OpenIM Logging and Error Handling Documentation
|
||||
|
||||
## Script Logging Documentation Link
|
||||
|
||||
If you wish to view the script's logging documentation, you can click on this link: [Logging Documentation](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/contrib/bash-log.md).
|
||||
|
||||
Below is the documentation for logging and error handling in the OpenIM Go project.
|
||||
|
||||
To create a standard set of documentation that is quick to read and easy to understand, we will highlight key information about the `Logger` interface and the `CodeError` interface. This includes the purpose of each interface, key methods, and their use cases. This will help developers quickly grasp how to effectively use logging and error handling within the project.
|
||||
|
||||
## Logging (`Logger` Interface)
|
||||
|
||||
### Purpose
|
||||
The `Logger` interface aims to provide the OpenIM project with a unified and flexible logging mechanism, supporting structured logging formats for efficient log management and analysis.
|
||||
|
||||
### Key Methods
|
||||
|
||||
- **Debug, Info, Warn, Error**
|
||||
Log messages of different levels to suit various logging needs and scenarios. These methods accept a context (`context.Context`), a message (`string`), and key-value pairs (`...interface{}`), allowing the log to carry rich context information.
|
||||
|
||||
- **WithValues**
|
||||
Append key-value pair information to log messages, returning a new `Logger` instance. This helps in adding consistent context information.
|
||||
|
||||
- **WithName**
|
||||
Set the name of the logger, which helps in identifying the source of the logs.
|
||||
|
||||
- **WithCallDepth**
|
||||
Adjust the call stack depth to accurately identify the source of the log message.
|
||||
|
||||
### Use Cases
|
||||
|
||||
- Developers should choose the appropriate logging level (such as `Debug`, `Info`, `Warn`, `Error`) based on the importance of the information when logging.
|
||||
- Use `WithValues` and `WithName` to add richer context information to logs, facilitating subsequent tracking and analysis.
|
||||
|
||||
## Error Handling (`CodeError` Interface)
|
||||
|
||||
### Purpose
|
||||
The `CodeError` interface is designed to provide a unified mechanism for error handling and wrapping, making error information more detailed and manageable.
|
||||
|
||||
### Key Methods
|
||||
|
||||
- **Code**
|
||||
Return the error code to distinguish between different types of errors.
|
||||
|
||||
- **Msg**
|
||||
Return the error message description to display to the user.
|
||||
|
||||
- **Detail**
|
||||
Return detailed information about the error for further debugging by developers.
|
||||
|
||||
- **WithDetail**
|
||||
Add detailed information to the error, returning a new `CodeError` instance.
|
||||
|
||||
- **Is**
|
||||
Determine whether the current error matches a specified error, supporting a flexible error comparison mechanism.
|
||||
|
||||
- **Wrap**
|
||||
Wrap another error with additional message description, facilitating the tracing of the error's cause.
|
||||
|
||||
### Use Cases
|
||||
|
||||
- When defining errors with specific codes and messages, use error types that implement the `CodeError` interface.
|
||||
- Use `WithDetail` to add additional context information to errors for more accurate problem localization.
|
||||
- Use the `Is` method to judge the type of error for conditional branching.
|
||||
- Use the `Wrap` method to wrap underlying errors while adding more contextual descriptions.
|
||||
|
||||
## Logging Standards and Code Examples
|
||||
|
||||
In the OpenIM project, we use the unified logging package `github.com/OpenIMSDK/tools/log` for logging to achieve efficient log management and analysis. This logging package supports structured logging formats, making it easier for developers to handle log information.
|
||||
|
||||
### Logger Interface and Implementation
|
||||
|
||||
The logger interface is defined as follows:
|
||||
|
||||
```go
|
||||
type Logger interface {
|
||||
Debug(ctx context.Context, msg string, keysAndValues ...interface{})
|
||||
Info(ctx context.Context, msg string, keysAndValues ...interface{})
|
||||
Warn(ctx context.Context, msg string, err error, keysAndValues ...interface{})
|
||||
Error(ctx context.Context, msg string, err error, keysAndValues ...interface{})
|
||||
WithValues(keysAndValues ...interface{}) Logger
|
||||
WithName(name string) Logger
|
||||
WithCallDepth(depth int) Logger
|
||||
}
|
||||
```
|
||||
|
||||
Example code: Using the `Logger` interface to log at the info level.
|
||||
|
||||
```go
|
||||
func main() {
|
||||
logger := log.NewLogger().WithName("MyService")
|
||||
ctx := context.Background()
|
||||
logger.Info(ctx, "Service started", "port", "8080")
|
||||
}
|
||||
```
|
||||
|
||||
## Error Handling and Code Examples
|
||||
|
||||
We use the `github.com/OpenIMSDK/tools/errs` package for unified error handling and wrapping.
|
||||
|
||||
### CodeError Interface and Implementation
|
||||
|
||||
The error interface is defined as follows:
|
||||
|
||||
```go
|
||||
type CodeError interface {
|
||||
Code() int
|
||||
Msg() string
|
||||
Detail() string
|
||||
WithDetail(detail string) CodeError
|
||||
Is(err error, loose ...bool) bool
|
||||
Wrap(msg ...string) error
|
||||
error
|
||||
}
|
||||
```
|
||||
|
||||
Example code: Creating and using the `CodeError` interface to handle errors.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
)
|
||||
|
||||
func main() {
|
||||
err := errs.New(404, "Resource not found")
|
||||
err = err.WithDetail("
|
||||
|
||||
More details")
|
||||
if e, ok := err.(errs.CodeError); ok {
|
||||
fmt.Println(e.Code(), e.Msg(), e.Detail())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Detailed Logging Standards and Code Examples
|
||||
|
||||
1. **Print key information at startup**
|
||||
It is crucial to print entry parameters and key process information at program startup. This helps understand the startup state and configuration of the program.
|
||||
|
||||
**Code Example**:
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Program startup, version: 1.0.0")
|
||||
fmt.Printf("Connecting to database: %s\n", os.Getenv("DATABASE_URL"))
|
||||
}
|
||||
```
|
||||
|
||||
2. **Use `tools/log` and `fmt` for logging**
|
||||
Logging should be done using a specialized logging library for unified management and formatted log output.
|
||||
|
||||
**Code Example**: Logging an info level message with `tools/log`.
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
log.Info(ctx, "Application started successfully")
|
||||
}
|
||||
```
|
||||
|
||||
3. **Use standard error output for startup failures or critical information**
|
||||
Critical error messages or program startup failures should be indicated to the user through standard error output.
|
||||
|
||||
**Code Example**:
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func checkEnvironment() bool {
|
||||
return os.Getenv("REQUIRED_ENV") != ""
|
||||
}
|
||||
|
||||
func main() {
|
||||
if !checkEnvironment() {
|
||||
fmt.Fprintln(os.Stderr, "Missing required environment variable")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
We encapsulate it into separate tools, which can output error information through the `tools/log` package.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := apiCmd.Execute(); err != nil {
|
||||
util.ExitWithError(err)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. **Use `tools/log` package for runtime logging**
|
||||
This ensures consistency and control over logging.
|
||||
|
||||
**Code Example**: Same as the above example using `tools/log`. When `tools/log` is not initialized, consider using `fmt` for standard output.
|
||||
|
||||
5. **Error logs should be printed by the top-level caller**
|
||||
This is to avoid duplicate logging of errors, typically errors are caught and logged at the application's outermost level.
|
||||
|
||||
**Code Example**:
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
"context"
|
||||
)
|
||||
|
||||
func doSomething() error {
|
||||
// An error occurs here
|
||||
return errs.Wrap(errors.New("An error occurred"))
|
||||
}
|
||||
|
||||
func controller() error {
|
||||
err := doSomething()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
err := controller()
|
||||
if err != nil {
|
||||
log.Error(context.Background(), "Operation failed", err)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
6. **Handling logs for API RPC calls and non-RPC applications**
|
||||
|
||||
For API RPC calls using gRPC, logs at the information level are printed by middleware on the gRPC server side, reducing the need to manually log in each RPC method. For non-RPC applications, it's recommended to manually log key execution paths to track the application's execution flow.
|
||||
|
||||
**gRPC Server-Side Logging Middleware:**
|
||||
|
||||
In gRPC, `UnaryInterceptor` and `StreamInterceptor` can intercept Unary and Stream type RPC calls, respectively. Here's an example of how to implement a simple Unary RPC logging middleware:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
// unaryServerInterceptor returns a new unary server interceptor that logs each request.
|
||||
func unaryServerInterceptor() grpc.UnaryServerInterceptor {
|
||||
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
|
||||
// Record the start time of the request
|
||||
start := time.Now()
|
||||
// Call the actual RPC method
|
||||
resp, err = handler(ctx, req)
|
||||
// After the request ends, log the duration and other information
|
||||
log.Printf("Request method: %s, duration: %s, error status: %v", info.FullMethod, time.Since(start), status.Code(err))
|
||||
return resp, err
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Create a gRPC server and add the middleware
|
||||
s := grpc.NewServer
|
||||
|
||||
(grpc.UnaryInterceptor(unaryServerInterceptor()))
|
||||
// Register your service
|
||||
|
||||
// Start the gRPC server
|
||||
log.Println("Starting gRPC server...")
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
**Logging for Non-RPC Applications:**
|
||||
|
||||
For non-RPC applications, the key is to log at appropriate places in the code to maintain an execution trace. Here's a simple example showing how to log when handling a task:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
)
|
||||
|
||||
func processTask(taskID string) {
|
||||
// Log the start of task processing
|
||||
log.Printf("Starting task processing: %s", taskID)
|
||||
// Suppose this is where the task is processed
|
||||
|
||||
// Log after the task is completed
|
||||
log.Printf("Task processing completed: %s", taskID)
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Example task ID
|
||||
taskID := "task123"
|
||||
processTask(taskID)
|
||||
}
|
||||
```
|
||||
|
||||
In both scenarios, appropriate logging can help developers and operators monitor the health of the system, trace the source of issues, and quickly locate and resolve problems. For gRPC logging, using middleware can effectively centralize log management and control. For non-RPC applications, ensuring logs are placed at critical execution points can help understand the program's operational flow and state changes.
|
||||
|
||||
### When to Wrap Errors?
|
||||
|
||||
1. **Wrap errors generated within the function**
|
||||
When an error occurs within a function, use `errs.Wrap` to add context information to the original error.
|
||||
|
||||
**Code Example**:
|
||||
```go
|
||||
func doSomething() error {
|
||||
// Suppose an error occurs here
|
||||
err, _ := someFunc()
|
||||
if err != nil {
|
||||
return errs.Wrap(err, "doSomething failed")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **Wrap errors from system calls or other packages**
|
||||
When calling external libraries or system functions that return errors, also add context information to wrap the error.
|
||||
|
||||
**Code Example**:
|
||||
```go
|
||||
func readConfig(file string) error {
|
||||
_, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return errs.Wrap(err, "Failed to read config file")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
3. **No need to re-wrap errors for internal module calls**
|
||||
|
||||
If an error has been appropriately wrapped with sufficient context information in an internal module call, there's no need to wrap it again.
|
||||
|
||||
**Code Example**:
|
||||
```go
|
||||
func doSomething() error {
|
||||
err := doAnotherThing()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
4. **Ensure comprehensive wrapping of errors with detailed messages**
|
||||
When wrapping errors, ensure to provide ample context information to make the error more understandable and easier to debug.
|
||||
|
||||
**Code Example**:
|
||||
```go
|
||||
func connectDatabase() error {
|
||||
err := db.Connect(config.DatabaseURL)
|
||||
if err != nil {
|
||||
return errs.Wrap(err, fmt.Sprintf("Failed to connect to database, URL: %s", config.DatabaseURL))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```
|
||||
## Log Standards
|
||||
|
||||
### Log Standards
|
||||
|
||||
- The unified log package `github.com/openimsdk/open-im-server/internal/pkg/log` should be used for all logging;
|
||||
- Use structured logging formats: `log.Infow`, `log.Warnw`, `log.Errorw`, etc. For example: `log.Infow("Update post function called")`;
|
||||
- All logs should start with an uppercase letter and should not end with a `.`. For example: `log.Infow("Update post function called")`;
|
||||
- Use past tense. For example, use `Could not delete B` instead of `Cannot delete B`;
|
||||
- Adhere to log level standards:
|
||||
- Debug level logs use `log.Debugw`;
|
||||
- Info level logs use `log.Infow`;
|
||||
- Warning level logs use `log.Warnw`;
|
||||
- Error level logs use `log.Errorw`;
|
||||
- Panic level logs use `log.Panicw`;
|
||||
- Fatal level logs use `log.Fatalw`.
|
||||
- Log settings:
|
||||
- Development and test environments: The log level is set to `debug`, the log format can be set to `console` / `json` as needed, and caller is enabled;
|
||||
- Production environment: The log level is set to `info`, the log format is set to `json`, and caller is enabled. (**Note**: In the early stages of going online, to facilitate troubleshooting, the log level can be set to `debug`)
|
||||
- When logging, avoid outputting sensitive information, such as passwords, keys, etc.
|
||||
- If you are calling a logging function in a function/method with a `context.Context` parameter, it is recommended to use `log.L(ctx).Infow()` for logging.
|
||||
@@ -1,258 +0,0 @@
|
||||
# Mac Developer Deployment Guide for OpenIM
|
||||
|
||||
## Introduction
|
||||
|
||||
This guide aims to assist Mac-based developers in contributing effectively to OpenIM. It covers the setup of a development environment tailored for Mac, including the use of GitHub for development workflow and `devcontainer` for a consistent development experience.
|
||||
|
||||
Before contributing to OpenIM through issues and pull requests, make sure you are familiar with GitHub and the [pull request workflow](https://docs.github.com/en/get-started/quickstart/github-flow).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### System Requirements
|
||||
|
||||
- macOS (latest stable version recommended)
|
||||
- Internet connection
|
||||
- Administrator access
|
||||
|
||||
### Knowledge Requirements
|
||||
|
||||
- Basic understanding of Git and GitHub
|
||||
- Familiarity with Docker and containerization
|
||||
- Experience with Go programming language
|
||||
|
||||
## Setting up the Development Environment
|
||||
|
||||
### Installing Homebrew
|
||||
|
||||
Homebrew is an essential package manager for macOS. Install it using:
|
||||
|
||||
```sh
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
```
|
||||
|
||||
### Installing and Configuring Git
|
||||
|
||||
1. Install Git:
|
||||
|
||||
```sh
|
||||
brew install git
|
||||
```
|
||||
|
||||
2. Configure Git with your user details:
|
||||
|
||||
```sh
|
||||
git config --global user.name "Your Name"
|
||||
git config --global user.email "your.email@example.com"
|
||||
```
|
||||
|
||||
### Setting Up the Devcontainer
|
||||
|
||||
`Devcontainers` provide a Docker-based isolated development environment.
|
||||
|
||||
Read [README.md](https://github.com/openimsdk/open-im-server/tree/main/.devcontainer) in the `.devcontainer` directory of the project to learn more about the devcontainer.
|
||||
|
||||
To set it up:
|
||||
|
||||
1. Install Docker Desktop for Mac from [Docker Hub](https://docs.docker.com/desktop/install/mac-install/).
|
||||
2. Install Visual Studio Code and the Remote - Containers extension.
|
||||
3. Open the cloned OpenIM repository in VS Code.
|
||||
4. VS Code will prompt to reopen the project in a container. Accept this to set up the environment automatically.
|
||||
|
||||
### Installing Go and Dependencies
|
||||
|
||||
Use Homebrew to install Go:
|
||||
|
||||
```sh
|
||||
brew install go
|
||||
```
|
||||
|
||||
Ensure the version of Go is compatible with the version required by OpenIM (refer to the main documentation for version requirements).
|
||||
|
||||
### Additional Tools
|
||||
|
||||
Install other required tools like Docker, Vagrant, and necessary GNU utils as described in the main documentation.
|
||||
|
||||
## Mac Deployment openim-chat and openim-server
|
||||
|
||||
To integrate the Chinese document into an English document for Linux deployment, we will first translate the content and then adapt it to suit the Linux environment. Here's how the translated and adapted content might look:
|
||||
|
||||
### Ensure a Clean Environment
|
||||
|
||||
- It's recommended to execute in a new directory.
|
||||
- Run `ps -ef | grep openim` to ensure no OpenIM processes are running.
|
||||
- Run `ps -ef | grep chat` to check for absence of chat-related processes.
|
||||
- Execute `docker ps` to verify there are no related containers running.
|
||||
|
||||
### Source Code Deployment
|
||||
|
||||
#### Deploying openim-server
|
||||
|
||||
Source code deployment is slightly more complex because Docker's networking on Linux differs from Mac.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/openimsdk/open-im-server
|
||||
cd open-im-server
|
||||
|
||||
export OPENIM_IP="Your IP" # If it's a cloud server, setting might not be needed
|
||||
make init # Generates configuration files
|
||||
```
|
||||
|
||||
Before deploying openim-server, modify the Kafka logic in the docker-compose.yml file. Replace:
|
||||
|
||||
```yaml
|
||||
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}:${KAFKA_PORT:-19094}
|
||||
```
|
||||
|
||||
With:
|
||||
|
||||
```yaml
|
||||
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://127.0.0.1:${KAFKA_PORT:-19094}
|
||||
```
|
||||
|
||||
Then start the service:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Before starting the openim-server source, set `config/config.yaml` by replacing all instances of `172.28.0.1` with `127.0.0.1`:
|
||||
|
||||
```bash
|
||||
vim config/config.yaml -c "%s/172\.28\.0\.1/127.0.0.1/g" -c "wq"
|
||||
```
|
||||
|
||||
Then start openim-server:
|
||||
|
||||
```bash
|
||||
make start
|
||||
```
|
||||
|
||||
To check the startup:
|
||||
|
||||
```bash
|
||||
make check
|
||||
```
|
||||
|
||||
<aside>
|
||||
🚧 To avoid mishaps, it's best to wait five minutes before running `make check` again.
|
||||
|
||||
</aside>
|
||||
|
||||
#### Deploying openim-chat
|
||||
|
||||
There are several ways to deploy openim-chat, either by source code or using Docker.
|
||||
|
||||
Navigate back to the parent directory:
|
||||
|
||||
```bash
|
||||
cd ..
|
||||
```
|
||||
|
||||
First, let's look at deploying chat from source:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/openimsdk/chat
|
||||
cd chat
|
||||
make init # Generates configuration files
|
||||
```
|
||||
|
||||
If openim-chat has not deployed MySQL, you will need to deploy it. Note that the official Docker Hub for MySQL does not support architectures like ARM, so you can use the newer version of the open-source edition:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name mysql \
|
||||
-p 13306:3306 \
|
||||
-p 3306:33060 \
|
||||
-v "$(pwd)/components/mysql/data:/var/lib/mysql" \
|
||||
-v "/etc/localtime:/etc/localtime" \
|
||||
-e MYSQL_ROOT_PASSWORD="openIM123" \
|
||||
--restart always \
|
||||
mariadb:10.6
|
||||
```
|
||||
|
||||
Before starting the source code of openim-chat, set `config/config.yaml` by replacing all instances of `172.28.0.1` with `127.0.0.1`:
|
||||
|
||||
```bash
|
||||
vim config/config.yaml -c "%s/172\.28\.0\.1/127.0.0.1/g" -c "wq"
|
||||
```
|
||||
|
||||
Then start openim-chat from source:
|
||||
|
||||
```bash
|
||||
make start
|
||||
```
|
||||
|
||||
To check, ensure the following four processes start successfully:
|
||||
|
||||
```bash
|
||||
make check
|
||||
```
|
||||
|
||||
### Docker Deployment
|
||||
|
||||
Refer to https://github.com/openimsdk/openim-docker for Docker deployment instructions, which can be followed similarly on Linux.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/openimsdk/openim-docker
|
||||
cd openim-docker
|
||||
export OPENIM_IP="Your IP"
|
||||
make init
|
||||
docker compose up -d
|
||||
docker compose logs -f openim-server
|
||||
docker compose logs -f openim-chat
|
||||
```
|
||||
|
||||
## GitHub Development Workflow
|
||||
|
||||
### Creating a New Branch
|
||||
|
||||
For new features or fixes, create a new branch:
|
||||
|
||||
```sh
|
||||
git checkout -b feat/your-feature-name
|
||||
```
|
||||
|
||||
### Making Changes and Committing
|
||||
|
||||
1. Make your changes in the code.
|
||||
2. Stage your changes:
|
||||
|
||||
```sh
|
||||
git add .
|
||||
```
|
||||
|
||||
3. Commit with a meaningful message:
|
||||
|
||||
```sh
|
||||
git commit -m "Add a brief description of your changes"
|
||||
```
|
||||
|
||||
### Pushing Changes and Creating Pull Requests
|
||||
|
||||
1. Push your branch to GitHub:
|
||||
|
||||
```sh
|
||||
git push origin feat/your-feature-name
|
||||
```
|
||||
|
||||
2. Go to your fork on GitHub and create a pull request to the main OpenIM repository.
|
||||
|
||||
### Keeping Your Fork Updated
|
||||
|
||||
Regularly sync your fork with the main repository:
|
||||
|
||||
```sh
|
||||
git fetch upstream
|
||||
git checkout main
|
||||
git rebase upstream/main
|
||||
```
|
||||
|
||||
More read: [https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md)
|
||||
|
||||
## Testing and Quality Assurance
|
||||
|
||||
Run tests as described in the OpenIM documentation to ensure your changes do not break existing functionality.
|
||||
|
||||
## Conclusion
|
||||
|
||||
This guide provides a comprehensive overview for Mac developers to set up and contribute to OpenIM. By following these steps, you can ensure a smooth and efficient development experience. Happy coding!
|
||||
@@ -1,60 +1,30 @@
|
||||
|
||||
|
||||
# OpenIM Offline Deployment Design
|
||||
|
||||
## 1. Base Images
|
||||
|
||||
Below are the base images and their versions you'll need:
|
||||
|
||||
- [ ] bitnami/kafka:3.5.1
|
||||
- [ ] redis:7.0.0
|
||||
- [ ] mongo:6.0.2
|
||||
- [ ] bitnami/zookeeper:3.8
|
||||
- [ ] minio/minio:RELEASE.2024-01-11T07-46-16Z
|
||||
|
||||
> [!IMPORTANT]
|
||||
> It is important to note that OpenIM removed mysql components from versions v3.5.0 (release-v3.5) and above, so mysql can be deployed without this requirement or above
|
||||
|
||||
**If you need to install more IM components or monitoring products:**
|
||||
|
||||
OpenIM:
|
||||
|
||||
> [!TIP]
|
||||
> If you need to install more IM components or monitoring products [images.md](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md)
|
||||
|
||||
- [ ] ghcr.io/openimsdk/openim-web:<version-name>
|
||||
- [ ] ghcr.io/openimsdk/openim-admin:<version-name>
|
||||
- [ ] ghcr.io/openimsdk/openim-chat:<version-name>
|
||||
- [ ] ghcr.io/openimsdk/openim-server:<version-name>
|
||||
|
||||
|
||||
Monitoring:
|
||||
|
||||
- [ ] prom/prometheus:v2.48.1
|
||||
- [ ] prom/alertmanager:v0.23.0
|
||||
- [ ] grafana/grafana:10.2.2
|
||||
- [ ] bitnami/node-exporter:1.7.0
|
||||
|
||||
- wurstmeister/kafka
|
||||
- redis:7.0.0
|
||||
- mongo:6.0.2
|
||||
- mysql:5.7
|
||||
- wurstmeister/zookeeper
|
||||
- minio/minio
|
||||
|
||||
Use the following commands to pull these base images:
|
||||
|
||||
```bash
|
||||
docker pull bitnami/kafka:3.5.1
|
||||
```
|
||||
docker pull wurstmeister/kafka
|
||||
docker pull redis:7.0.0
|
||||
docker pull mongo:6.0.2
|
||||
docker pull mariadb:10.6
|
||||
docker pull bitnami/zookeeper:3.8
|
||||
docker pull minio/minio:2024-01-11T07-46-16Z
|
||||
docker pull mysql:5.7
|
||||
docker pull wurstmeister/zookeeper
|
||||
docker pull minio/minio
|
||||
```
|
||||
|
||||
If you need to install more IM components or monitoring products:
|
||||
|
||||
```bash
|
||||
docker pull prom/prometheus:v2.48.1
|
||||
docker pull prom/alertmanager:v0.23.0
|
||||
docker pull grafana/grafana:10.2.2
|
||||
docker pull bitnami/node-exporter:1.7.0
|
||||
```
|
||||
|
||||
## 2. OpenIM Images
|
||||
## 2. OpenIM & Chat Images
|
||||
|
||||
**For detailed understanding of version management and storage of OpenIM and Chat**: [version.md](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md)
|
||||
|
||||
@@ -72,26 +42,9 @@ docker pull ghcr.io/openimsdk/openim-server:<version-name>
|
||||
- Execute the following command to pull the image:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/openimsdk/openim-chat:<version-name>
|
||||
docker pull ghcr.io/openimsdk/openim-server:<version-name>
|
||||
```
|
||||
|
||||
### Web Image
|
||||
|
||||
- Execute the following command to pull the image:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/openimsdk/openim-web:<version-name>
|
||||
```
|
||||
|
||||
### Admin Image
|
||||
|
||||
- Execute the following command to pull the image:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/openimsdk/openim-admin:<version-name>
|
||||
```
|
||||
|
||||
|
||||
## 3. Image Storage Selection
|
||||
|
||||
**Repositories**:
|
||||
@@ -118,61 +71,46 @@ You can select from the following versions:
|
||||
1. **Pull images**: Execute the above `docker pull` commands to pull all required images locally.
|
||||
2. **Save images**:
|
||||
|
||||
```bash
|
||||
```
|
||||
docker save -o <tar-file-name>.tar <image-name>
|
||||
```
|
||||
|
||||
If you want to save all the images, use the following command:
|
||||
1. **Fetch code**: Clone the repository:
|
||||
|
||||
```bash
|
||||
docker save -o <tar-file-name>.tar $(docker images -q)
|
||||
```
|
||||
git clone https://github.com/OpenIMSDK/openim-docker.git
|
||||
```
|
||||
|
||||
3. **Fetch code**: Clone the repository:
|
||||
Or download the code from [Releases](https://github.com/OpenIMSDK/openim-docker/releases/).
|
||||
|
||||
1. **Transfer files**: Use `scp` to transfer all images and code to the intranet server.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/openimsdk/openim-docker.git
|
||||
```
|
||||
|
||||
Or download the code from [Releases](https://github.com/openimsdk/openim-docker/releases/).
|
||||
|
||||
> Because of the difference between win and linux newlines, please do not clone the repository with win and then synchronize scp to linux.
|
||||
|
||||
4. **Transfer files**: Use `scp` to transfer all images and code to the intranet server.
|
||||
|
||||
```bash
|
||||
scp <tar-file-name>.tar user@remote-ip:/path/on/remote/server
|
||||
```
|
||||
|
||||
Or choose other transfer methods such as a hard drive.
|
||||
|
||||
5. **Import images**: On the intranet server:
|
||||
1. **Import images**: On the intranet server:
|
||||
|
||||
```bash
|
||||
```
|
||||
docker load -i <tar-file-name>.tar
|
||||
```
|
||||
|
||||
Import directly with shortcut commands:
|
||||
1. **Deploy**: Navigate to the `openim-docker` repository directory and follow the README guide for deployment.
|
||||
2. **Deploy using Docker-compose**:
|
||||
|
||||
```bash
|
||||
for i in `ls ./`;do docker load -i $i;done
|
||||
```
|
||||
docker-compose up -d
|
||||
|
||||
6. **Deploy**: Navigate to the `openim-docker` repository directory and follow the [README guide](https://github.com/openimsdk/openim-docker) for deployment.
|
||||
|
||||
7. **Deploy using docker compose**:
|
||||
|
||||
```bash
|
||||
export OPENIM_IP="your ip" # Set Ip
|
||||
make init # Init config
|
||||
docker compose up -d # Deployment
|
||||
docker compose ps # Verify
|
||||
# Verify
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
> **Note**: If you're using a version of Docker prior to 20, make sure you've installed `docker-compose`.
|
||||
|
||||
## 6. Reference Links
|
||||
|
||||
- [openimsdk Issue #432](https://github.com/openimsdk/open-im-server/issues/432)
|
||||
- [OpenIMSDK Issue #432](https://github.com/openimsdk/open-im-server/issues/432)
|
||||
- [Notion Link](https://nsddd.notion.site/435ee747c0bc44048da9300a2d745ad3?pvs=25)
|
||||
- [openimsdk Issue #474](https://github.com/openimsdk/open-im-server/issues/474)
|
||||
- [OpenIMSDK Issue #474](https://github.com/openimsdk/open-im-server/issues/474)
|
||||
@@ -111,35 +111,32 @@ Importing Grafana Dashboards is a straightforward process and is applicable to O
|
||||
|
||||
To monitor OpenIM in Grafana, you need to focus on three categories of key metrics, each with its specific deployment and configuration steps:
|
||||
|
||||
**OpenIM Metrics (`prometheus-dashboard.yaml`)**:
|
||||
1. **OpenIM Metrics (`prometheus-dashboard.yaml`)**:
|
||||
+ **Configuration File Path**: Located at `config/prometheus-dashboard.yaml`.
|
||||
+ **Enabling Monitoring**: Set the environment variable `export PROMETHEUS_ENABLE=true` to enable Prometheus monitoring.
|
||||
+ **More Information**: Refer to the [OpenIM Configuration Guide](https://docs.openim.io/configurations/prometheus-integration).
|
||||
2. **Node Exporter**:
|
||||
+ **Container Deployment**: Deploy the `quay.io/prometheus/node-exporter` container for node monitoring.
|
||||
+ **Get Dashboard**: Access the [Node Exporter Full Feature Dashboard](https://grafana.com/grafana/dashboards/1860-node-exporter-full/) and import it using YAML file download or ID import.
|
||||
+ **Deployment Guide**: Refer to the [Node Exporter Deployment Documentation](https://prometheus.io/docs/guides/node-exporter/).
|
||||
3. **Middleware Metrics**: Each middleware requires specific steps and configurations to enable monitoring. Here is a list of common middleware and links to their respective setup guides:
|
||||
+ MySQL:
|
||||
+ **Configuration**: Ensure MySQL has performance monitoring enabled.
|
||||
+ **Link**: Refer to the [MySQL Monitoring Configuration Guide](https://grafana.com/docs/grafana/latest/datasources/mysql/).
|
||||
+ Redis:
|
||||
+ **Configuration**: Configure Redis to allow monitoring data export.
|
||||
+ **Link**: Refer to the [Redis Monitoring Guide](https://grafana.com/docs/grafana/latest/datasources/redis/).
|
||||
+ MongoDB:
|
||||
+ **Configuration**: Set up monitoring metrics for MongoDB.
|
||||
+ **Link**: Refer to the [MongoDB Monitoring Guide](https://grafana.com/grafana/plugins/grafana-mongodb-datasource/).
|
||||
+ Kafka:
|
||||
+ **Configuration**: Integrate Kafka with Prometheus monitoring.
|
||||
+ **Link**: Refer to the [Kafka Monitoring Guide](https://grafana.com/grafana/plugins/grafana-kafka-datasource/).
|
||||
+ Zookeeper:
|
||||
+ **Configuration**: Ensure Zookeeper can be monitored by Prometheus.
|
||||
+ **Link**: Refer to the [Zookeeper Monitoring Configuration](https://grafana.com/docs/grafana/latest/datasources/zookeeper/).
|
||||
|
||||
- **Configuration File Path**: Find this at `config/prometheus-dashboard.yaml`.
|
||||
- **Enabling Monitoring**: Activate Prometheus monitoring by setting the environment variable: `export PROMETHEUS_ENABLE=true`.
|
||||
- **More Information**: For detailed instructions, see the [OpenIM Configuration Guide](https://docs.openim.io/configurations/prometheus-integration).
|
||||
|
||||
**Node Exporter**:
|
||||
|
||||
- **Container Deployment**: Use the container `quay.io/prometheus/node-exporter` for effective node monitoring.
|
||||
- **Access Dashboard**: Visit the [Node Exporter Full Feature Dashboard](https://grafana.com/grafana/dashboards/1860-node-exporter-full/) for dashboard integration either through YAML file download or ID.
|
||||
- **Deployment Guide**: For deployment steps, consult the [Node Exporter Deployment Documentation](https://prometheus.io/docs/guides/node-exporter/).
|
||||
|
||||
**Middleware Metrics**: Different middlewares require unique steps and configurations for monitoring:
|
||||
|
||||
- MySQL:
|
||||
- **Configuration**: Make sure MySQL is set up for performance monitoring.
|
||||
- **Guide**: See the [MySQL Monitoring Configuration Guide](https://grafana.com/docs/grafana/latest/datasources/mysql/).
|
||||
- Redis:
|
||||
- **Configuration**: Adjust Redis settings to enable monitoring data export.
|
||||
- **Guide**: Consult the [Redis Monitoring Guide](https://grafana.com/docs/grafana/latest/datasources/redis/).
|
||||
- MongoDB:
|
||||
- **Configuration**: Configure MongoDB for monitoring metrics.
|
||||
- **Guide**: Visit the [MongoDB Monitoring Guide](https://grafana.com/grafana/plugins/grafana-mongodb-datasource/).
|
||||
- Kafka:
|
||||
- **Configuration**: Set up Kafka for Prometheus monitoring integration.
|
||||
- **Guide**: Refer to the [Kafka Monitoring Guide](https://grafana.com/grafana/plugins/grafana-kafka-datasource/).
|
||||
- Zookeeper:
|
||||
- **Configuration**: Ensure Prometheus can monitor Zookeeper.
|
||||
- **Guide**: Check out the [Zookeeper Monitoring Configuration](https://grafana.com/docs/grafana/latest/datasources/zookeeper/).
|
||||
|
||||
**Importing Steps**:
|
||||
|
||||
|
||||
@@ -1,251 +0,0 @@
|
||||
# OpenIM Release Automation Design Document
|
||||
|
||||
This document outlines the automation process for releasing OpenIM. You can use the `make release` command for automated publishing. We will discuss how to use the `make release` command and Github Actions CICD separately, while also providing insight into the design principles involved.
|
||||
|
||||
## Github Actions Automation
|
||||
|
||||
In our CICD pipeline, we have implemented logic for automating the release process using the goreleaser tool. To achieve this, follow these steps on your local machine or server:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/openimsdk/open-im-server
|
||||
cd open-im-server
|
||||
git tag -a v3.6.0 -s -m "release: xxx"
|
||||
# For pre-release versions: git tag -a v3.6.0-rc.0 -s -m "pre-release: xxx"
|
||||
git push origin v3.6.0
|
||||
```
|
||||
|
||||
The remaining tasks are handled by automated processes:
|
||||
|
||||
+ Automatically complete the release publication on Github
|
||||
+ Automatically build the `v3.6.0` version image and push it to aliyun, dockerhub, and github
|
||||
|
||||
Through these automated steps, we achieve rapid and efficient OpenIM version releases, simplifying the release process and enhancing productivity.
|
||||
|
||||
|
||||
Certainly, here is the continuation of the document in English:
|
||||
|
||||
## Local Make Release Design
|
||||
|
||||
There are two primary scenarios for local usage:
|
||||
|
||||
+ Advanced compilation and release, manually executed locally
|
||||
+ Quick compilation verification and version release, manually executed locally
|
||||
|
||||
**These two scenarios can also be combined, for example, by tagging locally and then releasing:**
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -a -s -m "release(v3.6.0): ......"
|
||||
git tag v3.6.0
|
||||
git release
|
||||
git push origin main
|
||||
```
|
||||
|
||||
In a local environment, you can use the `make release` command to complete the release process. The main implementation logic can be found in the `/data/workspaces/open-im-server/scripts/lib/release.sh` file. First, let's explore its usage through the help information.
|
||||
|
||||
### Help Information
|
||||
|
||||
To view the help information, execute the following command:
|
||||
|
||||
```bash
|
||||
$ ./scripts/release.sh --help
|
||||
Usage: release.sh [options]
|
||||
Options:
|
||||
-h, --help Display this help message
|
||||
-se, --setup-env Execute environment setup
|
||||
-vp, --verify-prereqs Execute prerequisite verification
|
||||
-bc, --build-command Execute build command
|
||||
-bi, --build-image Execute build image (default is not executed)
|
||||
-pt, --package-tarballs Execute tarball packaging
|
||||
-ut, --upload-tarballs Execute tarball upload
|
||||
-gr, --github-release Execute GitHub release
|
||||
-gc, --generate-changelog Execute changelog generation
|
||||
```
|
||||
|
||||
### Default Behavior
|
||||
|
||||
If no options are provided, all operations are executed by default:
|
||||
|
||||
```bash
|
||||
# If no options are provided, enable all operations by default
|
||||
if [ "$#" -eq 0 ]; then
|
||||
perform_setup_env=true
|
||||
perform_verify_prereqs=true
|
||||
perform_build_command=true
|
||||
perform_package_tarballs=true
|
||||
perform_upload_tarballs=true
|
||||
perform_github_release=true
|
||||
perform_generate_changelog=true
|
||||
# TODO: Defaultly not enable build_image
|
||||
# perform_build_image=true
|
||||
fi
|
||||
```
|
||||
|
||||
### Environment Variable Setup
|
||||
|
||||
Before starting, you need to set environment variables:
|
||||
|
||||
```bash
|
||||
export TENCENT_SECRET_KEY=OZZ****************************
|
||||
export TENCENT_SECRET_ID=AKI****************************
|
||||
```
|
||||
|
||||
### Modifying COS Account and Password
|
||||
|
||||
If you need to change the COS account, password, and bucket information, please modify the following section in the `/data/workspaces/open-im-server/scripts/lib/release.sh` file:
|
||||
|
||||
```bash
|
||||
readonly BUCKET="openim-1306374445"
|
||||
readonly REGION="ap-guangzhou"
|
||||
readonly COS_RELEASE_DIR="openim-release"
|
||||
```
|
||||
|
||||
### GitHub Release Configuration
|
||||
|
||||
If you intend to use the GitHub Release feature, you also need to set the environment variable:
|
||||
|
||||
```bash
|
||||
export GITHUB_TOKEN="your_github_token"
|
||||
```
|
||||
|
||||
### Modifying GitHub Release Basic Information
|
||||
|
||||
If you need to modify the basic information of GitHub Release, please edit the following section in the `/data/workspaces/open-im-server/scripts/lib/release.sh` file:
|
||||
|
||||
```bash
|
||||
# OpenIM GitHub account information
|
||||
readonly OPENIM_GITHUB_ORG=openimsdk
|
||||
readonly OPENIM_GITHUB_REPO=open-im-server
|
||||
```
|
||||
|
||||
This setup allows you to configure and execute the local release process according to your specific needs.
|
||||
|
||||
|
||||
### GitHub Release Versioning Rules
|
||||
|
||||
Firstly, it's important to note that GitHub Releases should primarily be for pre-release versions. However, goreleaser might provide a `prerelease: auto` option, which automatically marks versions with pre-release indicators like `-rc1`, `-beta`, etc., as pre-releases.
|
||||
|
||||
So, if your most recent tag does not have pre-release indicators such as `-rc1` or `-beta`, even if you use `make release` for pre-release versions, goreleaser might still consider them as formal releases.
|
||||
|
||||
To avoid this issue, I have added the `--draft` flag to github-release. This way, all releases are created as drafts.
|
||||
|
||||
## CICD Release Documentation Design
|
||||
|
||||
The release records still require manual composition for GitHub Release. This is different from github-release.
|
||||
|
||||
This approach ensures that all releases are initially created as drafts, allowing you to manually review and edit the release documentation on GitHub. This manual step provides more control and allows you to curate release notes and other information before making them public.
|
||||
|
||||
|
||||
## Makefile Section
|
||||
|
||||
This document aims to elaborate and explain key sections of the OpenIM Release automation design, including the Makefile section and functions within the code. Below, we will provide a detailed explanation of the logic and functions of each section.
|
||||
|
||||
In the project's root directory, the Makefile imports a subdirectory:
|
||||
|
||||
```makefile
|
||||
include scripts/make-rules/release.mk
|
||||
```
|
||||
|
||||
And defines the `release` target as follows:
|
||||
|
||||
```makefile
|
||||
## release: release the project ✨
|
||||
.PHONY: release release: release.verify release.ensure-tag
|
||||
@scripts/release.sh
|
||||
```
|
||||
|
||||
### Importing Subdirectory
|
||||
|
||||
At the beginning of the Makefile, the `include scripts/make-rules/release.mk` statement imports the `release.mk` file from the subdirectory. This file contains rules and configurations related to releases to be used in subsequent operations.
|
||||
|
||||
### The `release` Target
|
||||
|
||||
The Makefile defines a target named `release`, which is used to execute the project's release operation. This target is marked as a phony target (`.PHONY`), meaning it doesn't represent an actual file or directory but serves as an identifier for executing a series of actions.
|
||||
|
||||
In the `release` target, two dependency targets are executed first: `release.verify` and `release.ensure-tag`. Afterward, the `scripts/release.sh` script is called to perform the actual release operation.
|
||||
|
||||
## Logic of `release.verify` and `release.ensure-tag`
|
||||
|
||||
```makefile
|
||||
## release.verify: Check if a tool is installed and install it
|
||||
.PHONY: release.verify
|
||||
release.verify: tools.verify.git-chglog tools.verify.github-release tools.verify.coscmd tools.verify.coscli
|
||||
|
||||
## release.ensure-tag: ensure tag
|
||||
.PHONY: release.ensure-tag
|
||||
release.ensure-tag: tools.verify.gsemver
|
||||
@scripts/ensure-tag.sh
|
||||
```
|
||||
|
||||
### `release.verify` Target
|
||||
|
||||
The `release.verify` target is used to check and install tools. It depends on four sub-targets: `tools.verify.git-chglog`, `tools.verify.github-release`, `tools.verify.coscmd`, and `tools.verify.coscli`. These sub-targets aim to check if specific tools are installed and attempt to install them if they are not.
|
||||
|
||||
The purpose of this target is to ensure that the necessary tools required for the release process are available so that subsequent operations can be executed smoothly.
|
||||
|
||||
### `release.ensure-tag` Target
|
||||
|
||||
The `release.ensure-tag` target is used to ensure that the project has a version tag. It depends on the sub-target `tools.verify.gsemver`, indicating that it should check if the `gsemver` tool is installed before executing.
|
||||
|
||||
When the `release.ensure-tag` target is executed, it calls the `scripts/ensure-tag.sh` script to ensure that the project has a version tag. Version tags are typically used to identify specific versions of the project for management and release in version control systems.
|
||||
|
||||
## Logic of `release.sh` Script
|
||||
|
||||
```bash
|
||||
openim::golang::setup_env
|
||||
openim::build::verify_prereqs
|
||||
openim::release::verify_prereqs
|
||||
#openim::build::build_image
|
||||
openim::build::build_command
|
||||
openim::release::package_tarballs
|
||||
openim::release::upload_tarballs
|
||||
git push origin ${VERSION}
|
||||
#openim::release::github_release
|
||||
#openim::release::generate_changelog
|
||||
```
|
||||
|
||||
The `release.sh` script is responsible for executing the actual release operations. Below is the logic of this script:
|
||||
|
||||
1. `openim::golang::setup_env`: This function sets up some configurations for the Golang development environment.
|
||||
|
||||
2. `openim::build::verify_prereqs`: This function is used to verify whether the prerequisites for building are met. This includes checking dependencies, environment variables, and more.
|
||||
|
||||
3. `openim::release::verify_prereqs`: Similar to the previous function, this one is used to verify whether the prerequisites for the release are met. It focuses on conditions relevant to the release.
|
||||
|
||||
4. `openim::build::build_command`: This function is responsible for building the project's command, which typically involves compiling the project or performing other build operations.
|
||||
|
||||
5. `openim::release::package_tarballs`: This function is used to package tarball files required for the release. These tarballs are usually used for distribution packages during the release.
|
||||
|
||||
6. `openim::release::upload_tarballs`: This function is used to upload the packaged tarball files, typically to a distribution platform or repository.
|
||||
|
||||
7. `git push origin ${VERSION}`: This line of command pushes the version tag to the remote Git repository's `origin` branch, marking this release in the version control system.
|
||||
|
||||
In the comments, you can see that there are some operations that are commented out, such as `openim::build::build_image`, `openim::release::github_release`, and `openim::release::generate_changelog`. These operations are related to building images, releasing to GitHub, and generating changelogs, and they can be enabled in the release process as needed.
|
||||
|
||||
Let's take a closer look at the function responsible for packaging the tarball files:
|
||||
|
||||
```bash
|
||||
function openim::release::package_tarballs() {
|
||||
# Clean out any old releases
|
||||
rm -rf "${RELEASE_STAGE}" "${RELEASE_TARS}" "${RELEASE_IMAGES}"
|
||||
mkdir -p "${RELEASE_TARS}"
|
||||
openim::release::package_src_tarball &
|
||||
openim::release::package_client_tarballs &
|
||||
openim::release::package_openim_manifests_tarball &
|
||||
openim::release::package_server_tarballs &
|
||||
openim::util::wait-for-jobs || { openim::log::error "previous tarball phase failed"; return 1; }
|
||||
|
||||
openim::release::package_final_tarball & # _final depends on some of the previous phases
|
||||
openim::util::wait-for-jobs || { openim::log::error "previous tarball phase failed"; return 1; }
|
||||
}
|
||||
```
|
||||
|
||||
The `openim::release::package_tarballs()` function is responsible for packaging the tarball files required for the release. Here is the specific logic of this function:
|
||||
|
||||
1. `rm -rf "${RELEASE_STAGE}" "${RELEASE_TARS}" "${RELEASE_IMAGES}"`: First, the function removes any old release directories and files to ensure a clean starting state.
|
||||
|
||||
2. `mkdir -p "${RELEASE_TARS}"`: Next, it creates a directory `${RELEASE_TARS}` to store the packaged tarball files. If the directory doesn't exist, it will be created.
|
||||
|
||||
3. `openim::release::package_final_tarball &`: This is an asynchronous operation that depends on some of the previous phases. It is likely used to package the final tarball file, which includes the contents of all previous asynchronous operations.
|
||||
|
||||
4. `openim::util::wait-for-jobs`: It waits for all asynchronous operations to complete. If any of the previous asynchronous operations fail, an error will be returned.
|
||||
+1
-24
@@ -1,7 +1,6 @@
|
||||
# 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)
|
||||
@@ -9,21 +8,8 @@
|
||||
- [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/).
|
||||
@@ -96,6 +82,7 @@ We reinforce our approach to branch management and versioning with stringent tes
|
||||
|
||||
This document describes the maximum version skew supported between various openim components. Specific cluster deployment tools may place additional restrictions on version skew.
|
||||
|
||||
|
||||
### Supported version skew
|
||||
|
||||
In highly-available (HA) clusters, the newest and oldest `openim-api` instances must be within one minor version.
|
||||
@@ -209,7 +196,6 @@ git merge release-v3.1
|
||||
# Push the updates to the main branch
|
||||
git push origin main
|
||||
```
|
||||
|
||||
## Release Process
|
||||
|
||||
```
|
||||
@@ -227,12 +213,3 @@ 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:
|
||||
|
||||
About Helm's version management strategy for Multiple Apps and multiple Services:
|
||||
|
||||
+ [中文版本管理文档](https://github.com/openimsdk/helm-charts/blob/main/docs/contrib/version-zh.md)
|
||||
+ [English version management documents](https://github.com/openimsdk/helm-charts/blob/main/docs/contrib/version.md)
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# How do I contribute code to OpenIM
|
||||
|
||||
<p align="center">
|
||||
<a href="./CONTRIBUTING.md">Englist</a> ·
|
||||
<a href="./CONTRIBUTING-zh_CN.md">中文</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-UA.md">Українська</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-CS.md">Česky</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-HU.md">Magyar</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ES.md">Español</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FA.md">فارسی</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FR.md">Français</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-DE.md">Deutsch</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-PL.md">Polski</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ID.md">Indonesian</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FI.md">Suomi</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ML.md">മലയാളം</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-JP.md">日本語</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-NL.md">Nederlands</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-IT.md">Italiano</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-RU.md">Русский</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-PTBR.md">Português (Brasil)</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-EO.md">Esperanto</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-KR.md">한국어</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-AR.md">العربي</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-VN.md">Tiếng Việt</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-DA.md">Dansk</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-GR.md">Ελληνικά</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-TR.md">Türkçe</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</p>
|
||||
@@ -1,33 +0,0 @@
|
||||
# How do I contribute code to OpenIM
|
||||
|
||||
<p align="center">
|
||||
<a href="./CONTRIBUTING.md">Englist</a> ·
|
||||
<a href="./CONTRIBUTING-zh_CN.md">中文</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-UA.md">Українська</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-CS.md">Česky</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-HU.md">Magyar</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ES.md">Español</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FA.md">فارسی</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FR.md">Français</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-DE.md">Deutsch</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-PL.md">Polski</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ID.md">Indonesian</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-FI.md">Suomi</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-ML.md">മലയാളം</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-JP.md">日本語</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-NL.md">Nederlands</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-IT.md">Italiano</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-RU.md">Русский</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-PTBR.md">Português (Brasil)</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-EO.md">Esperanto</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-KR.md">한국어</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-AR.md">العربي</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-VN.md">Tiếng Việt</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-DA.md">Dansk</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-GR.md">Ελληνικά</a> ·
|
||||
<a href="docs/contributing/CONTRIBUTING-TR.md">Türkçe</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</p>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user