Merge branch 'main' into main

pull/2183/head
skiffer-git 7 months ago committed by GitHub
commit 6a721f2eab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,9 +5,8 @@
.git
# Ignore build artifacts
_output/
logs/
_output/
# Ignore non-essential documentation
README.md
README-zh_CN.md
@ -18,8 +17,6 @@ CHANGELOG/
# Ignore testing and linting configuration
.golangci.yml
# Ignore deployment-related files
docker-compose.yaml
# Ignore assets
assets/

13
.env

@ -0,0 +1,13 @@
MONGO_IMAGE=mongo:6.0.2
REDIS_IMAGE=redis:7.0.0
ZOOKEEPER_IMAGE=bitnami/zookeeper:3.8
KAFKA_IMAGE=bitnami/kafka:3.5.1
MINIO_IMAGE=minio/minio:RELEASE.2024-01-11T07-46-16Z
OPENIM_WEB_FRONT_IMAGE=openim/openim-web-front:release-v3.5.1
OPENIM_ADMIN_FRONT_IMAGE=openim/openim-admin-front:release-v1.7
DATA_DIR=./

1
.gitattributes vendored

@ -0,0 +1 @@
*.sh text eol=lf

@ -73,14 +73,20 @@ jobs:
- name: Docker Operations
run: |
sudo make init
sudo docker compose up -d
sudo bash bootstrap.sh
sudo mage
sudo sleep 20
- name: Module Operations
run: |
sudo make tidy
sudo make tools.verify.go-gitlint
echo "===========> Verifying go-gitlint is installed"
if [ ! -f ./_output/tools/go-gitlint ]; then
export GOBIN=$(pwd)/_output/tools
echo "===========> Installing The default installation path is /home/ubuntu/DF/open-im-server/_output/tools/go-gitlint"
sudo go install github.com/marmotedu/go-gitlint/cmd/go-gitlint@latest
echo "===========> go-gitlint is installed in /home/ubuntu/DF/open-im-server/_output/tools/go-gitlint"
fi
- name: Build, Start(make build && make start)
run: |
@ -90,7 +96,8 @@ jobs:
run: |
sudo ./scripts/install/install.sh -s
- name: Exec OpenIM API test (make test-api)
# - name: Exec OpenIM API test (make test-api)
- name: Exec OpenIM test (make test)
run: |
mkdir -p ./tmp
touch ./tmp/test.md
@ -98,23 +105,27 @@ jobs:
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 "===========> Run api test"
./scripts/install/test.sh
echo "===========> Run api test" >> ./tmp/test.md
./scripts/install/test.sh >> ./tmp/test.md
echo "</code></pre>" >> ./tmp/test.md
echo "</details>" >> ./tmp/test.md
sudo make test-api
echo "===========> Run api test"
./scripts/install/test.sh
- name: Exec OpenIM E2E Test (make test-e2e)
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
# - name: Exec OpenIM E2E Test (make test-e2e)
# 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
# sudo make test-e2e
- name: Comment PR with file
uses: thollander/actions-comment-pull-request@v2

@ -29,7 +29,13 @@ jobs:
go-version: '1.21'
cache: false
- name: OpenIM Scripts Verification(make verify)
run: sudo make verify
run: |
cd scripts
for script in verify-*; do
if [ -x "$script" ]; then
./"$script"
fi
done
- name: golangci-lint
uses: golangci/golangci-lint-action@v4.0.0
with:

@ -1,3 +1,4 @@
# Copyright © 2023 OpenIM open source community. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -11,8 +12,7 @@
# 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: OpenIM CI Aotu Build and Install
name: OpenIM CI Auto Build
on:
push:
@ -36,270 +36,156 @@ on:
- "CONTRIBUTING/**"
- "**.md"
- "docs/**"
env:
GO_VERSION: "1.19"
GOLANGCI_VERSION: "v1.50.1"
workflow_dispatch:
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
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Install Task
uses: arduino/setup-task@v1
with:
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: Conformity Checker for Project
uses: kubecub/standardizer@main
- name: Module Operations
run: |
sudo make tidy
sudo make tools.verify.go-gitlint
- name: Format Code
run: sudo make format
continue-on-error: true
- name: Generate Files
run: make gen
continue-on-error: true
- 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: Set Current Directory
id: set_directory
run: echo "::set-output name=directory::$(pwd)"
continue-on-error: true
- name: Collect and Display Test Coverage
id: collect_coverage
run: |
cd ${{ steps.set_directory.outputs.directory }}
make cover
echo "::set-output name=coverage_file::./_output/tmp/coverage.out"
echo "Test Coverage:"
cat ${{ steps.collect_coverage.outputs.coverage_file }}
continue-on-error: true
openim-start:
name: Test OpenIM install/start on ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
pull-requests: write
environment:
name: openim
strategy:
matrix:
go_version: ["1.21"]
os: ["ubuntu-latest"]
steps:
- name: Checkout and Install OpenIM
uses: actions/checkout@v4
- name: Install Task
uses: arduino/setup-task@v1
with:
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run OpenIM make install start
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 }}
runs-on: ${{ matrix.os }}
build-linux:
name: Execute OpenIM Script On Linux
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
contents: write
pull-requests: write
environment:
name: openim
strategy:
matrix:
go_version: ["1.21"]
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
with:
go-version: ${{ matrix.go_version }}
id: go
- uses: actions/checkout@v3
- name: Install Task
uses: arduino/setup-task@v1
- name: Set up Go
uses: actions/setup-go@v4
with:
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Install latest Bash (macOS only)
# if: runner.os == 'macOS' && matrix.arch == 'arm64'
# run: |
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# brew update
# brew install bash
# brew install gnu-sed
# echo "/usr/local/bin" >> $GITHUB_PATH
# echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
# continue-on-error: true
go-version: '1.21'
- name: Set up Docker for Ubuntu
if: runner.os == 'Linux'
- name: Set up Docker for Linux
run: |
sudo make init
sudo docker compose up -d
sudo sleep 20
# - name: Set up Docker for macOS
# if: runner.os == 'macOS' && matrix.arch == 'arm64'
# run: |
# brew install --cask docker
# open /Applications/Docker.app
# sleep 10
# docker-compose --version || brew install docker-compose
sudo sleep 30 # Increased sleep time for better stability
timeout-minutes: 20 # Increased timeout for Docker setup
# docker-compose up -d
# sleep 20
- name: Module Operations for Ubuntu
if: runner.os == 'Linux'
run: |
sudo make tidy
sudo make tools.verify.go-gitlint
# - name: Module Operations for macOS
# if: runner.os == 'macOS'
# run: |
# make tidy
# make tools.verify.go-gitlint
- name: Build, Start, Check Services and Print Logs for Ubuntu
if: runner.os == 'Linux'
run: |
sudo make build
sudo make start
sudo make check
- name: Restart Services and Print Logs for Ubuntu
if: runner.os == 'Linux' && matrix.arch == 'amd64'
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
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
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Install Task
uses: arduino/setup-task@v1
with:
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: init
run: sudo bash bootstrap.sh
timeout-minutes: 20
- name: Test Docker Build
- name: Build, Start, Check Services and Print Logs for Linux
run: |
sudo make init
sudo make image
sudo mage
sudo mage start
sudo mage check
- name: Get OpenIM Docker Images Status
id: docker_processes
- name: Restart Services and Print Logs
run: |
sudo docker images
sudo docker ps
sudo mage stop
sudo mage start
sudo mage check
# build-mac:
# name: Execute OpenIM Script On macOS
# runs-on: macos-latest
# permissions:
# contents: write
# pull-requests: write
# environment:
# name: openim
# strategy:
# matrix:
# arch: [arm64, armv7, amd64]
#
# steps:
# - uses: actions/checkout@v3
# - name: Set up Go
# uses: actions/setup-go@v4
# with:
# go-version: '1.21'
# while ! docker system info > /dev/null 2>&1; do
# echo "Waiting for Docker to start..."
# sleep 10 # Increased delay to ensure Docker starts properly
# done
# - name: Install Docker
# run: |
# brew install docker
# brew install docker-compose
# sleep 10
# docker-compose up -d
# sleep 30
# timeout-minutes: 20
#
# - name: init
# run: sudo bash bootstrap.sh
# timeout-minutes: 20
# - name: Build, Start, Check Services and Print Logs for Linux
# run: |
# sudo mage
# sudo mage start
# sudo mage check
# - name: Restart Services and Print Logs
# run: |
# sudo mage stop
# sudo mage start
# sudo mage check
# build-windows:
# name: Execute OpenIM Script On Windows
# runs-on: windows-latest
# permissions:
# contents: write
# pull-requests: write
# environment:
# name: openim
# strategy:
# matrix:
# arch: [arm64, armv7, amd64]
#
# steps:
# - uses: actions/checkout@v3
# - name: Set up Go
# uses: actions/setup-go@v4
# with:
# go-version: '1.21'
# - name: Set up Docker for Windows
# run: |
# $images = @("zookeeper", "redis", "kafka")
# foreach ($image in $images) {
# $tag = "$image:latest"
# docker pull $tag | Out-Null
# if ($LASTEXITCODE -ne 0) {
# Write-Host "Skipping $image as it is not available for Windows"
# } else {
# Write-Host "Successfully pulled $image"
# }
# }
# docker compose up -d
# Start-Sleep -Seconds 30
# timeout-minutes: 20
# shell: pwsh
# - name: init
# run: bootstrap.bat
# timeout-minutes: 20
# - name: Build, Start, Check Services and Print Logs for Linux
# run: |
# mage
# mage start
# mage check
# - name: Restart Services and Print Logs
# run: |
# mage stop
# mage start
# mage check

@ -56,7 +56,8 @@ jobs:
- name: Generate all necessary files, such as error code files
run: |
make generate
make gen.docgo.doc
make gen
echo "Generate all necessary files successfully"
continue-on-error: true
@ -68,9 +69,9 @@ jobs:
echo "Generate all necessary files successfully"
continue-on-error: true
- name: Generate Vertions
- name: Generate Versions Including Pre-release Identifiers
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo $latest_tag > pkg/common/config/version
continue-on-error: true

1
.gitignore vendored

@ -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

@ -39,19 +39,19 @@ run:
# from this option's value (see skip-dirs-use-default).
# "/" 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
# 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$
skip-dirs-use-default: true
# skip-dirs-use-default: true
# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
@ -59,15 +59,15 @@ run:
# autogenerated files. If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-files:
- ".*\\.my\\.go$"
- _test.go
- ".*_test.go"
- "mocks/"
- ".github/"
- "logs/"
- "_output/"
- "components/"
# 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
@ -87,7 +87,7 @@ run:
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
# format: colored-line-number
# print lines of code with issue, default is true
print-issued-lines: true
@ -118,8 +118,7 @@ linters-settings:
right-to-left-isolate: true
first-strong-isolate: true
pop-directional-isolate: true
# checks assignments with too many blank identifiers; default is 2
max-blank-identifiers: 2
dupl:
# tokens count to trigger issue, 150 by default
threshold: 200
@ -151,6 +150,11 @@ linters-settings:
comparison: true
exhaustive:
# Program elements to check for exhaustiveness.
# Default: [ switch ]
check:
- switch
- map
# check switch statements in generated files also
check-generated: false
# indicates that switch statements are to be considered exhaustive if a
@ -162,33 +166,34 @@ linters-settings:
ignore-enum-members: ""
# consider enums only in package scopes, not in inner scopes
package-scope-only: false
exhaustivestruct:
struct-patterns:
- '*.Test'
- '*.Test2'
- '*.Embedded'
- '*.External'
# forbidigo:
forbidigo:
# # Forbid the following identifiers (identifiers are written using regexp):
# forbid:
# - ^print.*$
# - 'fmt\.Print.*'
# - fmt.Println.* # too much log noise
forbid:
# - ^print.*$
- 'fmt\.Print.*'
- fmt.Println.* # too much log noise
- ^unsafe\..*$
- ^init$
- ^os.Exit$
- ^fmt.Print.*$
- errors.New.*$
- ^fmt.Println.*$
- ^panic$
- painc
# - ginkgo\\.F.* # these are used just for local development
# # Exclude godoc examples from forbidigo checks. Default is true.
# exclude_godoc_examples: false
funlen:
lines: 150
lines: 220
statements: 80
gci:
# put imports beginning with prefix after 3rd-party packages;
# only support one prefix
# if not set, use goimports.local-prefixes
prefix: github.com/openimsdk/open-im-server
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 30
goconst:
# minimal length of string constant, 3 by default
min-len: 3
@ -214,9 +219,6 @@ linters-settings:
# By default list of stable checks is used.
enabled-checks:
#- rangeValCopy
- nestingreduce
- truncatecmp
- unnamedresult
- ruleguard
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
@ -245,9 +247,6 @@ linters-settings:
hugeParam:
# size in bytes that makes the warning trigger (default 80)
sizeThreshold: 80
nestingReduce:
# min number of statements inside a branch to trigger a warning (default 5)
bodyWidth: 5
rangeExprCopy:
# size in bytes that makes the warning trigger (default 512)
sizeThreshold: 512
@ -261,15 +260,10 @@ linters-settings:
ruleguard:
# path to a gorules file for the ruleguard checker
rules: ''
truncateCmp:
# whether to skip int/uint/uintptr types (default true)
skipArchDependent: true
underef:
# whether to skip (*x).method() calls where x is a pointer receiver (default true)
skipRecvDeref: true
unnamedResult:
# whether to check exported functions
checkExported: true
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 30
@ -286,9 +280,12 @@ linters-settings:
# list of regexps for excluding particular comment lines from check
exclude:
# example: exclude comments which contain numbers
# - '[0-9]+'
- '[0-9]+'
- 'func\s+\w+'
- 'FIXME:'
- '.*func.*'
# check that each sentence starts with a capital letter
capital: false
capital: true
godox:
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
# might be left in the code accidentally and should be resolved before merging
@ -311,15 +308,15 @@ linters-settings:
# by default
extra-rules: false
goheader:
values:
const:
# goheader:
# values:
# const:
# define here const type values in format k:v, for example:
# COMPANY: MY COMPANY
regexp:
# regexp:
# define here regexp type values, for example
# AUTHOR: .*@mycompany\.com
template: # |-
# template: # |-
# put here copyright header template for source code files, for example:
# Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
#
@ -337,21 +334,45 @@ linters-settings:
# 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.
template-path:
# template-path:
# also as alternative of directive 'template' you may put the path to file with the template source
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/openimsdk/open-im-server
gomnd:
settings:
mnd:
# the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
checks: argument,case,condition,operation,return,assign
# ignored-numbers: 1000
# ignored-files: magic_.*.go
# ignored-functions: math.*
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
# Default: ["argument", "case", "condition", "operation", "return", "assign"]
checks:
- argument
- case
- condition
- operation
- return
- assign
# List of numbers to exclude from analysis.
# The numbers should be written as string.
# Values always ignored: "1", "1.0", "0" and "0.0"
# Default: []
ignored-numbers:
- '0666'
- '0755'
- '42'
# List of file patterns to exclude from analysis.
# Values always ignored: `.+_test.go`
# Default: []
ignored-files:
- 'magic1_.+\.go$'
# List of function patterns to exclude from analysis.
# Following functions are always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions:
- '^math\.'
- '^webhook\.StatusText$'
gomoddirectives:
# Allow local `replace` directives. Default is false.
replace-local: true
@ -363,6 +384,7 @@ linters-settings:
retract-allow-no-explanation: false
# Forbid the use of the `exclude` directives. Default is false.
exclude-forbidden: false
gomodguard:
allowed:
modules:
@ -426,9 +448,6 @@ linters-settings:
checks: [ "all" ]
govet:
# report about shadowed variables
check-shadowing: false
# settings per analyzer
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
@ -445,15 +464,25 @@ linters-settings:
disable:
- shadow
disable-all: false
# depguard:
# list-type: blacklist
# include-go-root: false
# packages:
# - github.com/Sirupsen/logrus
# packages-with-error-message:
# # specify an error message to output when a blacklisted package is used
# - github.com/Sirupsen/logrus: "logging is allowed only by logutils.Log"
depguard:
rules:
prevent_unmaintained_packages:
list-mode: lax # allow unless explicitely denied
files:
- $all
- "!$test"
allow:
- $gostd
deny:
- pkg: io/ioutil
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
- pkg: github.com/OpenIMSDK
desc: "The OpenIM organization has been replaced with lowercase, please do not use uppercase organization name, you will use openimsdk"
- pkg: log
desc: "We have a wrapped log package at openim, we recommend you to use our wrapped log package, https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/logging.md"
- pkg: errors
desc: "We have a wrapped errors package at openim, we recommend you to use our wrapped errors package, https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/error-code.md"
importas:
# if set to `true`, force to use alias.
@ -463,6 +492,8 @@ linters-settings:
# using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package
- pkg: knative.dev/serving/pkg/apis/serving/v1
alias: servingv1
- pkg: gopkg.in/yaml.v2
alias: yaml
# using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package
- pkg: knative.dev/serving/pkg/apis/autoscaling/v1alpha1
alias: autoscalingv1alpha1
@ -471,8 +502,6 @@ linters-settings:
# see https://github.com/julz/importas#use-regular-expression for details
- pkg: knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+)
alias: $1$2
# using `jwt` alias for `github.com/appleboy/gin-jwt/v2` package
jwt: github.com/appleboy/gin-jwt/v2
ireturn:
# ireturn allows using `allow` and `reject` settings at the same time.
@ -503,9 +532,6 @@ linters-settings:
line-length: 250
# tab width in spaces. Default to 1.
tab-width: 4
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
@ -538,8 +564,6 @@ linters-settings:
nolintlint:
# Disable to ensure that all nolint directives actually have an effect. Default is true.
allow-unused: false
# Disable to ensure that nolint directives don't have a leading space. Default is true.
allow-leading-space: true
# Exclude following linters from requiring an explanation. Default is [].
allow-no-explanation: [ ]
# Enable to require an explanation of nonzero length after each nolint directive. Default is false.
@ -563,14 +587,13 @@ linters-settings:
strict: false
# Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
disabled-linters:
# - "Help"
# - "MetricUnits"
# - "Counter"
# - "HistogramSummaryReserved"
# - "MetricTypeInName"
# - "ReservedChars"
# - "CamelCase"
# - "lintUnitAbbreviations"
- "Help"
- "MetricUnits"
- "Counter"
- "HistogramSummaryReserved"
- "MetricTypeInName"
- "ReservedChars"
- "CamelCase"
predeclared:
# comma-separated list of predeclared identifiers to not report on
@ -580,6 +603,7 @@ linters-settings:
rowserrcheck:
packages:
- github.com/jmoiron/sqlx
revive:
# see https://github.com/mgechev/revive#available-rules for details.
ignore-generated-header: true
@ -587,15 +611,27 @@ linters-settings:
rules:
- name: indent-error-flow
severity: warning
- name: exported
severity: warning
- name: var-naming
arguments: [ [ "OpenIM"] ]
# arguments: [ ["ID", "HTTP", "URL", "URI", "API", "APIKey", "Token", "TokenID", "TokenSecret", "TokenKey", "TokenSecret", "JWT", "JWTToken", "JWTTokenID", "JWTTokenSecret", "JWTTokenKey", "JWTTokenSecret", "OAuth", "OAuthToken", "RPC" ] ]
- name: atomic
- name: line-length-limit
severity: error
arguments: [200]
- name: unhandled-error
arguments : ["fmt.Printf", "myFunction"]
staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.16"
go: "1.20"
# https://staticcheck.io/docs/options#checks
checks: [ "all" ]
stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.16"
go: "1.20"
# https://staticcheck.io/docs/options#checks
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
@ -607,7 +643,6 @@ linters-settings:
# https://staticcheck.io/docs/options#http_status_code_whitelist
http-status-code-whitelist: [ "200", "400", "404", "500" ]
tagliatelle:
# check the struck tag name case
case:
@ -653,12 +688,11 @@ linters-settings:
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
unused:
# unused:
# treat code as a program (not a library) and report unused exported identifiers; default is false.
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
whitespace:
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
@ -672,6 +706,7 @@ linters-settings:
- errors.New(
- errors.Unwrap(
- .Wrap(
- .WrapMsg(
- .Wrapf(
- .WithMessage(
- .WithMessagef(
@ -679,6 +714,8 @@ linters-settings:
ignorePackageGlobs:
- encoding/*
- github.com/pkg/*
- github.com/openimsdk/*
- github.com/OpenIMSDK/*
wsl:
# If true append is only allowed to be cuddled if appending value is
@ -705,7 +742,6 @@ linters-settings:
# Allow only slices initialized with a length of zero. Default is false.
always: false
# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
# for more info.
#custom:
@ -731,16 +767,21 @@ linters:
- errcheck
- decorder
- ineffassign
- forbidigo
- revive
- reassign
- tparallel
- unconvert
- fieldalignment
- dupl
- dupword
- errname
- gci
- goheader
- exhaustive
- gocritic
- goprintffuncname
- gomnd
- goconst
- gosec
- misspell # Spelling mistakes
- staticcheck # Static analysis
@ -761,6 +802,7 @@ issues:
exclude:
- tools/.*
- test/.*
- components/*
- third_party/.*
# Excluding configuration per-path, per-linter, per-text and per-source

@ -1,4 +1,4 @@
# How do I contribute code to OpenIM
# 如何给OpenIM贡献代码提交pull request
<p align="center">
<a href="./CONTRIBUTING.md">Englist</a> ·
@ -28,6 +28,55 @@
<a href="docs/contributing/CONTRIBUTING-TR.md">Türkçe</a>
</p>
</div>
</p>
本指南将以 [openimsdk/open-im-server](https://github.com/openimsdk/open-im-server)为例详细说明如何为 OpenIM 项目贡献代码。我们采用“一问题一分支”的策略,确保每个 Issue 都对应一个专门的分支,以便有效管理代码变更。
## 1. Fork 仓库
前往 [openimsdk/open-im-server](https://github.com/openimsdk/open-im-server) GitHub 页面,点击右上角的 "Fork" 按钮,将仓库 Fork 到你的 GitHub 账户下。
## 2. 克隆仓库
将你 Fork 的仓库克隆到本地:
```bash
git clone https://github.com/your-username/open-im-server.git
```
## 3. 设置远程上游
添加原始仓库为远程上游以便跟踪其更新:
```bash
git remote add upstream https://github.com/openimsdk/open-im-server.git
```
## 4. 创建 Issue
在原始仓库中创建一个新的 Issue详细描述你遇到的问题或希望添加的新功能。
## 5. 创建新分支
基于主分支创建一个新分支,并使用描述性的名称与 Issue ID例如
```bash
git checkout -b fix-bug-123
```
## 6. 提交更改
在你的本地分支上进行更改后,提交这些更改:
```bash
git add .
git commit -m "Describe your changes in detail"
```
## 7. 推送分支
将你的分支推送回你的 GitHub Fork
```bash
git push origin fix-bug-123
```
## 8. 创建 Pull Request
在 GitHub 上转到你的 Fork 仓库,点击 "Pull Request" 按钮。确保 PR 描述清楚,并链接到相关的 Issue。
## 9. 签署 CLA
如果这是你第一次提交 PR你需要在 PR 的评论中回复:
```
I have read the CLA Document and I hereby sign the CLA
```
## 其他说明
如果需要将同一修改提交到两个不同的分支(例如 `main``release-v3.7`),应从对应的远程分支分别创建两个新分支。首先在一个分支上完成修改,然后使用 `cherry-pick` 命令将这些更改应用到另一个分支。之后,为每个分支独立提交 Pull Request。

@ -27,475 +27,55 @@
<a href="docs/contributing/CONTRIBUTING-GR.md">Ελληνικά</a> ·
<a href="docs/contributing/CONTRIBUTING-TR.md">Türkçe</a>
</p>
This guide will explain in detail how to contribute code to the OpenIM project, using `openimsdk/open-im-server` as an example. We adopt a "one issue, one branch" strategy to ensure each issue corresponds to a dedicated branch, allowing for effective management of code changes.
</div>
</p>
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.
![Hello OpenIM Image](assets/demo/hello-openim.png)
> Use `make demo` start contributing fast.
This document provides guidelines and best practices to help you contribute effectively.
## 📇Topics
- [How do I contribute code to OpenIM](#how-do-i-contribute-code-to-openim)
- [📇Topics](#topics)
- [What we expect of you](#what-we-expect-of-you)
- [Code of ConductCode of Conduct](#code-of-conductcode-of-conduct)
- [Code and doc contribution](#code-and-doc-contribution)
- [Where should I start?](#where-should-i-start)
- [Design documents](#design-documents)
- [Getting Started](#getting-started)
- [Style and Specification](#style-and-specification)
- [Reporting security issues](#reporting-security-issues)
- [Reporting general issues](#reporting-general-issues)
- [Commit Rules](#commit-rules)
- [PR Description](#pr-description)
- [Docs Contribution](#docs-contribution)
- [Engage to help anything](#engage-to-help-anything)
- [Release version](#release-version)
- [Contact Us](#contact-us)
## What we expect of you
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)
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.
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.
In accordance with the naming conventions adopted by OpenIM and drawing reference from the Google Naming Conventions as per the guidelines available at https://google.github.io/styleguide/go/, the following expectations for naming practices within the project are set forth:
+ https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/code-conventions.md
+ https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/go-code.md
## Code of ConductCode of Conduct
#### 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).
+ If you find a typo, try to fix it!
+ If you find a bug, try to fix it!
+ If you find some redundant codes, try to remove them!
+ If you find some test cases missing, try to add them!
+ If you could enhance a feature, please **DO NOT** hesitate!
+ If you find code implicit, try to add comments to make it clear!
+ If you find code ugly, try to refactor that!
+ If you can help to improve documents, it could not be better!
+ If you find document incorrect, just do it and fix that!
+ ...
#### 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 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.
#### Design documents
For any substantial design, there should be a well-crafted design document. This document is not just a simple record, but also a detailed description and manifestation, which can help team members better understand the design thinking and grasp the design direction. In the process of writing the design document, we can choose to use tools such as `Google Docs` or `Notion`, and even mark RFC in [issues](https://github.com/openimsdk/open-im-server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) or [discussions](https://github.com/openimsdk/open-im-server/discussions) for better collaboration. Of course, after completing the design document, we should also add it to our [Shared Drive](https://drive.google.com/drive/) and notify the appropriate working group to let everyone know of its existence. Only by doing so can we maximize the effectiveness of the design document and provide strong support for the smooth progress of the project.
Anybody can access the shared Drive for reading. To get access to comment. Once you've done that, head to the [shared Drive](https://drive.google.com/) and behold all the docs.
In addition to that, we'd love to invite you to [join our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) where you can play with your imagination, tell us what you're working on, and get a quick response.
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:
+ 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.
+ Include a discussion of the proposed design and technical details of the implementation in the issue.
But keep in mind that there is no guarantee of it being accepted and so it is usually best to get agreement on the idea/design before time is spent coding it. However, sometimes seeing the exact code change can help focus discussions, so the choice is up to you.
## 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:
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.
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:
```bash
git remote add upstream https://github.com/openimsdk/open-im-server.git
git remote set-url --push upstream no-pushing
```
With this remote setting, you can check your git remote configuration like this:
```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)
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`).
```bash
cd open-im-server
git fetch upstream
git checkout upstream/main
```
Create a new branch:
```bash
git checkout -b <new-branch>
```
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
```bash
git rebase upstream/main
make lint # golangci-lint run -c .golangci.yml
git add -A # add changes to staging
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.
```bash
# sync up with upstream
git fetch upstream main
git rebase upstream/main
git rebase -i <commit-id> # rebase with interactive mode to squash your commits into a single one
git push # push to the remote repository, if it's a first time push, run git push --set-upstream origin <new-branch># sync up with upstream
git fetch upstream main
git rebase upstream/main
git rebase -i <commit-id> # rebase with interactive mode to squash your commits into a single one
git push # push to the remote repository, if it's a first time push, run git push --set-upstream origin <new-branch>
```
You can also use `git commit -s --amend && git push -f` to update modifications on the previous commit.
If you have developed multiple features in the same branch, you should create PR separately by rebasing to the main branch between each push:
```bash
# create new branch, for example git checkout -b feature/infra
git checkout -b <new branch>
# update some code, feature1
git add -A
git commit -m -s "feat: feature one"
git push # if it's first time push, run git push --set-upstream origin <new-branch>
# then create pull request, and merge
# update some new feature, feature2, rebase main branch first.
git rebase upstream/main # rebase the current branch to upstream/main branch
git add -A
git commit -m -s "feat: feature two"
```
**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. Heres 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`
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
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.
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).
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.
**There are a lot of cases when you could open an issue:**
+ bug report
+ feature request
+ open-im-server performance issues
+ feature proposal
+ feature design
+ help wanted
+ doc incomplete
+ test improvement
+ 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.
#### Commit Rules
Actually in open-im-server, we take two rules serious when committing:
**🥇 Commit Message:**
Commit message could help reviewers better understand what the purpose of submitted PR is. It could help accelerate the code review procedure as well. We encourage contributors to use **EXPLICIT** commit message rather than ambiguous message. In general, we advocate the following commit message type:
We use [Semantic Commits](https://www.conventionalcommits.org/en/v1.0.0/) to make it easier to understand what a commit does and to build pretty changelogs. Please use the following prefixes for your commits:
+ `docs: xxxx`. For example, "docs: add docs about storage installation".
+ `feature: xxxx`.For example, "feature: make result show in sorted order".
+ `bugfix: xxxx`. For example, "bugfix: fix panic when input nil parameter".
+ `style: xxxx`. For example, "style: format the code style of Constants.java".
+ `refactor: xxxx.` For example, "refactor: simplify to make codes more readable".
+ `test: xxx`. For example, "test: add unit test case for func InsertIntoArray".
+ `chore: xxx.` For example, "chore: integrate travis-ci". It's the type of mantainance change.
+ other readable and explicit expression ways.
On the other side, we discourage contributors from committing message like the following ways:
+ ~~fix bug~~
+ ~~update~~
+ ~~add doc~~
**🥈 Commit Content:**
Commit content represents all content changes included in one commit. We had better include things in one single commit which could support reviewer's complete review without any other commits' help.
In another word, contents in one single commit can pass the CI to avoid code mess. In brief, there are two minor rules for us to keep in mind:
1. avoid very large change in a commit.
2. complete and reviewable for each commit.
3. words are written in lowercase English, not uppercase English or other languages such as Chinese.
No matter what the commit message, or commit content is, we do take more emphasis on code review.
An example for this could be:
### 1. Fork the Repository
Go to the `openimsdk/open-im-server` GitHub page, click the "Fork" button in the upper right corner to fork the repository to your GitHub account.
### 2. Clone the Repository
Clone the forked repository to your local machine:
```bash
git commit -a -s -m "docs: add a new section to the README"
git clone https://github.com/your-username/open-im-server.git
```
#### 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.
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.
**📖 Opening PRs:**
+ As long as you are working on your PR, please mark it as a draft
+ Please make sure that your PR is up-to-date with the latest changes in `main`
+ Mention the issue that your PR is addressing (Fix: #{ID_1}, #{ID_2})
+ Make sure that your PR passes all checks
**🈴 Reviewing PRs:**
+ Be respectful and constructive
+ Assign yourself to the PR (comment `/assign`)
+ Check if all checks are passing
+ Suggest changes instead of simply commenting on found issues
+ If you are unsure about something, ask the author
+ If you are not sure if the changes work, try them out
+ Reach out to other reviewers if you are unsure about something
+ If you are happy with the changes, approve the PR
+ Merge the PR once it has all approvals and the checks are passing
**⚠️ DCO check:**
We have a DCO check that runs on every pull request to ensure code quality and maintainability. This check verifies that the commit has been signed off, indicating that you have read and agreed to the provisions of the Developer Certificate of Origin. If you have not yet signed off on the commit, you can use the following command to sign off on the last commit you made:
### 3. Set Upstream Remote
Add the original repository as a remote upstream to track updates:
```bash
git commit --amend --signoff
git remote add upstream https://github.com/openimsdk/open-im-server.git
```
Please note that signing off on a commit is a commitment that you have read and agreed to the provisions of the Developer Certificate of Origin. If you have not yet read this document, we strongly recommend that you take some time to read it carefully. If you have any questions about the content of this document, or if you need further assistance, please contact an administrator or relevant personnel.
You can also automate signing off your commits by adding the following to your `.zshrc` or `.bashrc`:
### 4. Create an Issue
Create a new issue in the original repository describing the problem you are facing or the new feature you want to add. For significant feature adjustments, propose an RFC issue to facilitate broad discussion and participation from community members.
```go
git() {
if [ $# -gt 0 ] && [[ "$1" == "commit" ]] ; then
shift
command git commit --signoff "$@"
else
command git "$@"
fi
}
### 5. Create a New Branch
Create a new branch based on the main branch and name it descriptively, including the Issue ID, for example:
```bash
git checkout -b fix-bug-123
```
### 6. Commit Changes
After making changes on your local branch, commit them:
```bash
git add .
git commit -m "Describe your changes in detail"
```
#### Docs Contribution
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.
Please obey the following rules to better format the docs, which would greatly improve the reading experience.
1. Please do not use Chinese punctuations in English docs, and vice versa.
2. Please use upper case letters where applicable, like the first letter of sentences / headings, etc.
3. Please specify a language for each Markdown code blocks, unless there's no associated languages.
4. Please insert a whitespace between Chinese and English words.
5. Please use the correct case for technical terms, such as using `HTTP` instead of http, `MySQL` rather than mysql, `Kubernetes` instead of kubernetes, etc.
6. Please check if there's any typos in the docs before submitting PRs.
## 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.
+ 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.
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:
🎯 A PR is merged to the `main` branch:
+ Release please is triggered, creates or updates a new release PR
+ This is done with every merge to main, the current release PR is updated every time
🎯 Merging the 'release please' PR to `main`:
+ Release please is triggered, creates a new release and updates the changelog based on the commit messages
+ GoReleaser is triggered, builds the binaries and attaches them to the release
+ Containers are created and pushed to the container registry
With the next relevant merge, a new release PR will be created and the process starts again
**👀 Manually setting the version:**
If you want to manually set the version, you can create a PR with an empty commit message that contains the version number in the commit message. For example:
Such a commit can get produced as follows:
````bash
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.
### 7. Push the Branch
Push your branch back to your GitHub fork:
```bash
git push origin fix-bug-123
```
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.
### 8. Create a Pull Request
Go to your fork on GitHub, click the "Pull Request" button. Make sure the PR description is clear and links to the related Issue.
#### 🅰 Fixed issue #issueID
In addition to Slack, we also offer the following ways to get in touch:
### 9. Sign the CLA
If this is your first time submitting a PR, you need to reply in the PR comments:
```
I have read the CLA Document and I hereby sign the CLA
```
+ <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.
### Additional Notes
If the same modification needs to be submitted to two different branches (e.g., main and release-v3.7), create two new branches from the corresponding remote branches. First complete the modification in one branch, then use the `cherry-pick` command to apply these changes to the other branch. After that, submit a separate Pull Request for each branch.
Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.

@ -1,31 +1,49 @@
# Build Stage
FROM golang:1.20 AS builder
# Use Go 1.21 Alpine as the base image for building the application
FROM golang:1.21-alpine as builder
# Set go mod installation source and proxy
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
# Define the base directory for the application as an environment variable
ENV SERVER_DIR=/openim-server
ENV GO111MODULE=$GO111MODULE
ENV GOPROXY=$GOPROXY
# Set the working directory inside the container based on the environment variable
WORKDIR $SERVER_DIR
# Set up the working directory
WORKDIR /openim/openim-server
# Set the Go proxy to improve dependency resolution speed
ENV GOPROXY=https://goproxy.io,direct
# Copy all files from the current directory into the container
COPY . .
# Copy all files to the container
ADD . .
RUN go mod download
RUN make clean
RUN make build
# Install Mage to use for building the application
RUN go install github.com/magefile/mage@v1.15.0
FROM ghcr.io/openim-sigs/openim-ubuntu-image:latest
# Optionally build your application if needed
RUN mage build
WORKDIR ${SERVER_WORKDIR}
# Using Alpine Linux with Go environment for the final image
FROM golang:1.21-alpine
# Copy scripts and binary files to the production image
COPY --from=builder ${OPENIM_SERVER_BINDIR} /openim/openim-server/_output/bin
COPY --from=builder ${OPENIM_SERVER_CMDDIR} /openim/openim-server/scripts
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
COPY --from=builder ${SERVER_WORKDIR}/deployments /openim/openim-server/deployments
# Install necessary packages, such as bash
RUN apk add --no-cache bash
CMD ["/openim/openim-server/scripts/docker-start-all.sh"]
# Set the environment and work directory
ENV SERVER_DIR=/openim-server
WORKDIR $SERVER_DIR
# Copy the compiled binaries and mage from the builder image to the final image
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config
COPY --from=builder /go/bin/mage /usr/local/bin/mage
COPY --from=builder $SERVER_DIR/magefile_windows.go $SERVER_DIR/
COPY --from=builder $SERVER_DIR/magefile_unix.go $SERVER_DIR/
COPY --from=builder $SERVER_DIR/magefile.go $SERVER_DIR/
COPY --from=builder $SERVER_DIR/start-config.yml $SERVER_DIR/
COPY --from=builder $SERVER_DIR/go.mod $SERVER_DIR/
COPY --from=builder $SERVER_DIR/go.sum $SERVER_DIR/
RUN go get github.com/openimsdk/gomake@v0.0.9
# Set the command to run when the container starts
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]

@ -1,256 +0,0 @@
# ==============================================================================
# define the default goal
#
.DEFAULT_GOAL := help
## all: Run tidy, gen, add-copyright, format, lint, cover, build ✨
.PHONY: all
all: tidy gen add-copyright verify test-api lint cover restart
# ==============================================================================
# Build set
ROOT_PACKAGE=github.com/openimsdk/open-im-server
# TODO: This is version control for the future https://github.com/openimsdk/open-im-server/issues/574
VERSION_PACKAGE=github.com/openimsdk/open-im-server/v3/pkg/version
# ==============================================================================
# Includes
include scripts/make-rules/common.mk # make sure include common.mk at the first include line
include scripts/make-rules/common-versions.mk
include scripts/make-rules/golang.mk
include scripts/make-rules/image.mk
include scripts/make-rules/copyright.mk
include scripts/make-rules/gen.mk
include scripts/make-rules/dependencies.mk
include scripts/make-rules/tools.mk
include scripts/make-rules/release.mk
include scripts/make-rules/swagger.mk
# ==============================================================================
# Usage
define USAGE_OPTIONS
Options:
DEBUG Whether or not to generate debug symbols. Default is 0.
BINS Binaries to build. Default is all binaries under cmd.
This option is available when using: make {build}(.multiarch)
Example: make build BINS="openim-api openim-cmdutils".
PLATFORMS Platform to build for. Default is linux_arm64 and linux_amd64.
This option is available when using: make {build}.multiarch
Example: make multiarch PLATFORMS="linux_s390x linux_mips64
linux_mips64le darwin_amd64 windows_amd64 linux_amd64 linux_arm64".
V Set to 1 enable verbose build. Default is 0.
endef
export USAGE_OPTIONS
# ==============================================================================
# Targets
## init: Initialize openim server project ✨
.PHONY: init
init:
@$(MAKE) gen.init
## init-githooks: Initialize git hooks ✨
.PHONY: init-githooks
init-githooks:
@$(MAKE) gen.init-githooks
## gen: Generate all necessary files. ✨
.PHONY: gen
gen:
@$(MAKE) gen.run
## demo: Run demo get started with Makefiles quickly ✨
.PHONY: demo
demo:
@$(MAKE) go.demo
## version: Check version of openim. ✨
.PHONY: version
version:
@$(MAKE) go.versionchecker
## build: Build binaries by default ✨
.PHONY: build
build:
@$(MAKE) go.build
## start: Start openim ✨
.PHONY: start
start:
@$(MAKE) go.start
## stop: Stop openim ✨
.PHONY: stop
stop:
@$(MAKE) go.stop
## restart: Restart openim (make init configuration file is initialized) ✨
.PHONY: restart
restart: clean stop build start check
## multiarch: Build binaries for multiple platforms. See option PLATFORMS. ✨
.PHONY: multiarch
multiarch:
@$(MAKE) go.build.multiarch
## verify: execute all verity scripts. ✨
.PHONY: verify
verify:
@$(MAKE) go.verify
## install: Install deployment openim ✨
.PHONY: install
install:
@$(MAKE) go.install
## check: Check OpenIM deployment ✨
.PHONY: check
check:
@$(MAKE) go.check
## check-component: Check OpenIM component deployment ✨
.PHONY: check-component
check-component:
@$(MAKE) go.check-component
## tidy: tidy go.mod ✨
.PHONY: tidy
tidy:
@$(GO) mod tidy
## vendor: vendor go.mod ✨
.PHONY: vendor
vendor:
@$(GO) mod vendor
## style: code style -> fmt,vet,lint ✨
.PHONY: style
style: fmt vet lint
## fmt: Run go fmt against code. ✨
.PHONY: fmt
fmt:
@$(GO) fmt ./...
## vet: Run go vet against code. ✨
.PHONY: vet
vet:
@$(GO) vet ./...
## lint: Check syntax and styling of go sources. ✨
.PHONY: lint
lint:
@$(MAKE) go.lint
## format: Gofmt (reformat) package sources (exclude vendor dir if existed). ✨
.PHONY: format
format:
@$(MAKE) go.format
## test: Run unit test. ✨
.PHONY: test
test:
@$(MAKE) go.test
## cover: Run unit test and get test coverage. ✨
.PHONY: cover
cover:
@$(MAKE) go.test.cover
## test-api: Run api test. ✨
.PHONY: test-api
test-api:
@$(MAKE) go.test.api
## test-e2e: Run e2e test
test-e2e:
@$(MAKE) go.test.e2e
## updates: Check for updates to go.mod dependencies. ✨
.PHONY: updates
@$(MAKE) go.updates
## imports: task to automatically handle import packages in Go files using goimports tool. ✨
.PHONY: imports
imports:
@$(MAKE) go.imports
## clean: Delete all files created by the build, as well as all log files. ✨
.PHONY: clean
clean:
@$(MAKE) go.clean
## image: Build docker images for host arch. ✨
.PHONY: image
image:
@$(MAKE) image.build
## image.multiarch: Build docker images for multiple platforms. See option PLATFORMS. ✨
.PHONY: image.multiarch
image.multiarch:
@$(MAKE) image.build.multiarch
## push: Build docker images for host arch and push images to registry. ✨
.PHONY: push
push:
@$(MAKE) image.push
## push.multiarch: Build docker images for multiple platforms and push images to registry. ✨
.PHONY: push.multiarch
push.multiarch:
@$(MAKE) image.push.multiarch
## tools: Install dependent tools. ✨
.PHONY: tools
tools:
@$(MAKE) tools.install
## swagger: Generate swagger document. ✨
.PHONY: swagger
swagger:
@$(MAKE) swagger.run
## serve-swagger: Serve swagger spec and docs. ✨
.PHONY: swagger.serve
serve-swagger:
@$(MAKE) swagger.serve
## verify-copyright: Verify the license headers for all files. ✨
.PHONY: verify-copyright
verify-copyright:
@$(MAKE) copyright.verify
## add-copyright: Add copyright ensure source code files have license headers. ✨
.PHONY: add-copyright
add-copyright:
@$(MAKE) copyright.add
## advertise: Project introduction, become a contributor ✨
.PHONY: advertise
advertise:
@$(MAKE) copyright.advertise
## release: release the project ✨
.PHONY: release
release: release.verify release.ensure-tag
@scripts/release.sh
## help: Show this help info. ✨
.PHONY: help
help: Makefile
$(call makehelp)
## help-all: Show all help details info. ✨
.PHONY: help-all
help-all: go.help copyright.help tools.help image.help dependencies.help gen.help release.help swagger.help help
$(call makeallhelp)

@ -51,137 +51,89 @@
</p>
## :busts_in_silhouette: Community
## :busts_in_silhouette: Join Our 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)
+ 💬 [Follow us on Twitter](https://twitter.com/founder_im63606)
+ 🚀 [Join our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-2hljfom5u-9ZuzP3NfEKW~BJKbpLm0Hw)
+ :eyes: [Join our WeChat Group](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
## Ⓜ️ 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.
Unlike standalone chat applications such as Telegram, Signal, and Rocket.Chat, OpenIM offers an open-source instant messaging solution designed specifically for developers rather than as a directly installable standalone chat app. Comprising OpenIM SDK and OpenIM Server, it provides developers with a complete set of tools and services to integrate instant messaging functions into their applications, including message sending and receiving, user management, and group management. Overall, OpenIM aims to provide developers with the necessary tools and framework to implement efficient instant messaging solutions in their applications.
![App-OpenIM Relationship](./docs/images/oepnim-design.png)
## 🚀 About OpenIMSDK
## 🚀 Introduction to 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**, designed for **OpenIMServer**, is an IM SDK created specifically for integration into client applications. It supports various functionalities and modules:
+ 🌟 Main Features:
- 📦 Local storage
- 🔔 Listener callbacks
- 🛡️ API wrapping
- 🌐 Connection management
- 📦 Local Storage
- 🔔 Listener Callbacks
- 🛡️ API Wrapping
- 🌐 Connection Management
+ 📚 Main Modules:
1. 🚀 Initialization and Login
2. 👤 User Management
3. 👫 Friend Management
3. 👫 Friends 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.
👉 **[Explore GO SDK](https://github.com/openimsdk/openim-sdk-core)**
## 🌐 About OpenIMServer
5. 💬 Session Handling
+ **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.
Built with Golang and supports cross-platform deployment to ensure a consistent integration experience across all platforms.
### Enhanced Business Functionality:
👉 **[Explore the GO SDK](https://github.com/openimsdk/openim-sdk-core)**
+ **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.
## 🌐 Introduction to OpenIMServer
👉 **[Learn more](https://docs.openim.io/guides/introduction/product)**
+ **OpenIMServer** features include:
- 🌐 Microservices Architecture: Supports cluster mode, including a gateway and multiple rpc services.
- 🚀 Diverse Deployment Options: Supports source code, Kubernetes, or Docker deployment.
- Massive User Support: Supports large-scale groups with hundreds of thousands, millions of users, and billions of messages.
## :building_construction: Overall Architecture
### Enhanced Business Functions:
Delve into the heart of Open-IM-Server's functionality with our architecture diagram.
+ **REST API**: Provides a REST API for business systems to enhance functionality, such as group creation and message pushing through backend interfaces.
![Overall Architecture](./docs/images/architecture-layers.png)
+ **Webhooks**: Expands business forms through callbacks, sending requests to business servers before or after certain events.
![Overall Architecture](./docs/images/architecture-layers.png)
## :rocket: Quick Start
We support many platforms. Here are the addresses for quick experience on the web side
Experience online for iOS/Android/H5/PC/Web:
👉 **[OpenIM online web demo](https://web-enterprise.rentsoft.cn/)**
👉 **[OpenIM Online Demo](https://www.openim.io/en/commercial)**
🤲 To facilitate user experience, we offer various deployment solutions. You can choose your deployment method from the list below:
To facilitate user experience, we offer various deployment solutions. You can choose your preferred 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
[![Open in Dev Container](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/github/openimsdk/open-im-server)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](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).
## System Support
Before you start, please make sure your changes are in demand. The best for that is to create a [new discussion](https://github.com/openimsdk/open-im-server/discussions/new/choose) OR [Slack Communication](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q), or if you find an issue, [report it](https://github.com/openimsdk/open-im-server/issues/new/choose) first.
Supports Linux, Windows, Mac systems, and ARM and AMD CPU architectures.
- [OpenIM API Reference](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/api.md)
- [OpenIM Bash Logging](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/bash-log.md)
- [OpenIM CI/CD Actions](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/cicd-actions.md)
- [OpenIM Code Conventions](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/code-conventions.md)
- [OpenIM Commit Guidelines](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/commit.md)
- [OpenIM Development Guide](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/development.md)
- [OpenIM Directory Structure](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/directory.md)
- [OpenIM Environment Setup](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/environment.md)
- [OpenIM Error Code Reference](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/error-code.md)
- [OpenIM Git Workflow](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/git-workflow.md)
- [OpenIM Git Cherry Pick Guide](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/gitcherry-pick.md)
- [OpenIM GitHub Workflow](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/github-workflow.md)
- [OpenIM Go Code Standards](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/go-code.md)
- [OpenIM Image Guidelines](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/images.md)
- [OpenIM Initial Configuration](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/init-config.md)
- [OpenIM Docker Installation Guide](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/install-docker.md)
- [OpenIM OpenIM Linux System Installation](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/install-openim-linux-system.md)
- [OpenIM Linux Development Guide](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/linux-development.md)
- [OpenIM Local Actions Guide](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/local-actions.md)
- [OpenIM Logging Conventions](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/logging.md)
- [OpenIM Offline Deployment](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/offline-deployment.md)
- [OpenIM Protoc Tools](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/protoc-tools.md)
- [OpenIM Testing Guide](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/test.md)
- [OpenIM Utility Go](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/util-go.md)
- [OpenIM Makefile Utilities](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/util-makefile.md)
- [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)
## :link: Links
## :calendar: Community Meetings
+ **[Developer Manual](https://docs.openim.io/)**
+ **[Changelog](https://github.com/openimsdk/open-im-server/blob/main/CHANGELOG.md)**
We want anyone to get involved in our community and contributing code, we offer gifts and rewards, and we welcome you to join us every Thursday night.
## :writing_hand: How to Contribute
Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) 🎯, then you can search the Open-IM-Server pipeline to join
We welcome contributions of any kind! Please make sure to read our [Contributor Documentation](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md) before submitting a Pull Request.
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).
+ **[Report a Bug](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
+ **[Suggest a Feature](https://github.com/openimsdk/open-im-server/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
+ **[Submit a Pull Request](https://github.com/openimsdk/open-im-server/pulls)**
## :eyes: Who Are Using OpenIM
Thank you for contributing to building a powerful instant messaging solution!
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.
## :closed_book: License
## :page_facing_up: License
OpenIMSDK is available under the Apache License 2.0. See the [LICENSE file](https://github.com/openimsdk/open-im-server/blob/main/LICENSE) for more information.
OpenIM is licensed under the Apache 2.0 license. See [LICENSE](https://github.com/openimsdk/open-im-server/tree/main/LICENSE) for the full license text.
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](./assets/logo) and [assets/logo-gif](assets/logo-gif) directories, are protected by copyright laws.
## 🔮 Thanks to our contributors!

@ -51,31 +51,29 @@
</p>
## 🟢 扫描微信进群交流
<img src="./docs/images/wechat.jpg" width="300">
## :busts_in_silhouette: 加入我们的社区
+ 💬 [关注我们的 Twitter](https://twitter.com/founder_im63606)
+ 🚀 [加入我们的 Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-2hljfom5u-9ZuzP3NfEKW~BJKbpLm0Hw)
+ :eyes: [加入我们的微信群](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
## Ⓜ️ 关于 OpenIM
OpenIM 是一个专门设计用于在应用程序中集成聊天、音视频通话、通知以及AI聊天机器人等通信功能的服务平台。它通过提供一系列强大的API和Webhooks使开发者可以轻松地在他们的应用中加入这些交互特性。OpenIM 本身并不是一个独立运行的聊天应用,而是作为一个平台,为其他应用提供支持,实现丰富的通信功能。下图展示 AppServer、AppClient、OpenIMServer 和 OpenIMSDK 之间的交互关系来具体说明。
与Telegram、Signal、Rocket.Chat等独立聊天应用不同OpenIM提供了专为开发者设计的开源即时通讯解决方案而不是直接安装使用的独立聊天应用。OpenIM由OpenIM SDK和OpenIM Server两大部分组成为开发者提供了一整套集成即时通讯功能的工具和服务包括消息发送接收、用户管理和群组管理等。总体来说OpenIM旨在为开发者提供必要的工具和框架帮助他们在自己的应用中实现高效的即时通讯解决方案。
![App-OpenIM 关系](./docs/images/oepnim-design.png)
## 🚀 关于 OpenIMSDK
## 🚀 OpenIMSDK 介绍
**OpenIMSDK** 是为 **OpenIMServer** 设计的IM SDK专为嵌入客户端应用而生。其主要功能及模块如下
**OpenIMSDK** 是为 **OpenIMServer** 设计的IM SDK专为集成到客户端应用而生。它支持多种功能和模块
+ 🌟 主要功能:
- 📦 本地存储
- 🔔 监听器回调
- 🛡️ API封装
- 🌐 连接管理
## 📚 主要模块:
+ 📚 主要模块:
1. 🚀 初始化及登录
2. 👤 用户管理
3. 👫 好友管理
@ -86,81 +84,52 @@ OpenIM 是一个专门设计用于在应用程序中集成聊天、音视频通
👉 **[探索 GO SDK](https://github.com/openimsdk/openim-sdk-core)**
## 🌐 关于 OpenIMServer
## 🌐 OpenIMServer 介绍
+ **OpenIMServer** 具有以下特点
+ **OpenIMServer** 的特点包括
- 🌐 微服务架构:支持集群模式,包括网关(gateway)和多个rpc服务。
- 🚀 部署方式多样支持源代码、kubernetes或docker部署。
- 海量用户支持:十万超级大群,千万用户,及百亿消息
- 🚀 多样的部署方式支持源代码、Kubernetes或Docker部署。
- 海量用户支持:支持十万级超大群组,千万级用户和百亿级消息。
### 增强的业务功能:
+ **REST API**OpenIMServer 提供了REST API供业务系统使用旨在赋予业务更多功能例如通过后台接口建立群组、发送推送消息等。
+ **Webhooks**OpenIMServer提供了回调能力以扩展更多的业务形态所谓回调即OpenIMServer会在某一事件发生之前或者之后向业务服务器发送请求如发送消息之前或之后的回调。
+ **REST API**为业务系统提供REST API增加群组创建、消息推送等后台接口功能。
+ **Webhooks**:通过事件前后的回调,向业务服务器发送请求,扩展更多的业务形态。
👉 **[了解更多](https://docs.openim.io/guides/introduction/product)**
![整体架构](./docs/images/architecture-layers.png)
## :rocket: 快速开始
## :rocket: 快速入门
在线体验iOS/Android/H5/PC/Web
👉 **[OpenIM online demo](https://www.openim.io/zh/commercial)**
👉 **[OpenIM在线演示](https://www.openim.io/en/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)
支持 Linux、Windows、Mac 系统以及 ARM 和 AMD CPU 架构。
+ [目录标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/directory.md)
## :link: 相关链接
+ [提交标准](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://docs.openim.io/)**
+ **[更新日志](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: 贡献
## :writing_hand: 如何贡献
我们欢迎任何形式的贡献!请确保在提交 Pull Request 之前阅读我们的[贡献者文档](https://github.com/openimsdk/open-im-server/blob/main/CONTRIBUTING.md)
我们欢迎任何形式的贡献!在提交 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: 许可证

@ -0,0 +1,31 @@
@echo off
SETLOCAL
mage -version >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
echo Mage is already installed.
GOTO DOWNLOAD
)
go version >nul 2>&1
IF NOT %ERRORLEVEL% EQU 0 (
echo Go is not installed. Please install Go and try again.
exit /b 1
)
echo Installing Mage...
go install github.com/magefile/mage@latest
mage -version >nul 2>&1
IF NOT %ERRORLEVEL% EQU 0 (
echo Mage installation failed.
echo Please ensure that %GOPATH%/bin is in your PATH.
exit /b 1
)
echo Mage installed successfully.
:DOWNLOAD
go mod download
ENDLOCAL

@ -0,0 +1,23 @@
#!/bin/bash
if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
TARGET_DIR="$HOME/.local/bin"
else
TARGET_DIR="/usr/local/bin"
echo "Using /usr/local/bin as the installation directory. Might require sudo permissions."
fi
if ! command -v mage &> /dev/null; then
echo "Installing Mage to $TARGET_DIR ..."
GOBIN=$TARGET_DIR go install github.com/magefile/mage@latest
fi
if ! command -v mage &> /dev/null; then
echo "Mage installation failed."
echo "Please ensure that $TARGET_DIR is in your \$PATH."
exit 1
fi
echo "Mage installed successfully."
go mod download

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -19,7 +19,6 @@
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server

@ -1,57 +0,0 @@
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
FROM golang:1.20 AS builder
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.io,direct
WORKDIR /openim/openim-server
ENV GO111MODULE=$GO111MODULE
ENV GOPROXY=$GOPROXY
RUN apt-get update && apt-get install -y curl unzip
RUN curl -LO https://app-1302656840.cos.ap-nanjing.myqcloud.com/dist.zip \
&& unzip dist.zip -d ./ \
&& rm dist.zip
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-web
FROM ghcr.io/openim-sigs/openim-ubuntu-image:latest
WORKDIR /openim/openim-server
COPY --from=builder /openim/openim-server/_output/bin/tools /openim/openim-server/_output/bin/tools/
COPY --from=builder /openim/openim-server/dist /openim/openim-server/dist
ENV PORT 11001
ENV DISTPATH /openim/openim-server/dist
EXPOSE 11001
RUN mv ${OPENIM_SERVER_BINDIR}/tools/$(get_os)/$(get_arch)/openim-web /usr/bin/openim-web
ENTRYPOINT ["bash", "-c", "openim-web -port $PORT -distPath $DISTPATH"]

@ -18,14 +18,12 @@ 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"
"github.com/openimsdk/tools/system/program"
)
func main() {
apiCmd := cmd.NewApiCmd()
apiCmd.AddPortFlag()
apiCmd.AddPrometheusPortFlag()
if err := apiCmd.Execute(); err != nil {
util.ExitWithError(err)
if err := cmd.NewApiCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -16,7 +16,7 @@ package main
import (
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
"github.com/openimsdk/tools/system/program"
)
func main() {
@ -29,6 +29,8 @@ func main() {
getCmd.AddCommand(seqCmd.GetSeqCmd(), msgCmd.GetMsgCmd())
getCmd.AddSuperGroupIDFlag()
getCmd.AddUserIDFlag()
getCmd.AddConfigDirFlag()
getCmd.AddIndexFlag()
getCmd.AddBeginSeqFlag()
getCmd.AddLimitFlag()
// openIM get seq --userID=xxx
@ -39,6 +41,8 @@ func main() {
fixCmd.AddCommand(seqCmd.FixSeqCmd())
fixCmd.AddSuperGroupIDFlag()
fixCmd.AddUserIDFlag()
fixCmd.AddConfigDirFlag()
fixCmd.AddIndexFlag()
fixCmd.AddFixAllFlag()
// openIM fix seq --userID=xxx
// openIM fix seq --superGroupID=xxx
@ -47,6 +51,8 @@ func main() {
clearCmd.AddCommand(msgCmd.ClearMsgCmd())
clearCmd.AddSuperGroupIDFlag()
clearCmd.AddUserIDFlag()
clearCmd.AddConfigDirFlag()
clearCmd.AddIndexFlag()
clearCmd.AddClearAllFlag()
clearCmd.AddBeginSeqFlag()
clearCmd.AddLimitFlag()
@ -55,6 +61,6 @@ func main() {
// openIM clear msg --clearAll
msgUtilsCmd.AddCommand(&getCmd.Command, &fixCmd.Command, &clearCmd.Command)
if err := msgUtilsCmd.Execute(); err != nil {
util.ExitWithError(err)
program.ExitWithError(err)
}
}

@ -16,12 +16,11 @@ package main
import (
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
"github.com/openimsdk/tools/system/program"
)
func main() {
cronTaskCmd := cmd.NewCronTaskCmd()
if err := cronTaskCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewCronTaskCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -16,15 +16,11 @@ package main
import (
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
"github.com/openimsdk/tools/system/program"
)
func main() {
msgGatewayCmd := cmd.NewMsgGatewayCmd()
msgGatewayCmd.AddWsPortFlag()
msgGatewayCmd.AddPortFlag()
msgGatewayCmd.AddPrometheusPortFlag()
if err := msgGatewayCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewMsgGatewayCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -16,14 +16,11 @@ package main
import (
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
"github.com/openimsdk/tools/system/program"
)
func main() {
msgTransferCmd := cmd.NewMsgTransferCmd()
msgTransferCmd.AddPrometheusPortFlag()
msgTransferCmd.AddTransferProgressFlag()
if err := msgTransferCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewMsgTransferCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -15,16 +15,12 @@
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/tools/system/program"
)
func main() {
pushCmd := cmd.NewRpcCmd(cmd.RpcPushServer, push.Start)
pushCmd.AddPortFlag()
pushCmd.AddPrometheusPortFlag()
if err := pushCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewPushRpcCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -15,16 +15,12 @@
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/tools/system/program"
)
func main() {
authCmd := cmd.NewRpcCmd(cmd.RpcAuthServer, auth.Start)
authCmd.AddPortFlag()
authCmd.AddPrometheusPortFlag()
if err := authCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewAuthRpcCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -15,16 +15,12 @@
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/tools/system/program"
)
func main() {
rpcCmd := cmd.NewRpcCmd(cmd.RpcConversationServer, conversation.Start)
rpcCmd.AddPortFlag()
rpcCmd.AddPrometheusPortFlag()
if err := rpcCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewConversationRpcCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -15,16 +15,12 @@
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/tools/system/program"
)
func main() {
rpcCmd := cmd.NewRpcCmd(cmd.RpcFriendServer, friend.Start)
rpcCmd.AddPortFlag()
rpcCmd.AddPrometheusPortFlag()
if err := rpcCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewFriendRpcCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -15,16 +15,12 @@
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/tools/system/program"
)
func main() {
rpcCmd := cmd.NewRpcCmd(cmd.RpcGroupServer, group.Start)
rpcCmd.AddPortFlag()
rpcCmd.AddPrometheusPortFlag()
if err := rpcCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewGroupRpcCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -15,16 +15,12 @@
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/tools/system/program"
)
func main() {
rpcCmd := cmd.NewRpcCmd(cmd.RpcMsgServer, msg.Start)
rpcCmd.AddPortFlag()
rpcCmd.AddPrometheusPortFlag()
if err := rpcCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewMsgRpcCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -15,16 +15,12 @@
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/tools/system/program"
)
func main() {
rpcCmd := cmd.NewRpcCmd(cmd.RpcThirdServer, third.Start)
rpcCmd.AddPortFlag()
rpcCmd.AddPrometheusPortFlag()
if err := rpcCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewThirdRpcCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -15,16 +15,12 @@
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/tools/system/program"
)
func main() {
rpcCmd := cmd.NewRpcCmd(cmd.RpcUserServer, user.Start)
rpcCmd.AddPortFlag()
rpcCmd.AddPrometheusPortFlag()
if err := rpcCmd.Exec(); err != nil {
util.ExitWithError(err)
if err := cmd.NewUserRpcCmd().Exec(); err != nil {
program.ExitWithError(err)
}
}

@ -0,0 +1,63 @@
---
title: 'OpenIM Configuration Files and Common Configuration Item Modifications Guide'
## Configuration Files Explanation
| Configuration File | Description |
| ------------------------------- | ------------------------------------------------------------ |
| **kafka.yml** | Configurations for Kafka username, password, address, etc. |
| **redis.yml** | Configurations for Redis password, address, etc. |
| **minio.yml** | Configurations for MinIO username, password, address, and external IP/domain; failing to modify external IP or domain may cause image file sending failures |
| **zookeeper.yml** | Configurations for ZooKeeper user, password, address, etc. |
| **mongodb.yml** | Configurations for MongoDB username, password, address, etc. |
| **log.yml** | Configurations for log level and storage directory. |
| **notification.yml** | Configurations for events like adding friends, creating groups, etc. |
| **share.yml** | Common configurations needed by various OpenIM services, such as secret. |
| **webhooks.yml** | Configurations for URLs in Webhook. |
| **local-cache.yml** | Local cache configurations. |
| **openim-rpc-third.yml** | Configurations for listening IP, port, and storage settings for images and videos in openim-rpc-third service. |
| **openim-rpc-user.yml** | Configurations for listening IP and port in openim-rpc-user service. |
| **openim-api.yml** | Configurations for listening IP, port, etc., in openim-api service. |
| **openim-crontask.yml** | Configurations for openim-crontask service. |
| **openim-msggateway.yml** | Configurations for listening IP, port, etc., in openim-msggateway service. |
| **openim-msgtransfer.yml** | Configurations for openim-msgtransfer service. |
| **openim-push.yml** | Configurations for listening IP, port, and offline push settings in openim-push service. |
| **openim-rpc-auth.yml** | Configurations for listening IP, port, and token expiration settings in openim-rpc-auth service. |
| **openim-rpc-conversation.yml** | Configurations for listening IP, port, etc., in openim-rpc-conversation service. |
| **openim-rpc-friend.yml** | Configurations for listening IP, port, etc., in openim-rpc-friend service. |
| **openim-rpc-group.yml** | Configurations for listening IP, port, etc., in openim-rpc-group service. |
| **openim-rpc-msg.yml** | Configurations for listening IP, port, and whether to verify friendship before sending messages in openim-rpc-msg service. |
## Common Configuration Item Modifications
| Configuration Item Modification | Configuration File |
| ----------------------------------------------------- | ----------------------- |
| Using MinIO for image and video file object storage | `minio.yml` |
| Adjusting production environment logs | `log.yml` |
| Verifying friendship before sending messages | `openim-rpc-msg.yml` |
| Modifying secret | `share.yml` |
| Using OSS, COS, AWS, Kodo for image and video storage | `openim-rpc-third.yml` |
| Setting multiple login policy | `openim-msggateway.yml` |
| Setting up offline push | `openim-push.yml` |
## Starting Multiple Instances of an OpenIM Service
To start multiple instances of an OpenIM service, simply increase the corresponding port numbers and modify the `start-config.yml` file in the project root directory. Restart the service to take effect. For example, the configuration to start 2 instances of `openim-rpc-user` is as follows:
```yaml
rpc:
registerIP: ''
listenIP: 0.0.0.0
ports: [ 10110, 10111 ]
prometheus:
enable: true
ports: [ 20100, 20101 ]
```
Modify `start-config.yml`:
```yaml
serviceBinaries:
openim-rpc-user: 2
```

@ -0,0 +1,65 @@
# OpenIM配置文件说明以及常用配置修改说明
## 配置文件说明
| Configuration File | Description |
| ------------------------------- | ------------------------------------------------------------ |
| **kafka.yml** | Kafka用户名、密码、地址等配置 |
| **redis.yml** | Redis密码、地址等配置 |
| **minio.yml** | MinIO用户名、密码、地址及外网IP域名等配置未修改外网IP或域名可能导致图片文件发送失败 |
| **zookeeper.yml** | ZooKeeper用户、密码、地址等配置 |
| **mongodb.yml** | MongoDB用户名、密码、地址等配置 |
| **log.yml** | 日志级别及存储目录等配置 |
| **notification.yml** | 添加好友、创建群组等事件通知配置 |
| **share.yml** | OpenIM各服务所需的公共配置如secret等 |
| **webhooks.yml** | Webhook中URL等配置 |
| **local-cache.yml** | 本地缓存配置 |
| **openim-rpc-third.yml** | openim-rpc-third服务的监听IP、端口及图片视频对象存储配置 |
| **openim-rpc-user.yml** | openim-rpc-user服务的监听IP、端口配置 |
| **openim-api.yml** | openim-api服务的监听IP、端口等配置项 |
| **openim-crontask.yml** | openim-crontask服务配置 |
| **openim-msggateway.yml** | openim-msggateway服务的监听IP、端口等配置 |
| **openim-msgtransfer.yml** | openim-msgtransfer服务配置 |
| **openim-push.yml** | openim-push服务的监听IP、端口及离线推送配置 |
| **openim-rpc-auth.yml** | openim-rpc-auth服务的监听IP、端口及token有效期等配置 |
| **openim-rpc-conversation.yml** | openim-rpc-conversation服务的监听IP、端口等配置 |
| **openim-rpc-friend.yml** | openim-rpc-friend服务的监听IP、端口等配置 |
| **openim-rpc-group.yml** | openim-rpc-group服务的监听IP、端口等配置 |
| **openim-rpc-msg.yml** | openim-rpc-msg服务的监听IP、端口及消息发送是否验证好友关系等配置 |
## 常用配置修改
| 修改配置项 | 配置文件 |
| ----------------------------------------------- | ----------------------- |
| 使用minio作为图片视频文件对象存储 | `minio.yml` |
| 生产环境日志调整 | `log.yml` |
| 发送消息是否验证好友关系 | `openim-rpc-msg.yml` |
| 修改secret | `share.yml` |
| 使用oss, cos, aws, kodo作为图片视频文件对象存储 | `openim-rpc-third.yml` |
| 设置多端互踢策略 | `openim-msggateway.yml` |
| 设置离线推送 | `openim-push.yml` |
## 启动某个OpenIM服务的多个实例
若要启动某个OpenIM的多个实例只需增加对应的端口数并修改项目根目录下的`start-config.yml`文件重启服务即可生效。例如启动2个`openim-rpc-user`实例的配置如下:
```yaml
rpc:
registerIP: ''
listenIP: 0.0.0.0
ports: [ 10110, 10111 ]
prometheus:
enable: true
ports: [ 20100, 20101 ]
```
修改`start-config.yml`:
```yaml
serviceBinaries:
openim-rpc-user: 2
```

@ -1,243 +0,0 @@
# OpenIM Configuration Guide
<!-- vscode-markdown-toc -->
* 1. [Directory Structure and File Descriptions](#DirectoryStructureandFileDescriptions)
* 1.1. [Directory Structure](#DirectoryStructure)
* 1.2. [Directory Structure Explanation](#DirectoryStructureExplanation)
* 2. [File Descriptions](#FileDescriptions)
* 2.1. [Files in the Root Directory](#FilesintheRootDirectory)
* 2.2. [Files in the `templates/` Directory](#FilesinthetemplatesDirectory)
* 3. [Configuration File Generation](#ConfigurationFileGeneration)
* 3.1. [How to Use `init-config.sh` Script](#HowtoUseinit-config.shScript)
* 3.2. [Examples of Operations](#ExamplesofOperations)
* 3.3. [Points to Note](#PointstoNote)
* 4. [Example Directory](#ExampleDirectory)
* 4.1. [Overview](#Overview)
* 4.2. [Structure](#Structure)
* 4.3. [How to Use These Examples](#HowtoUseTheseExamples)
* 4.4. [Tips for Using Example Files:](#TipsforUsingExampleFiles:)
* 5. [Configuration Item Descriptions](#ConfigurationItemDescriptions)
* 6. [Version Management and Upgrading](#VersionManagementandUpgrading)
* 6.1. [Pulling the Latest Code](#PullingtheLatestCode)
* 6.2. [Generating the Latest Example Configuration Files](#GeneratingtheLatestExampleConfigurationFiles)
* 6.3. [Comparing Configuration File Differences](#ComparingConfigurationFileDifferences)
* 6.4. [Updating Configuration Files](#UpdatingConfigurationFiles)
* 6.5. [Updating Binary Files and Restarting Services](#UpdatingBinaryFilesandRestartingServices)
* 6.6. [Best Practices for Version Management](#BestPracticesforVersionManagement)
* 7. [How to Contribute](#HowtoContribute)
* 7.1. [OpenIM Configuration Item Descriptions](#OpenIMConfigurationItemDescriptions)
* 7.2. [Modifying Template Files](#ModifyingTemplateFiles)
* 7.3. [Updating Configuration Center Scripts](#UpdatingConfigurationCenterScripts)
* 7.4. [Configuration File Generation Process](#ConfigurationFileGenerationProcess)
* 7.5. [Contribution Guidelines](#ContributionGuidelines)
* 7.6. [Submission and Review](#SubmissionandReview)
<!-- vscode-markdown-toc-config
numbering=true
autoSave=true
/vscode-markdown-toc-config -->
<!-- /vscode-markdown-toc -->
## 1. <a name='DirectoryStructureandFileDescriptions'></a>Directory Structure and File Descriptions
This document details the structure of the `config` directory, aiding users in understanding and managing configuration files.
### 1.1. <a name='DirectoryStructure'></a>Directory Structure
```bash
$ tree config
├── alertmanager.yml
├── config.yaml
├── email.tmpl
├── instance-down-rules.yml
├── notification.yaml
├── prometheus.yml
├── Readme.md
└── templates
├── alertmanager.yml.template
├── config.yaml.template
├── email.tmpl.template
├── env.template
├── instance-down-rules.yml.template
├── notification.yaml.template
├── open-im-ng-example.conf
├── prometheus-dashboard.yaml
└── prometheus.yml.template
```
### 1.2. <a name='DirectoryStructureExplanation'></a>Directory Structure Explanation
- **Root Directory (`config/`)**: Contains actual configuration files and the `templates` subdirectory.
- **`templates/` Subdirectory**: Stores configuration templates for generating or updating configuration files in the root directory.
## 2. <a name='FileDescriptions'></a>File Descriptions
### 2.1. <a name='FilesintheRootDirectory'></a>Files in the Root Directory
- **`alertmanager.yml`**: Configuration file for AlertManager, managing and setting up the alert system.
- **`config.yaml`**: The main application configuration file, covering service settings.
- **`email.tmpl`**: Template file for email notifications, defining email format and content.
- **`instance-down-rules.yml`**: Instance downtime rules configuration file for the monitoring system.
- **`notification.yaml`**: Configuration file for notification settings, defining different types of notifications.
- **`prometheus.yml`**: Configuration file for the Prometheus monitoring system, setting monitoring metrics and rules.
### 2.2. <a name='FilesinthetemplatesDirectory'></a>Files in the `templates/` Directory
- **`alertmanager.yml.template`**: Template for AlertManager configuration.
- **`config.yaml.template`**: Main configuration template for the application.
- **`email.tmpl.template`**: Template for email notifications.
- **`env.template`**: Template for environmental variable configurations, setting environment-related configurations.
- **`instance-down-rules.yml.template`**: Template for instance downtime rules.
- **`notification.yaml.template`**: Template for notification settings.
- **`open-im-ng-example.conf`**: Example configuration file for the application.
- **`prometheus-dashboard.yaml`**: Prometheus dashboard configuration file, specific to the OpenIM application.
- **`prometheus.yml.template`**: Template for Prometheus configuration.
## 3. <a name='ConfigurationFileGeneration'></a>Configuration File Generation
Configuration files can be automatically generated using the `make init` command or the `./scripts/init-config.sh` script. These scripts conveniently extract templates from the `templates` directory and generate or update actual configuration files in the root directory.
### 3.1. <a name='HowtoUseinit-config.shScript'></a>How to Use `init-config.sh` Script
```bash
$ ./scripts/init-config.sh --help
Usage: init-config.sh [options]
Options:
-h, --help Show this help message
--force Overwrite existing files without prompt
--skip Skip generation if file exists
--examples Generate example files
--clean-config Clean all configuration files
--clean-examples Clean all example files
```
### 3.2. <a name='ExamplesofOperations'></a>Examples of Operations
- Generate all template configuration files:
```bash
$ ./scripts/init-config.sh --examples
```
- Force overwrite existing configuration files:
```bash
$ ./scripts/init-config.sh --force
```
### 3.3. <a name='PointstoNote'></a>Points to Note
- **Template files should not be directly modified**: Files in the `template` directory are templates included in source code management. Direct modification may lead to version conflicts or management issues.
- **Operations for Windows Users**: Windows users can use the `cp` command to copy files from the `template` directory to the `config/` directory and then modify the configuration items as needed.
## 4. <a name='ExampleDirectory'></a>Example Directory
Welcome to our project's `examples` directory! This directory contains a range of example files, showcasing various configurations and settings of our software. These examples are intended to provide you with templates that can serve as a starting point for your own configurations.
### 4.1. <a name='Overview'></a>Overview
In this directory, you'll find examples suitable for a variety of use cases. Each file is a template with default values and configurations, demonstrating best practices and typical scenarios. Whether you're just getting started or looking to implement complex settings, these examples should help you get on the right track.
### 4.2. <a name='Structure'></a>Structure
Here's a quick overview of the contents in this directory:
- `env-example.yaml`: Demonstrates how to set up environmental variables.
- `openim-example.yaml`: Example configuration file for the OpenIM application.
- `prometheus-example.yml`: Example configuration for monitoring with Prometheus.
- `alertmanager-example.yml`: Template for setting up Alertmanager configuration.
### 4.3. <a name='HowtoUseTheseExamples'></a>How to Use These Examples
To use these examples, simply copy the relevant files to your working directory and rename them as needed (for example, removing the `-example` suffix). Then, modify the files according to your needs.
### 4.4. <a name='TipsforUsingExampleFiles:'></a>Tips for Using Example Files:
1. **Read Comments**: Each file contains comments explaining the various sections and settings. Make sure to read these comments for a better understanding of how to customize the file.
2. **Check Required Changes**: Some examples might require mandatory changes before they can be used effectively (such as setting specific environmental variables).
3. **Version Compatibility**: Ensure that the example files are compatible with the version of the software you are using.
## 5. <a name='ConfigurationItemDescriptions'></a>Configuration Item Descriptions
## 6. <a name='VersionManagementandUpgrading'></a>Version Management and Upgrading
When managing and upgrading the `config` directory's versions, it is crucial to ensure that the configuration files in both the local `config/` and `config/templates/` directories are kept in sync. This process can ensure that your configuration files are consistent with the latest standard templates, while also maintaining custom settings.
### 6.1. <a name='PullingtheLatestCode'></a>Pulling the Latest Code
First, ensure that your local repository is in sync with the remote repository. This can be achieved by pulling the latest code:
```bash
$ git pull
```
### 6.2. <a name='GeneratingtheLatestExampleConfigurationFiles'></a>Generating the Latest Example Configuration Files
Next, generate the latest example configuration files. This can be done by running the `init-config.sh` script, using the `--examples` option to generate example files, and the `--skip` option to avoid overwriting existing configuration files:
```bash
$ ./scripts/init-config.sh --examples --skip
```
### 6.3. <a name='ComparingConfigurationFileDifferences'></a>Comparing Configuration File Differences
Once the latest example configuration files are generated, you need to compare the configuration files in the `config/` and `config/templates/` directories to find any potential differences. This step ensures that you can identify and integrate any important updates or changes. Tools like `diff` can be helpful in completing this step:
```bash
$ diff -ur config/ config/templates/
```
### 6.4. <a name='UpdatingConfigurationFiles'></a>Updating Configuration Files
Based on the comparison results, manually update the configuration files in the `config/` directory to reflect the latest configurations in `config/templates/`. During this process, ensure to retain any custom configuration settings.
### 6.5. <a name='UpdatingBinaryFilesandRestartingServices'></a>Updating Binary Files and Restarting Services
After updating the configuration files, the next step is to update any related binary files. This typically involves downloading and installing the latest version of the application or service. Depending on the specific application or service, this might involve running specific update scripts or directly downloading the latest version from official sources.
Once the binary files are updated, the services need to be restarted to apply the new configurations. Make sure to conduct necessary checks before restarting to ensure the correctness of the configurations.
### 6.6. <a name='BestPracticesforVersionManagement'></a>Best Practices for Version Management
- **Record Changes**: When committing changes to a version control system, ensure to log detailed change logs.
- **Stay Synced**: Regularly sync with the remote repository to ensure that your local configurations are in line with the latest developments.
- **Backup**: Backup your current configurations before making any significant changes, so that you can revert to a previous state if necessary.
By following these steps and best practices, you can ensure effective management and smooth upgrading of your `config` directory.
## 7. <a name='HowtoContribute'></a>How to Contribute
If you have an understanding of the logic behind OpenIM's configuration generation, then you will clearly know where to make modifications to contribute code.
### 7.1. <a name='OpenIMConfigurationItemDescriptions'></a>OpenIM Configuration Item Descriptions
First, it is recommended to read the [OpenIM Configuration Items Document](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md). This will help you understand the roles of various configuration items and how they affect the operation of OpenIM.
### 7.2. <a name='ModifyingTemplateFiles'></a>Modifying Template Files
To contribute to OpenIM, focus on the `./deployments/templates` directory. This contains various configuration template files, which are the basis for generating the final configuration files.
When making modifications, ensure that your changes align with OpenIM's configuration requirements and logic. This may involve adding new template files or modifying existing files to reflect new configuration options or structural changes.
### 7.3. <a name='UpdatingConfigurationCenterScripts'></a>Updating Configuration Center Scripts
In addition to modifying template files, pay attention to the `./scripts/install/environment.sh` script. In this script, you may need to add or modify environment variables.
This script is responsible for defining environment variables that influence configuration generation. Therefore, any new configuration items or modifications to existing items need to be reflected here.
### 7.4. <a name='ConfigurationFileGenerationProcess'></a>Configuration File Generation Process
The essence of the `make init` command is to use the environment variables defined in `/scripts/install/environment.sh` to render the template files in the `./deployments/templates` directory, thereby generating the final configuration files.
When contributing code, ensure that your changes work smoothly in this process and do not cause errors during configuration file generation.
### 7.5. <a name='ContributionGuidelines'></a>Contribution Guidelines
- **Code Review**: Ensure your changes have passed code review. This typically means that the code should be clear, easy to understand, and adhere to the project's coding style and best practices.
- **Testing**: Before submitting changes, conduct thorough tests to ensure new or modified configurations work as expected and do not negatively impact existing functionalities.
- **Documentation**: If you have added a new configuration option or made significant changes to an existing one, update the relevant documentation to assist other users and developers in understanding and utilizing these changes.
### 7.6. <a name='SubmissionandReview'></a>Submission and Review
After completing your changes, submit your code to the OpenIM repository in the form of a Pull Request (PR). The PR will be reviewed by the project maintainers and you may be asked to make further modifications or provide additional information.

@ -0,0 +1,36 @@
# Username for authentication
username: ''
# Password for authentication
password: ''
# Producer acknowledgment settings
producerAck: ""
# Compression type to use (e.g., none, gzip, snappy)
compressType: "none"
# List of Kafka broker addresses
address: [ localhost:19094 ]
# Kafka topic for Redis integration
toRedisTopic: "toRedis"
# Kafka topic for MongoDB integration
toMongoTopic: "toMongo"
# Kafka topic for push notifications
toPushTopic: "toPush"
# Consumer group ID for Redis topic
toRedisGroupID: redis
# Consumer group ID for MongoDB topic
toMongoGroupID: mongo
# Consumer group ID for push notifications topic
toPushGroupID: push
# TLS (Transport Layer Security) configuration
tls:
# Enable or disable TLS
enableTLS: false
# CA certificate file path
caCrt: ""
# Client certificate file path
clientCrt: ""
# Client key file path
clientKey: ""
# Client key password
clientKeyPwd: ""
# Whether to skip TLS verification (not recommended for production)
insecureSkipVerify: false

@ -0,0 +1,27 @@
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

@ -0,0 +1,13 @@
# Log storage path, default is acceptable, change to a full path if modification is needed
storageLocation: ../../../../logs/
# Log rotation period (in hours), default is acceptable
rotationTime: 24
# Number of log files to retain, default is acceptable
remainRotationCount: 2
# Log level settings: 3 for production environment; 6 for more verbose logging in debugging environments
remainLogLevel: 6
# Whether to output to standard output, default is acceptable
isStdout: false
# Whether to log in JSON format, default is acceptable
isJson: false

@ -0,0 +1,16 @@
# Name of the bucket in MinIO
bucket: "openim"
# Access key ID for MinIO authentication
accessKeyID: "root"
# Secret access key for MinIO authentication
secretAccessKey: "openIM123"
# Session token for MinIO authentication (optional)
sessionToken: ''
# Internal address of the MinIO server
internalAddress: "localhost:10005"
# External address of the MinIO server, accessible from outside. Supports both HTTP and HTTPS using a domain name
externalAddress: "http://external_ip:10005"
# Flag to enable or disable public read access to the bucket
publicRead: false

@ -0,0 +1,14 @@
# URI for database connection, leave empty if using address and credential settings directly
uri: ''
# List of MongoDB server addresses
address: [ localhost:37017 ]
# Name of the database
database: openim_v3
# Username for database authentication
username: openIM
# Password for database authentication
password: openIM123
# Maximum number of connections in the connection pool
maxPoolSize: 100
# Maximum number of retry attempts for a failed database connection
maxRetry: 10

@ -0,0 +1,345 @@
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Determines if a message should be sent. If set to false, it triggers a silent sync without a message. If true, it requires triggering a conversation.
# For rpc notification, send twice: once as a message and once as a notification.
# The options field 'isNotification' indicates if it's a notification.
groupCreated:
isSendMsg: true
# Reliability level of the message sending.
# Set to 1 to send only when online, 2 for guaranteed delivery.
reliabilityLevel: 1
# This setting is effective only when 'isSendMsg' is true.
# It controls whether to count unread messages.
unreadCount: false
# Configuration for offline push notifications.
offlinePush:
# Enables or disables offline push notifications.
enable: false
# Title for the notification when a group is created.
title: "create group title"
# Description for the notification.
desc: "create group desc"
# Additional information for the notification.
ext: "create group ext"
groupInfoSet:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupInfoSet title"
desc: "groupInfoSet desc"
ext: "groupInfoSet ext"
joinGroupApplication:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "joinGroupApplication title"
desc: "joinGroupApplication desc"
ext: "joinGroupApplication ext"
memberQuit:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "memberQuit title"
desc: "memberQuit desc"
ext: "memberQuit ext"
groupApplicationAccepted:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupApplicationAccepted title"
desc: "groupApplicationAccepted desc"
ext: "groupApplicationAccepted ext"
groupApplicationRejected:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupApplicationRejected title"
desc: "groupApplicationRejected desc"
ext: "groupApplicationRejected ext"
groupOwnerTransferred:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupOwnerTransferred title"
desc: "groupOwnerTransferred desc"
ext: "groupOwnerTransferred ext"
memberKicked:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "memberKicked title"
desc: "memberKicked desc"
ext: "memberKicked ext"
memberInvited:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "memberInvited title"
desc: "memberInvited desc"
ext: "memberInvited ext"
memberEnter:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "memberEnter title"
desc: "memberEnter desc"
ext: "memberEnter ext"
groupDismissed:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupDismissed title"
desc: "groupDismissed desc"
ext: "groupDismissed ext"
groupMuted:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupMuted title"
desc: "groupMuted desc"
ext: "groupMuted ext"
groupCancelMuted:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupCancelMuted title"
desc: "groupCancelMuted desc"
ext: "groupCancelMuted ext"
defaultTips:
tips: "group Cancel Muted"
groupMemberMuted:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupMemberMuted title"
desc: "groupMemberMuted desc"
ext: "groupMemberMuted ext"
groupMemberCancelMuted:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupMemberCancelMuted title"
desc: "groupMemberCancelMuted desc"
ext: "groupMemberCancelMuted ext"
groupMemberInfoSet:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupMemberInfoSet title"
desc: "groupMemberInfoSet desc"
ext: "groupMemberInfoSet ext"
groupInfoSetAnnouncement:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupInfoSetAnnouncement title"
desc: "groupInfoSetAnnouncement desc"
ext: "groupInfoSetAnnouncement ext"
groupInfoSetName:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "groupInfoSetName title"
desc: "groupInfoSetName desc"
ext: "groupInfoSetName ext"
#############################friend#################################
friendApplicationAdded:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "Somebody applies to add you as a friend"
desc: "Somebody applies to add you as a friend"
ext: "Somebody applies to add you as a friend"
friendApplicationApproved:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "Someone applies to add your friend application"
desc: "Someone applies to add your friend application"
ext: "Someone applies to add your friend application"
friendApplicationRejected:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "Someone rejected your friend application"
desc: "Someone rejected your friend application"
ext: "Someone rejected your friend application"
friendAdded:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "We have become friends"
desc: "We have become friends"
ext: "We have become friends"
friendDeleted:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "deleted a friend"
desc: "deleted a friend"
ext: "deleted a friend"
friendRemarkSet:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "Your friend's profile has been changed"
desc: "Your friend's profile has been changed"
ext: "Your friend's profile has been changed"
blackAdded:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "blocked a user"
desc: "blocked a user"
ext: "blocked a user"
blackDeleted:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "Remove a blocked user"
desc: "Remove a blocked user"
ext: "Remove a blocked user"
friendInfoUpdated:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "friend info updated"
desc: "friend info updated"
ext: "friend info updated"
#####################user#########################
userInfoUpdated:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "Remove a blocked user"
desc: "Remove a blocked user"
ext: "Remove a blocked user"
userStatusChanged:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
title: "user status changed"
desc: "user status changed"
ext: "user status changed"
#####################conversation#########################
conversationChanged:
isSendMsg: false
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "conversation changed"
desc: "conversation changed"
ext: "conversation changed"
conversationSetPrivate:
isSendMsg: true
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
title: "burn after reading"
desc: "burn after reading"
ext: "burn after reading"

@ -0,0 +1,13 @@
api:
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, default is recommended
listenIP: 0.0.0.0
# Listening ports; if multiple are configured, multiple instances will be launched, must be consistent with the number of prometheus.ports
ports: [ 10002 ]
prometheus:
# Whether to enable prometheus
enable: true
# Prometheus listening ports, must match the number of api.ports
ports: [ 20113 ]
# This address can be accessed via a browser
grafanaURL: http://127.0.0.1:13000/

@ -0,0 +1,2 @@
chatRecordsClearTime: "0 2 * * *"
retainChatRecords: 365

@ -0,0 +1,30 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
ports: [ 10140 ]
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
ports: [ 20112 ]
# IP address that the RPC/WebSocket service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
longConnSvr:
# WebSocket listening ports, must match the number of rpc.ports
ports: [ 10001 ]
# Maximum number of WebSocket connections
websocketMaxConnNum: 100000
# Maximum length of the entire WebSocket message packet
websocketMaxMsgLen: 4096
# WebSocket connection handshake timeout in seconds
websocketTimeout: 10
# 1: For Android, iOS, Windows, Mac, and web platforms, only one instance can be online at a time
multiLoginPolicy: 1

@ -0,0 +1,6 @@
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; each port corresponds to an instance of monitoring. Ensure these are managed accordingly
# Because four instances have been launched, four ports need to be specified
ports: [ 20108, 20109, 20110, 20111 ]

@ -0,0 +1,44 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
ports: [ 10170 ]
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
ports: [ 20107 ]
maxConcurrentWorkers: 3
#"Use geTui for offline push notifications, or choose fcm or jpns; corresponding configuration settings must be specified."
enable: "geTui"
geTui:
pushUrl: "https://restapi.getui.com/v2/$appId"
masterSecret: ''
appKey: ''
intent: ''
channelID: ''
channelName: ''
fcm:
serviceAccount: "x.json"
jpns:
appKey: ''
masterSecret: ''
pushURL: ''
pushIntent: ''
# iOS system push sound and badge count
iosPush:
pushSound: "xxx"
badgeCount: true
production: false

@ -0,0 +1,18 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
ports: [ 10160 ]
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
ports: [ 20106 ]
tokenPolicy:
# Token validity period, in days
expire: 90

@ -0,0 +1,13 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
ports: [ 10180 ]
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
ports: [ 20105 ]

@ -0,0 +1,13 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
ports: [ 10120 ]
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
ports: [ 20104 ]

@ -0,0 +1,13 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
ports: [ 10150 ]
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
ports: [ 20103 ]

@ -0,0 +1,20 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
ports: [ 10130 ]
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
ports: [ 20102 ]
# Does sending messages require friend verification
friendVerify: false

@ -0,0 +1,47 @@
rpc:
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
registerIP: ''
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
listenIP: 0.0.0.0
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
ports: [ 10190 ]
prometheus:
# Enable or disable Prometheus monitoring
enable: true
# List of ports that Prometheus listens on; these must match the number of rpc.ports to ensure correct monitoring setup
ports: [ 20101 ]
object:
# Use MinIO as object storage, or set to "cos", "oss", "kodo", "aws", while also configuring the corresponding settings
enable: "minio"
cos:
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
secretID: ''
secretKey: ''
sessionToken: ''
publicRead: false
oss:
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
bucket: "demo-9999999"
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
accessKeyID: ''
accessKeySecret: ''
sessionToken: ''
publicRead: false
kodo:
endpoint: "webhook://s3.cn-east-1.qiniucs.com"
bucket: "demo-9999999"
bucketURL: "webhook://your.domain.com"
accessKeyID: ''
accessKeySecret: ''
sessionToken: ''
publicRead: false
aws:
endpoint: "''"
region: "us-east-1"
bucket: "demo-9999999"
accessKeyID: ''
accessKeySecret: ''
publicRead: false

@ -0,0 +1,17 @@
rpc:
# API or other RPCs can access this RPC through this IP; if left blank, the internal network IP is obtained by default
registerIP: ''
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, if blank, the internal network IP is automatically obtained by default
listenIP: 0.0.0.0
# Listening ports; if multiple are configured, multiple instances will be launched, and must be consistent with the number of prometheus.ports
ports: [ 10110 ]
prometheus:
# Whether to enable prometheus
enable: true
# Prometheus listening ports, must be consistent with the number of rpc.ports
ports: [ 20100 ]

@ -0,0 +1,7 @@
address: [ localhost:16379 ]
username: ''
password: openIM123
enablePipeline: false
clusterMode: false
db: 0
maxRetry: 10

@ -0,0 +1,15 @@
secret: openIM123
env: zookeeper
rpcRegisterName:
user: user
friend: friend
msg: msg
push: push
messageGateway: messageGateway
group: group
auth: auth
conversation: conversation
third: third
imAdminUserID: [ "imAdmin" ]

@ -1,24 +1,3 @@
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------
# TODO: This config file is the template file
# --| source: deployments/templates/config.yaml
# --| env: scripts/install/environment
# --| target: config/config.yaml
# -----------------------------------------------------------------
envs:
discovery: zookeeper
@ -122,14 +101,14 @@ api:
# minio.signEndpoint is minio public network address
object:
enable: "minio"
apiURL: "http://172.28.0.1:10002"
apiURL: "http://127.0.0.1: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://127.0.0.1:10005"
publicRead: false
cos:
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
@ -154,8 +133,8 @@ object:
sessionToken: ''
publicRead: false
aws:
endpoint: ""
region: ""
endpoint: "''" # This might not be necessary unless you're using a custom endpoint
region: "us-east-1"
bucket: "demo-9999999"
accessKeyID: ''
accessKeySecret: ''
@ -200,7 +179,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/_output/logs/
rotationTime: 24
remainRotationCount: 2
remainLogLevel: 6
@ -250,9 +229,10 @@ 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: [ "openIM123456", "openIM654321", "openIMAdmin" ]
nickname: [ "system1", "system2", "system3" ]
userID:
nickname:
# chatAdmin, use for send notification
#
@ -336,7 +316,7 @@ callback:
timeout: 5
failedContinue: true
afterSendSingleMsg:
enable: true
enable: false
timeout: 5
failedContinue: true
beforeSendGroupMsg:
@ -521,7 +501,7 @@ callback:
# 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/
grafanaUrl: http://127.0.0.1:13000/
apiPrometheusPort: [20100]
userPrometheusPort: [ 20110 ]
friendPrometheusPort: [ 20120 ]
@ -534,3 +514,39 @@ prometheus:
rtcPrometheusPort: [ 21300 ]
thirdPrometheusPort: [ 21301 ]
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # 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

@ -25,7 +25,7 @@
# Data storage directory for persistent data.
# Example: DATA_DIR=/path/to/data
DATA_DIR=/workspaces/open-im-server
DATA_DIR=/data/workspaces/open-im-server
# Docker image registry. Uncomment the preferred one.
# Options: ghcr.io/openimsdk, openim, registry.cn-hangzhou.aliyuncs.com/openimsdk
@ -91,7 +91,7 @@ ALERT_MANAGER_NETWORK_ADDRESS=172.28.0.14
# ==============================================================================
# Local IP address of the service. Modify if necessary.
# Example: OPENIM_IP=172.28.0.1
OPENIM_IP=172.28.0.1
OPENIM_IP=127.0.0.1
# ----- ZooKeeper Configuration -----
# Port for ZooKeeper service.
@ -100,7 +100,7 @@ ZOOKEEPER_PORT=12181
# MongoDB service port configuration.
# Default: MONGO_PORT=37017
# MONGO_PORT=37017
MONGO_PORT=37017
# Password for MongoDB admin user. Used for service authentication.
# Default: MONGO_PASSWORD=openIM123
@ -143,7 +143,7 @@ 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
# 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.
#

@ -66,6 +66,7 @@ server {
proxy_set_header Connection "Upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Request-Api $scheme://$host/api;
proxy_pass http://im_api/;
}
location ^~/grafana/ { #10007 prometheus

@ -1213,7 +1213,7 @@
"editorMode": "code",
"expr": "sum(rate(app_requests_total{job=~\"^($job)$\"}[$interval])) by (job)",
"instant": false,
"legendFormat": "{{job}}-http",
"legendFormat": "{{job}}-webhook",
"range": true,
"refId": "A"
},

@ -0,0 +1,156 @@
url: "webhook://127.0.0.1:10008/callbackExample"
beforeSendSingleMsg:
enable: false
timeout: 5
failedContinue: true
beforeUpdateUserInfoEx:
enable: false
timeout: 5
failedContinue: true
afterUpdateUserInfoEx:
enable: false
timeout: 5
afterSendSingleMsg:
enable: false
timeout: 5
beforeSendGroupMsg:
enable: false
timeout: 5
failedContinue: true
beforeMsgModify:
enable: false
timeout: 5
failedContinue: true
afterSendGroupMsg:
enable: false
timeout: 5
afterUserOnline:
enable: false
timeout: 5
afterUserOffline:
enable: false
timeout: 5
afterUserKickOff:
enable: false
timeout: 5
beforeOfflinePush:
enable: false
timeout: 5
failedContinue: true
beforeOnlinePush:
enable: false
timeout: 5
failedContinue: true
beforeGroupOnlinePush:
enable: false
timeout: 5
failedContinue: true
beforeAddFriend:
enable: false
timeout: 5
failedContinue: true
beforeUpdateUserInfo:
enable: false
timeout: 5
failedContinue: true
afterUpdateUserInfo:
enable: false
timeout: 5
beforeCreateGroup:
enable: false
timeout: 5
failedContinue: true
afterCreateGroup:
enable: false
timeout: 5
beforeMemberJoinGroup:
enable: false
timeout: 5
failedContinue: true
beforeSetGroupMemberInfo:
enable: false
timeout: 5
failedContinue: true
afterSetGroupMemberInfo:
enable: false
timeout: 5
afterQuitGroup:
enable: false
timeout: 5
afterKickGroupMember:
enable: false
timeout: 5
afterDismissGroup:
enable: false
timeout: 5
beforeApplyJoinGroup:
enable: false
timeout: 5
failedContinue: true
afterGroupMsgRead:
enable: false
timeout: 5
afterSingleMsgRead:
enable: false
timeout: 5
beforeUserRegister:
enable: false
timeout: 5
failedContinue: true
afterUserRegister:
enable: false
timeout: 5
afterTransferGroupOwner:
enable: false
timeout: 5
beforeSetFriendRemark:
enable: false
timeout: 5
failedContinue: true
afterSetFriendRemark:
enable: false
timeout: 5
afterGroupMsgRevoke:
enable: false
timeout: 5
afterJoinGroup:
enable: false
timeout: 5
beforeInviteUserToGroup:
enable: false
timeout: 5
failedContinue: true
afterSetGroupInfo:
enable: false
timeout: 5
beforeSetGroupInfo:
enable: false
timeout: 5
failedContinue: true
afterRevokeMsg:
enable: false
timeout: 5
beforeAddBlack:
enable: false
timeout: 5
failedContinue:
afterAddFriend:
enable: false
timeout: 5
beforeAddFriendAgree:
enable: false
timeout: 5
failedContinue: true
afterDeleteFriend:
enable: false
timeout: 5
beforeImportFriends:
enable: false
timeout: 5
failedContinue: true
afterImportFriends:
enable: false
timeout: 5
afterRemoveBlack:
enable: false
timeout: 5

@ -0,0 +1,6 @@
schema: openim
address: [ localhost:12181 ]
username: ''
password: ''

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-api.selectorLabels" . | nindent 4 }}

@ -48,7 +48,7 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
- name: rpc
@ -57,11 +57,11 @@ spec:
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,9 +22,9 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
- port: 88
targetPort: rpc
protocol: TCP

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-msgtransfer.selectorLabels" . | nindent 4 }}

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-push.selectorLabels" . | nindent 4 }}

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-rpc-auth.selectorLabels" . | nindent 4 }}

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-rpc-conversation.selectorLabels" . | nindent 4 }}

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-rpc-friend.selectorLabels" . | nindent 4 }}

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-rpc-group.selectorLabels" . | nindent 4 }}

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-rpc-msg.selectorLabels" . | nindent 4 }}

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-rpc-third.selectorLabels" . | nindent 4 }}

@ -48,17 +48,17 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: webhook
containerPort: 80
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
#readinessProbe:
# httpGet:
# path: /
# port: http
# port: webhook
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:

@ -22,8 +22,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: webhook
protocol: TCP
name: http
name: webhook
selector:
{{- include "openim-rpc-user.selectorLabels" . | nindent 4 }}

@ -323,7 +323,7 @@ iosPush:
# Timeout in seconds
# Whether to continue execution if callback fails
callback:
url: "http://127.0.0.1:10008/callbackExample"
url: "webhook://127.0.0.1:10008/callbackExample"
beforeSendSingleMsg:
enable: ${CALLBACK_ENABLE}
timeout: ${CALLBACK_TIMEOUT}

@ -1,298 +0,0 @@
#fixme Clone openIM Server project before using docker-compose,project addresshttps://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}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save