复制项目
28
.dockerignore
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Ignore files and directories starting with a dot
|
||||||
|
|
||||||
|
# Ignore specific files
|
||||||
|
.dockerignore
|
||||||
|
.git
|
||||||
|
|
||||||
|
# Ignore build artifacts
|
||||||
|
logs/
|
||||||
|
_output/
|
||||||
|
# Ignore non-essential documentation
|
||||||
|
README.md
|
||||||
|
README-zh_CN.md
|
||||||
|
CONTRIBUTING.md
|
||||||
|
CHANGELOG/
|
||||||
|
# LICENSE
|
||||||
|
|
||||||
|
# Ignore testing and linting configuration
|
||||||
|
.golangci.yml
|
||||||
|
|
||||||
|
|
||||||
|
# Ignore assets
|
||||||
|
assets/
|
||||||
|
|
||||||
|
# Ignore components
|
||||||
|
components/
|
||||||
|
|
||||||
|
# Ignore tools and scripts
|
||||||
|
.github/
|
||||||
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.sh text eol=lf
|
||||||
255
.gitea/SECRETS_CONFIG.md
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
# OpenIM Server 项目 Gitea Actions 秘钥配置指南
|
||||||
|
|
||||||
|
## 📋 概述
|
||||||
|
|
||||||
|
本指南说明如何在 Gitea 中配置必要的秘钥,以支持 OpenIM Server 项目的自动构建和部署到阿里云 ACK。
|
||||||
|
|
||||||
|
## 🔑 必需秘钥配置
|
||||||
|
|
||||||
|
### 1. Docker Hub 相关秘钥
|
||||||
|
|
||||||
|
#### DOCKER_USERNAME
|
||||||
|
- **描述**: Docker Hub 用户名
|
||||||
|
- **示例**: `openim`
|
||||||
|
- **获取方式**: 在 Docker Hub 注册账号
|
||||||
|
|
||||||
|
#### DOCKER_PASSWORD
|
||||||
|
- **描述**: Docker Hub 密码或访问令牌
|
||||||
|
- **示例**: `your-docker-password` 或 `dckr_pat_xxxxxxxxxxxx`
|
||||||
|
- **推荐**: 使用访问令牌(Access Token)而不是密码
|
||||||
|
- **获取方式**:
|
||||||
|
1. 登录 Docker Hub
|
||||||
|
2. 进入 Account Settings → Security
|
||||||
|
3. 创建 New Access Token
|
||||||
|
|
||||||
|
### 2. 阿里云 ACK 相关秘钥
|
||||||
|
|
||||||
|
#### KUBECONFIG
|
||||||
|
- **描述**: 阿里云 ACK 集群的 kubeconfig 内容(base64编码)
|
||||||
|
- **格式**: base64编码的YAML格式kubeconfig文件内容
|
||||||
|
- **获取方式**: 见下方详细说明
|
||||||
|
|
||||||
|
#### ALIBABA_CLOUD_ACCESS_KEY_ID (可选)
|
||||||
|
- **描述**: 阿里云AccessKey ID
|
||||||
|
- **用途**: 用于通过aliyun CLI获取kubeconfig
|
||||||
|
- **获取方式**: 阿里云控制台 → 访问控制 → AccessKey管理
|
||||||
|
|
||||||
|
#### ALIBABA_CLOUD_ACCESS_KEY_SECRET (可选)
|
||||||
|
- **描述**: 阿里云AccessKey Secret
|
||||||
|
- **用途**: 用于通过aliyun CLI获取kubeconfig
|
||||||
|
- **获取方式**: 阿里云控制台 → 访问控制 → AccessKey管理
|
||||||
|
|
||||||
|
#### ACK_CLUSTER_ID (可选)
|
||||||
|
- **描述**: 阿里云ACK集群ID
|
||||||
|
- **用途**: 用于通过aliyun CLI获取kubeconfig
|
||||||
|
- **获取方式**: ACK控制台集群详情页
|
||||||
|
|
||||||
|
#### ACK_REGION (可选)
|
||||||
|
- **描述**: 阿里云ACK集群区域
|
||||||
|
- **默认值**: `cn-hangzhou`
|
||||||
|
- **示例**: `cn-beijing`, `cn-shanghai`, `cn-shenzhen`
|
||||||
|
|
||||||
|
#### NAMESPACE (可选)
|
||||||
|
- **描述**: Kubernetes命名空间
|
||||||
|
- **默认值**: `openim`
|
||||||
|
- **示例**: `openim`, `default`, `production`
|
||||||
|
|
||||||
|
## 🚀 获取阿里云 ACK KUBECONFIG
|
||||||
|
|
||||||
|
### 方法1: 通过阿里云控制台(推荐)
|
||||||
|
|
||||||
|
1. **登录阿里云控制台**
|
||||||
|
- 访问 [阿里云容器服务控制台](https://cs.console.aliyun.com/)
|
||||||
|
|
||||||
|
2. **选择集群**
|
||||||
|
- 进入目标 ACK 集群详情页
|
||||||
|
|
||||||
|
3. **获取连接信息**
|
||||||
|
- 点击 "连接信息" 标签
|
||||||
|
- 复制 "公网访问" 或 "内网访问" 的 kubeconfig 内容
|
||||||
|
|
||||||
|
4. **编码kubeconfig**
|
||||||
|
```bash
|
||||||
|
# 将获取的kubeconfig内容保存到文件
|
||||||
|
cat > kubeconfig.yaml << 'EOF'
|
||||||
|
apiVersion: v1
|
||||||
|
clusters:
|
||||||
|
- cluster:
|
||||||
|
certificate-authority-data: LS0tLS1CRUdJTi...
|
||||||
|
server: https://your-cluster-id.cn-hangzhou.cs.aliyuncs.com:6443
|
||||||
|
name: kubernetes
|
||||||
|
contexts:
|
||||||
|
- context:
|
||||||
|
cluster: kubernetes
|
||||||
|
user: your-user
|
||||||
|
name: kubernetes
|
||||||
|
current-context: kubernetes
|
||||||
|
kind: Config
|
||||||
|
preferences: {}
|
||||||
|
users:
|
||||||
|
- name: your-user
|
||||||
|
user:
|
||||||
|
client-certificate-data: LS0tLS1CRUdJTi...
|
||||||
|
client-key-data: LS0tLS1CRUdJTi...
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 编码为base64
|
||||||
|
base64 -w 0 kubeconfig.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
### 方法2: 通过阿里云 CLI
|
||||||
|
|
||||||
|
1. **安装阿里云 CLI**
|
||||||
|
```bash
|
||||||
|
# macOS
|
||||||
|
brew install aliyun-cli
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
curl -sSL https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz | tar -xzC /usr/local/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **配置认证**
|
||||||
|
```bash
|
||||||
|
aliyun configure
|
||||||
|
# 输入 AccessKey ID 和 AccessKey Secret
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **获取kubeconfig并编码**
|
||||||
|
```bash
|
||||||
|
# 获取指定集群的kubeconfig
|
||||||
|
aliyun cs GET /k8s/clusters/{cluster_id}/user_config > kubeconfig.yaml
|
||||||
|
|
||||||
|
# 编码为base64
|
||||||
|
base64 -w 0 kubeconfig.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔧 在 Gitea 中配置秘钥
|
||||||
|
|
||||||
|
### 1. 进入仓库设置
|
||||||
|
|
||||||
|
1. 打开 OpenIM Server 项目仓库
|
||||||
|
2. 点击 "Settings" 标签
|
||||||
|
3. 在左侧菜单中点击 "Secrets"
|
||||||
|
|
||||||
|
### 2. 添加秘钥
|
||||||
|
|
||||||
|
点击 "New Secret" 按钮,依次添加以下秘钥:
|
||||||
|
|
||||||
|
#### 必需秘钥
|
||||||
|
|
||||||
|
##### DOCKER_USERNAME
|
||||||
|
- **Name**: `DOCKER_USERNAME`
|
||||||
|
- **Value**: 你的 Docker Hub 用户名
|
||||||
|
|
||||||
|
##### DOCKER_PASSWORD
|
||||||
|
- **Name**: `DOCKER_PASSWORD`
|
||||||
|
- **Value**: 你的 Docker Hub 密码或访问令牌
|
||||||
|
|
||||||
|
##### KUBECONFIG
|
||||||
|
- **Name**: `KUBECONFIG`
|
||||||
|
- **Value**: base64编码的kubeconfig文件内容
|
||||||
|
|
||||||
|
#### 可选秘钥
|
||||||
|
|
||||||
|
##### ALIBABA_CLOUD_ACCESS_KEY_ID
|
||||||
|
- **Name**: `ALIBABA_CLOUD_ACCESS_KEY_ID`
|
||||||
|
- **Value**: 阿里云AccessKey ID
|
||||||
|
|
||||||
|
##### ALIBABA_CLOUD_ACCESS_KEY_SECRET
|
||||||
|
- **Name**: `ALIBABA_CLOUD_ACCESS_KEY_SECRET`
|
||||||
|
- **Value**: 阿里云AccessKey Secret
|
||||||
|
|
||||||
|
##### ACK_CLUSTER_ID
|
||||||
|
- **Name**: `ACK_CLUSTER_ID`
|
||||||
|
- **Value**: ACK集群ID
|
||||||
|
|
||||||
|
##### ACK_REGION
|
||||||
|
- **Name**: `ACK_REGION`
|
||||||
|
- **Value**: ACK集群区域(默认:cn-hangzhou)
|
||||||
|
|
||||||
|
##### NAMESPACE
|
||||||
|
- **Name**: `NAMESPACE`
|
||||||
|
- **Value**: Kubernetes命名空间(默认:openim)
|
||||||
|
|
||||||
|
## 🚨 安全注意事项
|
||||||
|
|
||||||
|
### 1. 秘钥安全
|
||||||
|
- **不要** 将秘钥提交到代码仓库
|
||||||
|
- **定期轮换** 访问令牌和密码
|
||||||
|
- **使用最小权限** 原则配置访问权限
|
||||||
|
|
||||||
|
### 2. KUBECONFIG 安全
|
||||||
|
- **限制权限**: 确保kubeconfig只有必要的权限
|
||||||
|
- **定期更新**: 定期更新证书和密钥
|
||||||
|
- **监控访问**: 监控集群访问日志
|
||||||
|
|
||||||
|
### 3. Docker Hub 安全
|
||||||
|
- **使用访问令牌**: 优先使用访问令牌而不是密码
|
||||||
|
- **限制权限**: 只授予必要的仓库推送权限
|
||||||
|
- **定期轮换**: 定期更新访问令牌
|
||||||
|
|
||||||
|
## 🔍 故障排除
|
||||||
|
|
||||||
|
### 常见问题
|
||||||
|
|
||||||
|
#### 1. Docker 登录失败
|
||||||
|
```
|
||||||
|
Error: Cannot perform an interactive login from a non TTY device
|
||||||
|
```
|
||||||
|
**解决方案**: 检查 `DOCKER_USERNAME` 和 `DOCKER_PASSWORD` 是否正确配置
|
||||||
|
|
||||||
|
#### 2. kubectl 连接失败
|
||||||
|
```
|
||||||
|
Unable to connect to the server: x509: certificate signed by unknown authority
|
||||||
|
```
|
||||||
|
**解决方案**: 检查 `KUBECONFIG` 中的证书数据是否正确
|
||||||
|
|
||||||
|
#### 3. 镜像拉取失败
|
||||||
|
```
|
||||||
|
Error: pull access denied for openim/openim-api
|
||||||
|
```
|
||||||
|
**解决方案**: 检查 Docker Hub 权限和镜像名称是否正确
|
||||||
|
|
||||||
|
#### 4. 部署超时
|
||||||
|
```
|
||||||
|
deployment "openim-api" exceeded its progress deadline
|
||||||
|
```
|
||||||
|
**解决方案**: 检查集群资源是否充足,Pod 是否正常启动
|
||||||
|
|
||||||
|
### 调试命令
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 检查秘钥是否正确设置
|
||||||
|
echo "Docker username: $DOCKER_USERNAME"
|
||||||
|
echo "Kubeconfig length: ${#KUBECONFIG}"
|
||||||
|
|
||||||
|
# 测试 Docker 登录
|
||||||
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
|
||||||
|
# 测试 kubectl 连接
|
||||||
|
echo "$KUBECONFIG" | base64 -d > ~/.kube/config
|
||||||
|
kubectl cluster-info
|
||||||
|
kubectl get nodes
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📚 参考文档
|
||||||
|
|
||||||
|
- [Gitea Actions 文档](https://docs.gitea.io/en-us/actions/)
|
||||||
|
- [阿里云 ACK 文档](https://help.aliyun.com/product/85222.html)
|
||||||
|
- [Docker Hub 访问令牌](https://docs.docker.com/docker-hub/access-tokens/)
|
||||||
|
- [Kubernetes kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
|
||||||
|
- [OpenIM 官方文档](https://docs.openim.io/)
|
||||||
|
|
||||||
|
## 🆘 支持
|
||||||
|
|
||||||
|
如遇到问题,请检查:
|
||||||
|
1. 秘钥是否正确配置
|
||||||
|
2. 网络连接是否正常
|
||||||
|
3. 权限是否充足
|
||||||
|
4. 集群状态是否正常
|
||||||
|
|
||||||
|
更多帮助请参考:
|
||||||
|
- Gitea Actions 日志
|
||||||
|
- 阿里云 ACK 控制台
|
||||||
|
- Docker Hub 状态页面
|
||||||
|
- OpenIM 官方文档
|
||||||
535
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,535 @@
|
|||||||
|
name: OpenIM Server 构建和发布
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main, master, wallet, develop, release-* ]
|
||||||
|
paths:
|
||||||
|
- '**'
|
||||||
|
pull_request:
|
||||||
|
branches: [ main, master, wallet ]
|
||||||
|
paths:
|
||||||
|
- '**'
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: "Tag version to be used for Docker image"
|
||||||
|
required: true
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.io
|
||||||
|
DOCKER_USER: ${{ secrets.DOCKER_USERNAME || 'mag1666888' }}
|
||||||
|
GO_VERSION: "1.24"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: openim
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 检出代码
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: 配置 SSH 密钥
|
||||||
|
run: |
|
||||||
|
echo "🔑 配置 SSH 密钥..."
|
||||||
|
# 创建 .ssh 目录
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
|
||||||
|
# 从 secrets 中获取 SSH 私钥并 base64 解码
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" | base64 -d > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
|
||||||
|
# 配置 SSH 主机密钥验证(可选,避免首次连接时的确认提示)
|
||||||
|
ssh-keyscan -H git.imall.cloud >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||||
|
chmod 644 ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
# 验证 SSH 密钥
|
||||||
|
if [ -f ~/.ssh/id_rsa ]; then
|
||||||
|
echo "✅ SSH 密钥配置成功"
|
||||||
|
else
|
||||||
|
echo "❌ SSH 密钥配置失败"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 检出 protocol 仓库
|
||||||
|
run: |
|
||||||
|
echo "📦 克隆 protocol 仓库..."
|
||||||
|
# 使用 SSH 方式克隆 protocol 仓库
|
||||||
|
git clone git@git.imall.cloud:openim/protocol.git ./protocol || true
|
||||||
|
cd ./protocol
|
||||||
|
git fetch --all
|
||||||
|
git checkout v1.0.4
|
||||||
|
cd ..
|
||||||
|
# 创建父目录的protocol符号链接,使replace ../protocol 能正确找到
|
||||||
|
ln -sf $PWD/protocol ../protocol || true
|
||||||
|
echo "✅ protocol 仓库检出完成"
|
||||||
|
|
||||||
|
- name: 设置 Go 缓存
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
|
- name: 设置 Go 环境
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: 检查 Go 环境
|
||||||
|
run: |
|
||||||
|
if command -v go &> /dev/null; then
|
||||||
|
echo "Go: $(go version)"
|
||||||
|
go mod verify >/dev/null 2>&1
|
||||||
|
go mod tidy >/dev/null 2>&1
|
||||||
|
go mod download >/dev/null 2>&1
|
||||||
|
echo "Go modules verified"
|
||||||
|
else
|
||||||
|
echo "Go not found, skipping Go steps"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 检查系统资源
|
||||||
|
run: |
|
||||||
|
echo "系统资源信息:"
|
||||||
|
echo "CPU核心数: $(nproc)"
|
||||||
|
echo "内存总量: $(free -h | awk '/^Mem:/ {print $2}')"
|
||||||
|
echo "可用内存: $(free -h | awk '/^Mem:/ {print $7}')"
|
||||||
|
echo "磁盘空间: $(df -h / | awk 'NR==2 {print $4}')"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
- name: 清理 Docker 环境
|
||||||
|
run: |
|
||||||
|
echo "清理Docker环境..."
|
||||||
|
docker image prune -f >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
- name: 登录到 Docker Hub
|
||||||
|
uses: docker/login-action@v3.3.0
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: 设置 Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3.8.0
|
||||||
|
with:
|
||||||
|
driver-opts: |
|
||||||
|
image=moby/buildkit:buildx-stable-1
|
||||||
|
network=host
|
||||||
|
|
||||||
|
- name: 构建和推送所有服务镜像
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
run: |
|
||||||
|
# 设置错误处理
|
||||||
|
trap 'echo "脚本在行 $LINENO 处失败,退出状态: $?"' ERR
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# 获取版本标签(使用分支名)
|
||||||
|
if [ "${{ github.event_name }}" = "release" ]; then
|
||||||
|
VERSION_TAG="${{ github.event.release.tag_name }}"
|
||||||
|
elif [ -n "${{ github.event.inputs.tag }}" ]; then
|
||||||
|
VERSION_TAG="${{ github.event.inputs.tag }}"
|
||||||
|
else
|
||||||
|
# 使用分支名作为标签
|
||||||
|
VERSION_TAG="${{ github.ref_name }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "构建OpenIM Server镜像 (标签: $VERSION_TAG)"
|
||||||
|
echo "Docker用户: $DOCKER_USER"
|
||||||
|
|
||||||
|
# 定义构建顺序(openim-msggateway 和 openim-push 优先构建)
|
||||||
|
CORE_SERVICES=(
|
||||||
|
"openim-msggateway"
|
||||||
|
"openim-push"
|
||||||
|
"openim-rpc-msg"
|
||||||
|
"openim-api"
|
||||||
|
"openim-msgtransfer"
|
||||||
|
"openim-crontask"
|
||||||
|
)
|
||||||
|
|
||||||
|
RPC_SERVICES=(
|
||||||
|
"openim-rpc-auth"
|
||||||
|
"openim-rpc-user"
|
||||||
|
"openim-rpc-friend"
|
||||||
|
"openim-rpc-group"
|
||||||
|
"openim-rpc-conversation"
|
||||||
|
"openim-rpc-third"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 构建函数
|
||||||
|
build_service() {
|
||||||
|
local service=$1
|
||||||
|
local dockerfile="build/images/$service/Dockerfile"
|
||||||
|
local start_time=$(date +%s)
|
||||||
|
|
||||||
|
if [ -f "$dockerfile" ]; then
|
||||||
|
echo "📦 构建 $service..."
|
||||||
|
|
||||||
|
if docker buildx build \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
--file "$dockerfile" \
|
||||||
|
--tag "$DOCKER_USER/$service:$VERSION_TAG" \
|
||||||
|
--tag "$DOCKER_USER/$service:prod" \
|
||||||
|
--push \
|
||||||
|
--progress=plain \
|
||||||
|
--cache-from type=gha,scope=openim-build-${{ github.ref_name }}-$service \
|
||||||
|
--cache-to type=gha,mode=max,scope=openim-build-${{ github.ref_name }}-$service \
|
||||||
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
||||||
|
--build-arg GOCACHE=/go-cache \
|
||||||
|
--build-arg GOMAXPROCS=$(nproc) \
|
||||||
|
--provenance=false \
|
||||||
|
--sbom=false \
|
||||||
|
. > "/tmp/build_${service}.log" 2>&1; then
|
||||||
|
|
||||||
|
local end_time=$(date +%s)
|
||||||
|
local duration=$((end_time - start_time))
|
||||||
|
echo "✅ $service 构建成功 (${duration}秒)"
|
||||||
|
else
|
||||||
|
echo "❌ $service 构建失败,查看详细错误日志:"
|
||||||
|
echo "=========================================="
|
||||||
|
cat "/tmp/build_${service}.log"
|
||||||
|
echo "=========================================="
|
||||||
|
echo "最后 50 行错误日志:"
|
||||||
|
tail -50 "/tmp/build_${service}.log"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "❌ $service - 未找到 Dockerfile: $dockerfile"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 初始化构建统计
|
||||||
|
failed_services=()
|
||||||
|
successful_services=()
|
||||||
|
|
||||||
|
# 计算总服务数
|
||||||
|
total_services=$((${#CORE_SERVICES[@]} + ${#RPC_SERVICES[@]}))
|
||||||
|
echo "开始构建 $total_services 个服务..."
|
||||||
|
|
||||||
|
# 先构建核心服务
|
||||||
|
for service in "${CORE_SERVICES[@]}"; do
|
||||||
|
if build_service "$service"; then
|
||||||
|
successful_services+=("$service")
|
||||||
|
else
|
||||||
|
failed_services+=("$service")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 构建RPC服务
|
||||||
|
for service in "${RPC_SERVICES[@]}"; do
|
||||||
|
if build_service "$service"; then
|
||||||
|
successful_services+=("$service")
|
||||||
|
else
|
||||||
|
failed_services+=("$service")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 输出构建结果统计
|
||||||
|
echo ""
|
||||||
|
echo "🎉 构建完成总结"
|
||||||
|
echo "✅ 成功构建: ${#successful_services[@]} 个服务"
|
||||||
|
echo "❌ 构建失败: ${#failed_services[@]} 个服务"
|
||||||
|
echo "📊 成功率: $(( ${#successful_services[@]} * 100 / total_services ))%"
|
||||||
|
|
||||||
|
if [ ${#failed_services[@]} -gt 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "失败服务错误日志:"
|
||||||
|
for service in "${failed_services[@]}"; do
|
||||||
|
echo "=== $service ==="
|
||||||
|
cat "/tmp/build_${service}.log" 2>/dev/null || echo "无法读取日志文件"
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 配置 kubectl
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
echo "🔧 配置 kubectl 连接到阿里云 ACK..."
|
||||||
|
# 创建 kubeconfig 目录
|
||||||
|
mkdir -p ~/.kube
|
||||||
|
|
||||||
|
# 从 secrets 中获取 kubeconfig 内容并处理
|
||||||
|
echo "📝 处理 kubeconfig 文件..."
|
||||||
|
|
||||||
|
# 直接解码 base64 内容
|
||||||
|
echo "🔍 解码 base64 编码的 kubeconfig..."
|
||||||
|
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
|
||||||
|
|
||||||
|
# 验证解码是否成功
|
||||||
|
if [ ! -s ~/.kube/config ]; then
|
||||||
|
echo "❌ kubeconfig 解码失败或文件为空"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 显示 kubeconfig 内容供手动检查
|
||||||
|
echo "🔍 解码后的 kubeconfig 内容:"
|
||||||
|
cat ~/.kube/config
|
||||||
|
|
||||||
|
chmod 600 ~/.kube/config
|
||||||
|
echo "✅ kubeconfig 配置完成"
|
||||||
|
|
||||||
|
# 详细验证 kubectl 配置
|
||||||
|
echo "🔍 验证 kubectl 配置..."
|
||||||
|
echo "当前上下文:"
|
||||||
|
kubectl config current-context 2>&1 || echo "无法获取当前上下文"
|
||||||
|
|
||||||
|
echo "可用上下文:"
|
||||||
|
kubectl config get-contexts 2>&1 || echo "无法获取上下文列表"
|
||||||
|
|
||||||
|
echo "集群信息:"
|
||||||
|
kubectl cluster-info 2>&1 || echo "无法获取集群信息"
|
||||||
|
|
||||||
|
echo "API 版本:"
|
||||||
|
kubectl version --short 2>&1 || echo "无法获取版本信息"
|
||||||
|
|
||||||
|
- name: 部署到阿里云 ACK
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
echo "🚀 开始部署到阿里云 ACK..."
|
||||||
|
|
||||||
|
# 简单验证 kubectl
|
||||||
|
if ! kubectl version --client >/dev/null 2>&1; then
|
||||||
|
echo "❌ kubectl 不可用,跳过部署步骤"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ kubectl 可用,尝试部署..."
|
||||||
|
|
||||||
|
# 获取版本标签(使用分支名)
|
||||||
|
if [ "${{ github.event_name }}" = "release" ]; then
|
||||||
|
VERSION_TAG="${{ github.event.release.tag_name }}"
|
||||||
|
elif [ -n "${{ github.event.inputs.tag }}" ]; then
|
||||||
|
VERSION_TAG="${{ github.event.inputs.tag }}"
|
||||||
|
else
|
||||||
|
# 使用分支名作为标签
|
||||||
|
VERSION_TAG="${{ github.ref_name }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "版本标签: $VERSION_TAG"
|
||||||
|
echo "Docker用户: $DOCKER_USER"
|
||||||
|
|
||||||
|
# 检查部署文件是否存在
|
||||||
|
DEPLOY_DIR="deployments/deploy"
|
||||||
|
if [ ! -d "$DEPLOY_DIR" ]; then
|
||||||
|
echo "❌ 部署目录不存在: $DEPLOY_DIR"
|
||||||
|
echo "📁 当前目录内容:"
|
||||||
|
ls -la
|
||||||
|
echo "⚠️ 部署失败,但构建流程继续"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "📁 进入部署目录: $DEPLOY_DIR"
|
||||||
|
cd "$DEPLOY_DIR"
|
||||||
|
|
||||||
|
# 设置命名空间
|
||||||
|
NS=${NS:-default}
|
||||||
|
echo "使用命名空间: $NS"
|
||||||
|
|
||||||
|
# 创建命名空间(如果不存在)
|
||||||
|
kubectl get ns "$NS" >/dev/null 2>&1 || kubectl create ns "$NS"
|
||||||
|
kubectl config set-context --current --namespace="$NS"
|
||||||
|
|
||||||
|
# 尝试部署,如果失败则继续
|
||||||
|
echo "🚀 开始部署OpenIM Server服务..."
|
||||||
|
|
||||||
|
# 定义所有部署文件
|
||||||
|
DEPLOYMENT_FILES=(
|
||||||
|
"openim-api-deployment.yml"
|
||||||
|
"openim-crontask-deployment.yml"
|
||||||
|
"openim-rpc-user-deployment.yml"
|
||||||
|
"openim-msggateway-deployment.yml"
|
||||||
|
"openim-push-deployment.yml"
|
||||||
|
"openim-msgtransfer-deployment.yml"
|
||||||
|
"openim-rpc-conversation-deployment.yml"
|
||||||
|
"openim-rpc-auth-deployment.yml"
|
||||||
|
"openim-rpc-group-deployment.yml"
|
||||||
|
"openim-rpc-friend-deployment.yml"
|
||||||
|
"openim-rpc-msg-deployment.yml"
|
||||||
|
"openim-rpc-third-deployment.yml"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 更新镜像标签并部署
|
||||||
|
DEPLOYMENT_ERRORS=()
|
||||||
|
for file in "${DEPLOYMENT_FILES[@]}"; do
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
echo "📦 处理 $file..."
|
||||||
|
# 备份原文件(保留 imagePullSecrets 等配置)
|
||||||
|
cp "$file" "$file.bak"
|
||||||
|
# 更新镜像标签(替换用户名和标签,但保留 imagePullSecrets)
|
||||||
|
sed -i "s|image: .*/openim-|image: $DOCKER_USER/openim-|g" "$file"
|
||||||
|
sed -i "s|:prod|:prod|g" "$file"
|
||||||
|
# 验证 imagePullSecrets 是否保留
|
||||||
|
if ! grep -q "imagePullSecrets:" "$file"; then
|
||||||
|
echo "⚠️ 警告: $file 中缺少 imagePullSecrets,从备份恢复..."
|
||||||
|
cp "$file.bak" "$file"
|
||||||
|
# 只更新镜像,不修改其他内容
|
||||||
|
sed -i "s|image: .*/openim-|image: $DOCKER_USER/openim-|g" "$file"
|
||||||
|
sed -i "s|:prod|:prod|g" "$file"
|
||||||
|
fi
|
||||||
|
# 应用文件并捕获详细错误
|
||||||
|
echo "🔍 执行: kubectl apply -f $file"
|
||||||
|
if kubectl apply -f "$file" 2>&1; then
|
||||||
|
echo "✅ $file 部署成功"
|
||||||
|
else
|
||||||
|
ERROR_OUTPUT=$(kubectl apply -f "$file" 2>&1)
|
||||||
|
echo "❌ $file 部署失败:"
|
||||||
|
echo "$ERROR_OUTPUT"
|
||||||
|
DEPLOYMENT_ERRORS+=("$file: $ERROR_OUTPUT")
|
||||||
|
echo "⚠️ 继续处理下一个文件..."
|
||||||
|
fi
|
||||||
|
# 清理备份文件
|
||||||
|
rm -f "$file.bak"
|
||||||
|
else
|
||||||
|
echo "⚠️ $file 不存在,跳过"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# 显示部署错误总结
|
||||||
|
if [ ${#DEPLOYMENT_ERRORS[@]} -gt 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "🚨 部署错误总结:"
|
||||||
|
echo "=========================================="
|
||||||
|
for error in "${DEPLOYMENT_ERRORS[@]}"; do
|
||||||
|
echo "❌ $error"
|
||||||
|
done
|
||||||
|
echo "=========================================="
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ 部署步骤完成"
|
||||||
|
|
||||||
|
# 强制重启所有部署以使用新镜像
|
||||||
|
echo "🔄 强制重启所有部署以使用新镜像..."
|
||||||
|
DEPLOYMENTS=(
|
||||||
|
"openim-api"
|
||||||
|
"openim-crontask"
|
||||||
|
"messagegateway-rpc-server"
|
||||||
|
"openim-msgtransfer-server"
|
||||||
|
"push-rpc-server"
|
||||||
|
"auth-rpc-server"
|
||||||
|
"user-rpc-server"
|
||||||
|
"friend-rpc-server"
|
||||||
|
"group-rpc-server"
|
||||||
|
"conversation-rpc-server"
|
||||||
|
"third-rpc-server"
|
||||||
|
"msg-rpc-server"
|
||||||
|
)
|
||||||
|
|
||||||
|
for deployment in "${DEPLOYMENTS[@]}"; do
|
||||||
|
echo "🔄 重启部署: $deployment"
|
||||||
|
# 先删除 pod 以强制拉取新镜像(即使 imagePullPolicy 是 Always,有时也需要删除 pod)
|
||||||
|
if kubectl delete pods -l app="$deployment" --grace-period=0 --force 2>&1; then
|
||||||
|
echo "✅ $deployment Pod 已删除,将重新创建并拉取新镜像"
|
||||||
|
fi
|
||||||
|
# 然后重启 deployment
|
||||||
|
if kubectl rollout restart deployment "$deployment" 2>&1; then
|
||||||
|
echo "✅ $deployment 重启成功"
|
||||||
|
else
|
||||||
|
echo "⚠️ $deployment 重启失败,可能不存在"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "⏳ 等待部署完成..."
|
||||||
|
for deployment in "${DEPLOYMENTS[@]}"; do
|
||||||
|
echo "⏳ 等待 $deployment 就绪..."
|
||||||
|
if kubectl rollout status deployment "$deployment" --timeout=300s; then
|
||||||
|
echo "✅ $deployment 部署完成"
|
||||||
|
else
|
||||||
|
echo "⚠️ $deployment 超时,检查Pod状态..."
|
||||||
|
echo "Pod状态:"
|
||||||
|
kubectl get pods -l app="$deployment" 2>&1 || echo "无法获取Pod状态"
|
||||||
|
echo "Pod事件:"
|
||||||
|
kubectl get events --field-selector involvedObject.name="$deployment" --sort-by='.lastTimestamp' 2>&1 | tail -10 || echo "无法获取事件"
|
||||||
|
echo "部署详情:"
|
||||||
|
kubectl describe deployment "$deployment" 2>&1 | tail -20 || echo "无法获取部署详情"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: 验证部署状态
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
echo "🔍 验证部署状态..."
|
||||||
|
|
||||||
|
# 详细检查集群连接和权限
|
||||||
|
echo "🔍 检查集群连接..."
|
||||||
|
if kubectl cluster-info 2>&1; then
|
||||||
|
echo "✅ 集群连接正常"
|
||||||
|
else
|
||||||
|
CLUSTER_ERROR=$(kubectl cluster-info 2>&1)
|
||||||
|
echo "❌ 集群连接失败: $CLUSTER_ERROR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🔍 检查命名空间权限..."
|
||||||
|
if kubectl get namespaces 2>&1; then
|
||||||
|
echo "✅ 命名空间权限正常"
|
||||||
|
else
|
||||||
|
NS_ERROR=$(kubectl get namespaces 2>&1)
|
||||||
|
echo "❌ 命名空间权限不足: $NS_ERROR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🔍 检查 Pod 状态..."
|
||||||
|
if kubectl get pods -l app=openim 2>&1; then
|
||||||
|
echo "✅ Pod 状态检查完成"
|
||||||
|
else
|
||||||
|
POD_ERROR=$(kubectl get pods -l app=openim 2>&1)
|
||||||
|
echo "❌ Pod 状态检查失败: $POD_ERROR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🔍 检查部署状态..."
|
||||||
|
if kubectl get deployments -l app=openim 2>&1; then
|
||||||
|
echo "✅ 部署状态检查完成"
|
||||||
|
else
|
||||||
|
DEPLOY_ERROR=$(kubectl get deployments -l app=openim 2>&1)
|
||||||
|
echo "❌ 部署状态检查失败: $DEPLOY_ERROR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ 验证完成"
|
||||||
|
|
||||||
|
- name: 生成构建报告
|
||||||
|
run: |
|
||||||
|
# 获取版本标签(使用分支名)
|
||||||
|
if [ "${{ github.event_name }}" = "release" ]; then
|
||||||
|
VERSION_TAG="${{ github.event.release.tag_name }}"
|
||||||
|
elif [ -n "${{ github.event.inputs.tag }}" ]; then
|
||||||
|
VERSION_TAG="${{ github.event.inputs.tag }}"
|
||||||
|
else
|
||||||
|
# 使用分支名作为标签
|
||||||
|
VERSION_TAG="${{ github.ref_name }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "## OpenIM Server Build Complete" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Tag:** $VERSION_TAG" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Platform:** linux/amd64" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Mode:** 完整构建和部署" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Images:**" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-api:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-msggateway:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-msgtransfer:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-push:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-crontask:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-rpc-auth:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-rpc-user:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-rpc-friend:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-rpc-group:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-rpc-conversation:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-rpc-third:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- \`$DOCKER_USER/openim-rpc-msg:$VERSION_TAG\`" >> $GITHUB_STEP_SUMMARY
|
||||||
426
.gitignore
vendored
Normal file
@@ -0,0 +1,426 @@
|
|||||||
|
# Copyright © 2023 OpenIMSDK.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# For the entire design of.gitignore, ignore git commits and ignore files
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
|
||||||
|
### OpenIM developer supplement ###
|
||||||
|
logs
|
||||||
|
.devcontainer
|
||||||
|
components
|
||||||
|
out-test
|
||||||
|
Dockerfile.cross
|
||||||
|
|
||||||
|
### Makefile ###
|
||||||
|
tmp/
|
||||||
|
bin/
|
||||||
|
output/
|
||||||
|
_output/
|
||||||
|
deployments/charts/generated-configs/
|
||||||
|
|
||||||
|
### OpenIM Config ###
|
||||||
|
.env
|
||||||
|
config/config.yaml
|
||||||
|
config/notification.yaml
|
||||||
|
|
||||||
|
### OpenIM deploy ###
|
||||||
|
deployments/openim-server/charts
|
||||||
|
|
||||||
|
# files used by the developer
|
||||||
|
.idea.md
|
||||||
|
.todo.md
|
||||||
|
.note.md
|
||||||
|
scripts/chat_register_login.sh
|
||||||
|
scripts/check_online_vs_register.sh
|
||||||
|
scripts/cleanup_online_keys.sh
|
||||||
|
scripts/cleanup_online_keys_cluster.sh
|
||||||
|
scripts/start_all_local.sh
|
||||||
|
scripts/switch_online_prefix_roll_restart_verify.sh
|
||||||
|
scripts/verify_online_prefix.sh
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/go,git,vim,tags,test,emacs,backup,jetbrains
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=go,git,vim,tags,test,emacs,backup,jetbrains
|
||||||
|
|
||||||
|
### Backup ###
|
||||||
|
*.bak
|
||||||
|
*.gho
|
||||||
|
*.ori
|
||||||
|
*.orig
|
||||||
|
*.tmp
|
||||||
|
|
||||||
|
### Emacs ###
|
||||||
|
# -*- mode: gitignore; -*-
|
||||||
|
*~
|
||||||
|
\#*\#
|
||||||
|
/.emacs.desktop
|
||||||
|
/.emacs.desktop.lock
|
||||||
|
*.elc
|
||||||
|
auto-save-list
|
||||||
|
tramp
|
||||||
|
.\#*
|
||||||
|
|
||||||
|
# Org-mode
|
||||||
|
.org-id-locations
|
||||||
|
*_archive
|
||||||
|
|
||||||
|
# flymake-mode
|
||||||
|
*_flymake.*
|
||||||
|
|
||||||
|
# eshell files
|
||||||
|
/eshell/history
|
||||||
|
/eshell/lastdir
|
||||||
|
|
||||||
|
# elpa packages
|
||||||
|
/elpa/
|
||||||
|
|
||||||
|
# reftex files
|
||||||
|
*.rel
|
||||||
|
|
||||||
|
# AUCTeX auto folder
|
||||||
|
/auto/
|
||||||
|
|
||||||
|
# cask packages
|
||||||
|
.cask/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# Flycheck
|
||||||
|
flycheck_*.el
|
||||||
|
|
||||||
|
# server auth directory
|
||||||
|
/server/
|
||||||
|
|
||||||
|
# projectiles files
|
||||||
|
.projectile
|
||||||
|
|
||||||
|
# directory configuration
|
||||||
|
.dir-locals.el
|
||||||
|
|
||||||
|
# network security
|
||||||
|
/network-security.data
|
||||||
|
|
||||||
|
### vscode ###
|
||||||
|
.vscode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/vim,jetbrains,vscode,git,go,tags,backup,test
|
||||||
|
|
||||||
|
### Git ###
|
||||||
|
# Created by git for backups. To disable backups in Git:
|
||||||
|
# $ git config --global mergetool.keepBackup false
|
||||||
|
|
||||||
|
# Created by git when using merge tools for conflicts
|
||||||
|
*.BACKUP.*
|
||||||
|
*.BASE.*
|
||||||
|
*.LOCAL.*
|
||||||
|
*.REMOTE.*
|
||||||
|
*_BACKUP_*.txt
|
||||||
|
*_BASE_*.txt
|
||||||
|
*_LOCAL_*.txt
|
||||||
|
*_REMOTE_*.txt
|
||||||
|
|
||||||
|
### Go ###
|
||||||
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
|
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||||
|
#
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
# go.work
|
||||||
|
go.work.sum
|
||||||
|
|
||||||
|
### JetBrains ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# AWS User-specific
|
||||||
|
.idea/**/aws.xml
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/artifacts
|
||||||
|
# .idea/compiler.xml
|
||||||
|
# .idea/jarRepositories.xml
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# SonarLint plugin
|
||||||
|
.idea/sonarlint/
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
### JetBrains Patch ###
|
||||||
|
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||||
|
|
||||||
|
# *.iml
|
||||||
|
# modules.xml
|
||||||
|
# .idea/misc.xml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# Sonarlint plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
||||||
|
.idea/**/sonarlint/
|
||||||
|
|
||||||
|
# SonarQube Plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
||||||
|
.idea/**/sonarIssues.xml
|
||||||
|
|
||||||
|
# Markdown Navigator plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
||||||
|
.idea/**/markdown-navigator.xml
|
||||||
|
.idea/**/markdown-navigator-enh.xml
|
||||||
|
.idea/**/markdown-navigator/
|
||||||
|
|
||||||
|
# Cache file creation bug
|
||||||
|
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
||||||
|
.idea/$CACHE_FILE$
|
||||||
|
|
||||||
|
# CodeStream plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/12206-codestream
|
||||||
|
.idea/codestream.xml
|
||||||
|
|
||||||
|
# Azure Toolkit for IntelliJ plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
|
||||||
|
.idea/**/azureSettings.xml
|
||||||
|
|
||||||
|
### Tags ###
|
||||||
|
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
|
||||||
|
TAGS
|
||||||
|
.TAGS
|
||||||
|
!TAGS/
|
||||||
|
tags
|
||||||
|
.tags
|
||||||
|
!tags/
|
||||||
|
gtags.files
|
||||||
|
GTAGS
|
||||||
|
GRTAGS
|
||||||
|
GPATH
|
||||||
|
GSYMS
|
||||||
|
cscope.files
|
||||||
|
cscope.out
|
||||||
|
cscope.in.out
|
||||||
|
cscope.po.out
|
||||||
|
|
||||||
|
|
||||||
|
### Test ###
|
||||||
|
### Ignore all files that could be used to test your code and
|
||||||
|
### you wouldn't want to push
|
||||||
|
|
||||||
|
# Reference https://en.wikipedia.org/wiki/Metasyntactic_variable
|
||||||
|
|
||||||
|
# Most common
|
||||||
|
*foo
|
||||||
|
*bar
|
||||||
|
*fubar
|
||||||
|
*foobar
|
||||||
|
*baz
|
||||||
|
|
||||||
|
# Less common
|
||||||
|
*qux
|
||||||
|
*quux
|
||||||
|
*bongo
|
||||||
|
*bazola
|
||||||
|
*ztesch
|
||||||
|
|
||||||
|
# UK, Australia
|
||||||
|
*wibble
|
||||||
|
*wobble
|
||||||
|
*wubble
|
||||||
|
*flob
|
||||||
|
*blep
|
||||||
|
*blah
|
||||||
|
*boop
|
||||||
|
*beep
|
||||||
|
|
||||||
|
# Japanese
|
||||||
|
*hoge
|
||||||
|
*piyo
|
||||||
|
*fuga
|
||||||
|
*hogera
|
||||||
|
*hogehoge
|
||||||
|
|
||||||
|
# Portugal, Spain
|
||||||
|
*fulano
|
||||||
|
*sicrano
|
||||||
|
*beltrano
|
||||||
|
*mengano
|
||||||
|
*perengano
|
||||||
|
*zutano
|
||||||
|
|
||||||
|
# France, Italy, the Netherlands
|
||||||
|
*toto
|
||||||
|
*titi
|
||||||
|
*tata
|
||||||
|
*tutu
|
||||||
|
*pipppo
|
||||||
|
*pluto
|
||||||
|
*paperino
|
||||||
|
*aap
|
||||||
|
*noot
|
||||||
|
*mies
|
||||||
|
|
||||||
|
# Other names that would make sense
|
||||||
|
*tests
|
||||||
|
*testsdir
|
||||||
|
*testsfile
|
||||||
|
*testsfiles
|
||||||
|
*testdir
|
||||||
|
*testfile
|
||||||
|
*testfiles
|
||||||
|
*testing
|
||||||
|
*testingdir
|
||||||
|
*testingfile
|
||||||
|
*testingfiles
|
||||||
|
*temp
|
||||||
|
*tempdir
|
||||||
|
*tempfile
|
||||||
|
*tempfiles
|
||||||
|
*tmp
|
||||||
|
*tmpdir
|
||||||
|
*tmpfile
|
||||||
|
*tmpfiles
|
||||||
|
*lol
|
||||||
|
|
||||||
|
### Vim ###
|
||||||
|
# Swap
|
||||||
|
[._]*.s[a-v][a-z]
|
||||||
|
!*.svg # comment out if you don't need vector files
|
||||||
|
[._]*.sw[a-p]
|
||||||
|
[._]s[a-rt-v][a-z]
|
||||||
|
[._]ss[a-gi-z]
|
||||||
|
[._]sw[a-p]
|
||||||
|
|
||||||
|
# Session
|
||||||
|
Session.vim
|
||||||
|
Sessionx.vim
|
||||||
|
|
||||||
|
# Temporary
|
||||||
|
.netrwhist
|
||||||
|
# Auto-generated tag files
|
||||||
|
# Persistent undo
|
||||||
|
[._]*.un~
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/go,git,vim,tags,test,emacs,backup,jetbrains
|
||||||
|
|
||||||
|
### macOS ###
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
.idea
|
||||||
|
dist/
|
||||||
912
.golangci.yml
Normal file
@@ -0,0 +1,912 @@
|
|||||||
|
# options for analysis running
|
||||||
|
run:
|
||||||
|
# default concurrency is a available CPU number
|
||||||
|
concurrency: 4
|
||||||
|
|
||||||
|
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||||
|
timeout: 5m
|
||||||
|
|
||||||
|
# exit code when at least one issue was found, default is 1
|
||||||
|
issues-exit-code: 1
|
||||||
|
|
||||||
|
# include test files or not, default is true
|
||||||
|
tests: true
|
||||||
|
|
||||||
|
# list of build tags, all linters use it. Default is empty list.
|
||||||
|
build-tags:
|
||||||
|
- mytag
|
||||||
|
|
||||||
|
# which dirs to skip: issues from them won't be reported;
|
||||||
|
# can use regexp here: generated.*, regexp is applied on full path;
|
||||||
|
# default value is empty list, but default dirs are skipped independently
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# default is true. Enables skipping of directories:
|
||||||
|
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
|
||||||
|
# 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
|
||||||
|
# no need to include all autogenerated files, we confidently recognize
|
||||||
|
# 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/"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# automatic updating of go.mod described above. Instead, it fails when any changes
|
||||||
|
# to go.mod are needed. This setting is most useful to check that go.mod does
|
||||||
|
# not need updates, such as in a continuous integration and testing system.
|
||||||
|
# If invoked with -mod=vendor, the go command assumes that the vendor
|
||||||
|
# directory holds the correct copies of dependencies and ignores
|
||||||
|
# the dependency descriptions in go.mod.
|
||||||
|
#modules-download-mode: release|readonly|vendor
|
||||||
|
|
||||||
|
# Allow multiple parallel golangci-lint instances running.
|
||||||
|
# If false (default) - golangci-lint acquires file lock on start.
|
||||||
|
allow-parallel-runners: true
|
||||||
|
|
||||||
|
|
||||||
|
# output configuration options
|
||||||
|
output:
|
||||||
|
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||||
|
# format: colored-line-number
|
||||||
|
|
||||||
|
# print lines of code with issue, default is true
|
||||||
|
print-issued-lines: true
|
||||||
|
|
||||||
|
# print linter name in the end of issue text, default is true
|
||||||
|
print-linter-name: true
|
||||||
|
|
||||||
|
# make issues output unique by line, default is true
|
||||||
|
uniq-by-line: true
|
||||||
|
|
||||||
|
# add a prefix to the output file references; default is no prefix
|
||||||
|
path-prefix: ""
|
||||||
|
|
||||||
|
# sorts results by: filepath, line and column
|
||||||
|
sort-results: true
|
||||||
|
|
||||||
|
# all available settings of specific linters
|
||||||
|
linters-settings:
|
||||||
|
bidichk:
|
||||||
|
# The following configurations check for all mentioned invisible unicode
|
||||||
|
# runes. It can be omitted because all runes are enabled by default.
|
||||||
|
left-to-right-embedding: true
|
||||||
|
right-to-left-embedding: true
|
||||||
|
pop-directional-formatting: true
|
||||||
|
left-to-right-override: true
|
||||||
|
right-to-left-override: true
|
||||||
|
left-to-right-isolate: true
|
||||||
|
right-to-left-isolate: true
|
||||||
|
first-strong-isolate: true
|
||||||
|
pop-directional-isolate: true
|
||||||
|
|
||||||
|
dupl:
|
||||||
|
# tokens count to trigger issue, 150 by default
|
||||||
|
threshold: 200
|
||||||
|
errcheck:
|
||||||
|
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
|
||||||
|
# default is false: such cases aren't reported by default.
|
||||||
|
check-type-assertions: false
|
||||||
|
|
||||||
|
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
|
||||||
|
# default is false: such cases aren't reported by default.
|
||||||
|
check-blank: false
|
||||||
|
|
||||||
|
# [deprecated] comma-separated list of pairs of the form pkg:regex
|
||||||
|
# the regex is used to ignore names within pkg. (default "fmt:.*").
|
||||||
|
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
|
||||||
|
#ignore: GenMarkdownTree,os:.*,BindPFlags,WriteTo,Help
|
||||||
|
#ignore: (os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv
|
||||||
|
|
||||||
|
# path to a file containing a list of functions to exclude from checking
|
||||||
|
# see https://github.com/kisielk/errcheck#excluding-functions for details
|
||||||
|
# exclude: errcheck.txt
|
||||||
|
|
||||||
|
errorlint:
|
||||||
|
# Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
|
||||||
|
errorf: true
|
||||||
|
# Check for plain type assertions and type switches
|
||||||
|
asserts: true
|
||||||
|
# Check for plain error comparisons
|
||||||
|
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
|
||||||
|
# 'default' case is present, even if all enum members aren't listed in the
|
||||||
|
# switch
|
||||||
|
default-signifies-exhaustive: false
|
||||||
|
# enum members matching the supplied regex do not have to be listed in
|
||||||
|
# switch statements to satisfy exhaustiveness
|
||||||
|
ignore-enum-members: ""
|
||||||
|
# consider enums only in package scopes, not in inner scopes
|
||||||
|
package-scope-only: false
|
||||||
|
|
||||||
|
|
||||||
|
forbidigo:
|
||||||
|
# # Forbid the following identifiers (identifiers are written using regexp):
|
||||||
|
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: 220
|
||||||
|
statements: 80
|
||||||
|
|
||||||
|
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
|
||||||
|
# minimal occurrences count to trigger, 3 by default
|
||||||
|
min-occurrences: 3
|
||||||
|
# ignore test files, false by default
|
||||||
|
ignore-tests: false
|
||||||
|
# look for existing constants matching the values, true by default
|
||||||
|
match-constant: true
|
||||||
|
# search also for duplicated numbers, false by default
|
||||||
|
numbers: false
|
||||||
|
# minimum value, only works with goconst.numbers, 3 by default
|
||||||
|
min: 3
|
||||||
|
# maximum value, only works with goconst.numbers, 3 by default
|
||||||
|
max: 3
|
||||||
|
# ignore when constant is not used as function argument, true by default
|
||||||
|
ignore-calls: true
|
||||||
|
|
||||||
|
gocritic:
|
||||||
|
# Which checks should be enabled; can't be combined with 'disabled-checks';
|
||||||
|
# See https://go-critic.github.io/overview#checks-overview
|
||||||
|
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`
|
||||||
|
# By default list of stable checks is used.
|
||||||
|
enabled-checks:
|
||||||
|
#- rangeValCopy
|
||||||
|
- ruleguard
|
||||||
|
|
||||||
|
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
|
||||||
|
disabled-checks:
|
||||||
|
- regexpMust
|
||||||
|
- ifElseChain
|
||||||
|
#- exitAfterDefer
|
||||||
|
|
||||||
|
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
|
||||||
|
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
|
||||||
|
enabled-tags:
|
||||||
|
- performance
|
||||||
|
disabled-tags:
|
||||||
|
- experimental
|
||||||
|
|
||||||
|
# Settings passed to gocritic.
|
||||||
|
# The settings key is the name of a supported gocritic checker.
|
||||||
|
# The list of supported checkers can be find in https://go-critic.github.io/overview.
|
||||||
|
settings:
|
||||||
|
captLocal: # must be valid enabled check name
|
||||||
|
# whether to restrict checker to params only (default true)
|
||||||
|
paramsOnly: true
|
||||||
|
elseif:
|
||||||
|
# whether to skip balanced if-else pairs (default true)
|
||||||
|
skipBalanced: true
|
||||||
|
hugeParam:
|
||||||
|
# size in bytes that makes the warning trigger (default 80)
|
||||||
|
sizeThreshold: 80
|
||||||
|
rangeExprCopy:
|
||||||
|
# size in bytes that makes the warning trigger (default 512)
|
||||||
|
sizeThreshold: 512
|
||||||
|
# whether to check test functions (default true)
|
||||||
|
skipTestFuncs: true
|
||||||
|
rangeValCopy:
|
||||||
|
# size in bytes that makes the warning trigger (default 128)
|
||||||
|
sizeThreshold: 32
|
||||||
|
# whether to check test functions (default true)
|
||||||
|
skipTestFuncs: true
|
||||||
|
ruleguard:
|
||||||
|
# path to a gorules file for the ruleguard checker
|
||||||
|
rules: ''
|
||||||
|
underef:
|
||||||
|
# whether to skip (*x).method() calls where x is a pointer receiver (default true)
|
||||||
|
skipRecvDeref: true
|
||||||
|
|
||||||
|
gocyclo:
|
||||||
|
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||||
|
min-complexity: 30
|
||||||
|
cyclop:
|
||||||
|
# the maximal code complexity to report
|
||||||
|
max-complexity: 50
|
||||||
|
# the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
|
||||||
|
package-average: 0.0
|
||||||
|
# should ignore tests (default false)
|
||||||
|
skip-tests: false
|
||||||
|
godot:
|
||||||
|
# comments to be checked: `declarations`, `toplevel`, or `all`
|
||||||
|
scope: declarations
|
||||||
|
# list of regexps for excluding particular comment lines from check
|
||||||
|
exclude:
|
||||||
|
# example: exclude comments which contain numbers
|
||||||
|
- '[0-9]+'
|
||||||
|
- 'func\s+\w+'
|
||||||
|
- 'FIXME:'
|
||||||
|
- '.*func.*'
|
||||||
|
# check that each sentence starts with a capital letter
|
||||||
|
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
|
||||||
|
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
|
||||||
|
#- TODO
|
||||||
|
- BUG
|
||||||
|
- FIXME
|
||||||
|
#- NOTE
|
||||||
|
- OPTIMIZE # marks code that should be optimized before merging
|
||||||
|
- HACK # marks hack-arounds that should be removed before merging
|
||||||
|
gofmt:
|
||||||
|
# simplify code: gofmt with `-s` option, true by default
|
||||||
|
simplify: true
|
||||||
|
|
||||||
|
gofumpt:
|
||||||
|
# Select the Go version to target. The default is `1.18`.
|
||||||
|
go-version: "1.21"
|
||||||
|
|
||||||
|
# Choose whether or not to use the extra rules that are disabled
|
||||||
|
# by default
|
||||||
|
extra-rules: false
|
||||||
|
|
||||||
|
# goheader:
|
||||||
|
# values:
|
||||||
|
# const:
|
||||||
|
# define here const type values in format k:v, for example:
|
||||||
|
# COMPANY: MY COMPANY
|
||||||
|
# regexp:
|
||||||
|
# define here regexp type values, for example
|
||||||
|
# AUTHOR: .*@mycompany\.com
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# {{ AUTHOR }} {{ COMPANY }} {{ YEAR }}
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
# 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-deploy
|
||||||
|
|
||||||
|
gomnd:
|
||||||
|
# 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
|
||||||
|
# List of allowed `replace` directives. Default is empty.
|
||||||
|
replace-allow-list:
|
||||||
|
- google.golang.org/grpc
|
||||||
|
|
||||||
|
# Allow to not explain why the version has been retracted in the `retract` directives. Default is false.
|
||||||
|
retract-allow-no-explanation: false
|
||||||
|
# Forbid the use of the `exclude` directives. Default is false.
|
||||||
|
exclude-forbidden: false
|
||||||
|
|
||||||
|
gomodguard:
|
||||||
|
allowed:
|
||||||
|
modules:
|
||||||
|
- gorm.io/gen # List of allowed modules
|
||||||
|
- gorm.io/gorm
|
||||||
|
- gorm.io/driver/mysql
|
||||||
|
- k8s.io/klog
|
||||||
|
- github.com/allowed/module
|
||||||
|
- go.mongodb.org/mongo-driver/mongo
|
||||||
|
# - gopkg.in/yaml.v2
|
||||||
|
domains: # List of allowed module domains
|
||||||
|
- google.golang.org
|
||||||
|
- gopkg.in
|
||||||
|
- golang.org
|
||||||
|
- github.com
|
||||||
|
- go.mongodb.org
|
||||||
|
- go.uber.org
|
||||||
|
- openim.io
|
||||||
|
- go.etcd.io
|
||||||
|
blocked:
|
||||||
|
versions:
|
||||||
|
- github.com/MakeNowJust/heredoc:
|
||||||
|
version: "> 2.0.9"
|
||||||
|
reason: "use the latest version"
|
||||||
|
local_replace_directives: false # Set to true to raise lint issues for packages that are loaded from a local path via replace directive
|
||||||
|
|
||||||
|
gosec:
|
||||||
|
# To select a subset of rules to run.
|
||||||
|
# Available rules: https://github.com/securego/gosec#available-rules
|
||||||
|
includes:
|
||||||
|
- G401
|
||||||
|
- G306
|
||||||
|
- G101
|
||||||
|
# To specify a set of rules to explicitly exclude.
|
||||||
|
# Available rules: https://github.com/securego/gosec#available-rules
|
||||||
|
excludes:
|
||||||
|
- G204
|
||||||
|
# Exclude generated files
|
||||||
|
exclude-generated: true
|
||||||
|
# Filter out the issues with a lower severity than the given value. Valid options are: low, medium, high.
|
||||||
|
severity: "low"
|
||||||
|
# Filter out the issues with a lower confidence than the given value. Valid options are: low, medium, high.
|
||||||
|
confidence: "low"
|
||||||
|
# To specify the configuration of rules.
|
||||||
|
# The configuration of rules is not fully documented by gosec:
|
||||||
|
# https://github.com/securego/gosec#configuration
|
||||||
|
# https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102
|
||||||
|
config:
|
||||||
|
G306: "0600"
|
||||||
|
G101:
|
||||||
|
pattern: "(?i)example"
|
||||||
|
ignore_entropy: false
|
||||||
|
entropy_threshold: "80.0"
|
||||||
|
per_char_threshold: "3.0"
|
||||||
|
truncate: "32"
|
||||||
|
|
||||||
|
gosimple:
|
||||||
|
# Select the Go version to target. The default is '1.13'.
|
||||||
|
go: "1.20"
|
||||||
|
# https://staticcheck.io/docs/options#checks
|
||||||
|
checks: [ "all" ]
|
||||||
|
|
||||||
|
govet:
|
||||||
|
# settings per analyzer
|
||||||
|
settings:
|
||||||
|
printf: # analyzer name, run `go tool vet help` to see all analyzers
|
||||||
|
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
|
||||||
|
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
|
||||||
|
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
|
||||||
|
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
|
||||||
|
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
|
||||||
|
|
||||||
|
# enable or disable analyzers by name
|
||||||
|
enable:
|
||||||
|
- atomicalign
|
||||||
|
enable-all: false
|
||||||
|
disable:
|
||||||
|
- shadow
|
||||||
|
disable-all: false
|
||||||
|
|
||||||
|
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-deploy/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-deploy/blob/main/docs/contrib/error-code.md"
|
||||||
|
|
||||||
|
importas:
|
||||||
|
# if set to `true`, force to use alias.
|
||||||
|
no-unaliased: true
|
||||||
|
# List of aliases
|
||||||
|
alias:
|
||||||
|
# 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
|
||||||
|
# You can specify the package path by regular expression,
|
||||||
|
# and alias by regular expression expansion syntax like below.
|
||||||
|
# see https://github.com/julz/importas#use-regular-expression for details
|
||||||
|
- pkg: knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+)
|
||||||
|
alias: $1$2
|
||||||
|
|
||||||
|
ireturn:
|
||||||
|
# ireturn allows using `allow` and `reject` settings at the same time.
|
||||||
|
# Both settings are lists of the keywords and regular expressions matched to interface or package names.
|
||||||
|
# keywords:
|
||||||
|
# - `empty` for `interface{}`
|
||||||
|
# - `error` for errors
|
||||||
|
# - `stdlib` for standard library
|
||||||
|
# - `anon` for anonymous interfaces
|
||||||
|
|
||||||
|
# By default, it allows using errors, empty interfaces, anonymous interfaces,
|
||||||
|
# and interfaces provided by the standard library.
|
||||||
|
allow:
|
||||||
|
- anon
|
||||||
|
- error
|
||||||
|
- empty
|
||||||
|
- stdlib
|
||||||
|
# You can specify idiomatic endings for interface
|
||||||
|
- (or|er)$
|
||||||
|
|
||||||
|
# Reject patterns
|
||||||
|
reject:
|
||||||
|
- github.com\/user\/package\/v4\.Type
|
||||||
|
|
||||||
|
lll:
|
||||||
|
# max line length, lines longer will be reported. Default is 250.
|
||||||
|
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
||||||
|
line-length: 250
|
||||||
|
# tab width in spaces. Default to 1.
|
||||||
|
tab-width: 4
|
||||||
|
misspell:
|
||||||
|
# Correct spellings using locale preferences for US or UK.
|
||||||
|
# Default is to use a neutral variety of English.
|
||||||
|
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
|
||||||
|
locale: US
|
||||||
|
ignore-words:
|
||||||
|
- someword
|
||||||
|
nakedret:
|
||||||
|
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
||||||
|
max-func-lines: 30
|
||||||
|
|
||||||
|
nestif:
|
||||||
|
# minimal complexity of if statements to report, 5 by default
|
||||||
|
min-complexity: 4
|
||||||
|
|
||||||
|
nilnil:
|
||||||
|
# By default, nilnil checks all returned types below.
|
||||||
|
checked-types:
|
||||||
|
- ptr
|
||||||
|
- func
|
||||||
|
- iface
|
||||||
|
- map
|
||||||
|
- chan
|
||||||
|
|
||||||
|
nlreturn:
|
||||||
|
# size of the block (including return statement that is still "OK")
|
||||||
|
# so no return split required.
|
||||||
|
block-size: 1
|
||||||
|
|
||||||
|
nolintlint:
|
||||||
|
# Disable to ensure that all nolint directives actually have an effect. Default is true.
|
||||||
|
allow-unused: false
|
||||||
|
# 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.
|
||||||
|
require-explanation: false
|
||||||
|
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
|
||||||
|
require-specific: true
|
||||||
|
|
||||||
|
prealloc:
|
||||||
|
# XXX: we don't recommend using this linter before doing performance profiling.
|
||||||
|
# For most programs usage of prealloc will be a premature optimization.
|
||||||
|
|
||||||
|
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
|
||||||
|
# True by default.
|
||||||
|
simple: true
|
||||||
|
range-loops: true # Report preallocation suggestions on range loops, true by default
|
||||||
|
for-loops: false # Report preallocation suggestions on for loops, false by default
|
||||||
|
|
||||||
|
promlinter:
|
||||||
|
# Promlinter cannot infer all metrics name in static analysis.
|
||||||
|
# Enable strict mode will also include the errors caused by failing to parse the args.
|
||||||
|
strict: false
|
||||||
|
# Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
|
||||||
|
disabled-linters:
|
||||||
|
- "Help"
|
||||||
|
- "MetricUnits"
|
||||||
|
- "Counter"
|
||||||
|
- "HistogramSummaryReserved"
|
||||||
|
- "MetricTypeInName"
|
||||||
|
- "ReservedChars"
|
||||||
|
- "CamelCase"
|
||||||
|
|
||||||
|
predeclared:
|
||||||
|
# comma-separated list of predeclared identifiers to not report on
|
||||||
|
ignore: ""
|
||||||
|
# include method names and field names (i.e., qualified names) in checks
|
||||||
|
q: false
|
||||||
|
rowserrcheck:
|
||||||
|
packages:
|
||||||
|
- github.com/jmoiron/sqlx
|
||||||
|
|
||||||
|
revive:
|
||||||
|
# see https://github.com/mgechev/revive#available-rules for details.
|
||||||
|
ignore-generated-header: true
|
||||||
|
severity: warning
|
||||||
|
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.20"
|
||||||
|
# https://staticcheck.io/docs/options#checks
|
||||||
|
checks: [ "all" ]
|
||||||
|
|
||||||
|
stylecheck:
|
||||||
|
# Select the Go version to target. The default is '1.13'.
|
||||||
|
go: "1.20"
|
||||||
|
|
||||||
|
# https://staticcheck.io/docs/options#checks
|
||||||
|
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
|
||||||
|
# https://staticcheck.io/docs/options#dot_import_whitelist
|
||||||
|
dot-import-whitelist:
|
||||||
|
- fmt
|
||||||
|
# https://staticcheck.io/docs/options#initialisms
|
||||||
|
initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS" ]
|
||||||
|
# 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:
|
||||||
|
# use the struct field name to check the name of the struct tag
|
||||||
|
use-field-name: true
|
||||||
|
rules:
|
||||||
|
# any struct tag type can be used.
|
||||||
|
# support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
|
||||||
|
json: camel
|
||||||
|
yaml: camel
|
||||||
|
xml: camel
|
||||||
|
bson: camel
|
||||||
|
avro: snake
|
||||||
|
mapstructure: kebab
|
||||||
|
|
||||||
|
testpackage:
|
||||||
|
# regexp pattern to skip files
|
||||||
|
skip-regexp: (id|export|internal)_test\.go
|
||||||
|
thelper:
|
||||||
|
# The following configurations enable all checks. It can be omitted because all checks are enabled by default.
|
||||||
|
# You can enable only required checks deleting unnecessary checks.
|
||||||
|
test:
|
||||||
|
first: true
|
||||||
|
name: true
|
||||||
|
begin: true
|
||||||
|
benchmark:
|
||||||
|
first: true
|
||||||
|
name: true
|
||||||
|
begin: true
|
||||||
|
tb:
|
||||||
|
first: true
|
||||||
|
name: true
|
||||||
|
begin: true
|
||||||
|
|
||||||
|
tenv:
|
||||||
|
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
|
||||||
|
# By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
|
||||||
|
all: false
|
||||||
|
|
||||||
|
unparam:
|
||||||
|
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
|
||||||
|
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
|
||||||
|
# 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:
|
||||||
|
# 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.
|
||||||
|
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
|
||||||
|
|
||||||
|
wrapcheck:
|
||||||
|
# An array of strings that specify substrings of signatures to ignore.
|
||||||
|
# If this set, it will override the default set of ignored signatures.
|
||||||
|
# See https://github.com/tomarrell/wrapcheck#configuration for more information.
|
||||||
|
ignoreSigs:
|
||||||
|
- .Errorf(
|
||||||
|
- errors.New(
|
||||||
|
- errors.Unwrap(
|
||||||
|
- .Wrap(
|
||||||
|
- .WrapMsg(
|
||||||
|
- .Wrapf(
|
||||||
|
- .WithMessage(
|
||||||
|
- .WithMessagef(
|
||||||
|
- .WithStack(
|
||||||
|
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
|
||||||
|
# matching variables, fields or types on line above. Default is true.
|
||||||
|
strict-append: true
|
||||||
|
# Allow calls and assignments to be cuddled as long as the lines have any
|
||||||
|
# matching variables, fields or types. Default is true.
|
||||||
|
allow-assign-and-call: true
|
||||||
|
# Allow assignments to be cuddled with anything. Default is false.
|
||||||
|
allow-assign-and-anything: false
|
||||||
|
# Allow multiline assignments to be cuddled. Default is true.
|
||||||
|
allow-multiline-assign: true
|
||||||
|
# Allow declarations (var) to be cuddled.
|
||||||
|
allow-cuddle-declarations: false
|
||||||
|
# Allow trailing comments in ending of blocks
|
||||||
|
allow-trailing-comment: false
|
||||||
|
# Force newlines in end of case at this limit (0 = never).
|
||||||
|
force-case-trailing-whitespace: 0
|
||||||
|
# Force cuddling of err checks with err var assignment
|
||||||
|
force-err-cuddling: false
|
||||||
|
# Allow leading comments to be separated with empty liens
|
||||||
|
allow-separated-leading-comment: false
|
||||||
|
makezero:
|
||||||
|
# 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:
|
||||||
|
# Each custom linter should have a unique name.
|
||||||
|
#example:
|
||||||
|
# The path to the plugin *.so. Can be absolute or local. Required for each custom linter
|
||||||
|
#path: /path/to/example.so
|
||||||
|
# The description of the linter. Optional, just for documentation purposes.
|
||||||
|
#description: This is an example usage of a plugin linter.
|
||||||
|
# Intended to point to the repo location of the linter. Optional, just for documentation purposes.
|
||||||
|
#original-url: github.com/golangci/example-linter
|
||||||
|
|
||||||
|
linters:
|
||||||
|
# please, do not use `enable-all`: it's deprecated and will be removed soon.
|
||||||
|
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||||
|
# enable-all: true
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
- typecheck # Basic type checking
|
||||||
|
- gofmt # Format check
|
||||||
|
- govet # Go's standard linting tool
|
||||||
|
- gosimple # Suggestions for simplifying code
|
||||||
|
- errcheck
|
||||||
|
- decorder
|
||||||
|
- ineffassign
|
||||||
|
- forbidigo
|
||||||
|
- revive
|
||||||
|
- reassign
|
||||||
|
- tparallel
|
||||||
|
- unconvert
|
||||||
|
- fieldalignment
|
||||||
|
- dupl
|
||||||
|
- dupword
|
||||||
|
- errname
|
||||||
|
- gci
|
||||||
|
- exhaustive
|
||||||
|
- gocritic
|
||||||
|
- goprintffuncname
|
||||||
|
- gomnd
|
||||||
|
- goconst
|
||||||
|
- gosec
|
||||||
|
- misspell # Spelling mistakes
|
||||||
|
- staticcheck # Static analysis
|
||||||
|
- unused # Checks for unused code
|
||||||
|
# - goimports # Checks if imports are correctly sorted and formatted
|
||||||
|
- godot # Checks for comment punctuation
|
||||||
|
- bodyclose # Ensures HTTP response body is closed
|
||||||
|
- stylecheck # Style checker for Go code
|
||||||
|
- unused # Checks for unused code
|
||||||
|
- errcheck # Checks for missed error returns
|
||||||
|
fast: true
|
||||||
|
|
||||||
|
issues:
|
||||||
|
# List of regexps of issue texts to exclude, empty list by default.
|
||||||
|
# But independently from this option we use default exclude patterns,
|
||||||
|
# it can be disabled by `exclude-use-default: false`. To list all
|
||||||
|
# excluded by default patterns execute `golangci-lint run --help`
|
||||||
|
exclude:
|
||||||
|
- tools/.*
|
||||||
|
- test/.*
|
||||||
|
- components/*
|
||||||
|
- third_party/.*
|
||||||
|
|
||||||
|
# Excluding configuration per-path, per-linter, per-text and per-source
|
||||||
|
exclude-rules:
|
||||||
|
- linters:
|
||||||
|
- revive
|
||||||
|
path: (log/.*)\.go
|
||||||
|
|
||||||
|
- linters:
|
||||||
|
- wrapcheck
|
||||||
|
path: (cmd/.*|pkg/.*)\.go
|
||||||
|
|
||||||
|
- linters:
|
||||||
|
- typecheck
|
||||||
|
#path: (pkg/storage/.*)\.go
|
||||||
|
path: (internal/.*|pkg/.*)\.go
|
||||||
|
|
||||||
|
- path: (cmd/.*|test/.*|tools/.*|internal/pump/pumps/.*)\.go
|
||||||
|
linters:
|
||||||
|
- forbidigo
|
||||||
|
|
||||||
|
- path: (cmd/[a-z]*/.*|store/.*)\.go
|
||||||
|
linters:
|
||||||
|
- dupl
|
||||||
|
|
||||||
|
- linters:
|
||||||
|
- gocritic
|
||||||
|
text: (hugeParam:|rangeValCopy:)
|
||||||
|
|
||||||
|
- path: (cmd/[a-z]*/.*)\.go
|
||||||
|
linters:
|
||||||
|
- lll
|
||||||
|
|
||||||
|
- path: (validator/.*|code/.*|validator/.*|watcher/watcher/.*)
|
||||||
|
linters:
|
||||||
|
- gochecknoinits
|
||||||
|
|
||||||
|
- path: (internal/.*/options|internal/pump|pkg/log/options.go|internal/authzserver|tools/)
|
||||||
|
linters:
|
||||||
|
- tagliatelle
|
||||||
|
|
||||||
|
- path: (pkg/app/.*)\.go
|
||||||
|
linters:
|
||||||
|
- unused
|
||||||
|
- forbidigo
|
||||||
|
|
||||||
|
# Exclude some staticcheck messages
|
||||||
|
- linters:
|
||||||
|
- staticcheck
|
||||||
|
text: "SA9003:"
|
||||||
|
|
||||||
|
# Exclude lll issues for long lines with go:generate
|
||||||
|
- linters:
|
||||||
|
- lll
|
||||||
|
source: "^//go:generate "
|
||||||
|
|
||||||
|
- text: ".*[\u4e00-\u9fa5]+.*"
|
||||||
|
linters:
|
||||||
|
- golint
|
||||||
|
source: "^//.*$"
|
||||||
|
|
||||||
|
# Independently from option `exclude` we use default exclude patterns,
|
||||||
|
# it can be disabled by this option. To list all
|
||||||
|
# excluded by default patterns execute `golangci-lint run --help`.
|
||||||
|
# Default value for this option is true.
|
||||||
|
exclude-use-default: true
|
||||||
|
|
||||||
|
# The default value is false. If set to true exclude and exclude-rules
|
||||||
|
# regular expressions become case sensitive.
|
||||||
|
exclude-case-sensitive: false
|
||||||
|
|
||||||
|
# The list of ids of default excludes to include or disable. By default it's empty.
|
||||||
|
include:
|
||||||
|
- EXC0002 # disable excluding of issues about comments from golint
|
||||||
|
|
||||||
|
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
|
||||||
|
max-issues-per-linter: 0
|
||||||
|
|
||||||
|
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
|
||||||
|
max-same-issues: 0
|
||||||
|
|
||||||
|
# Show only new issues: if there are unstaged changes or untracked files,
|
||||||
|
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
|
||||||
|
# It's a super-useful option for integration of golangci-lint into existing
|
||||||
|
# large codebase. It's not practical to fix all existing issues at the moment
|
||||||
|
# of integration: much better don't allow issues in new code.
|
||||||
|
# Default is false.
|
||||||
|
new: false
|
||||||
|
|
||||||
|
# Show only new issues created after git revision `REV`
|
||||||
|
# new-from-rev: REV
|
||||||
|
|
||||||
|
# Show only new issues created in git patch with set file path.
|
||||||
|
#new-from-patch: path/to/patch/file
|
||||||
|
|
||||||
|
# Fix found issues (if it's supported by the linter)
|
||||||
|
fix: true
|
||||||
|
|
||||||
|
severity:
|
||||||
|
# Default value is empty string.
|
||||||
|
# Set the default severity for issues. If severity rules are defined and the issues
|
||||||
|
# do not match or no severity is provided to the rule this will be the default
|
||||||
|
# severity applied. Severities should match the supported severity names of the
|
||||||
|
# selected out format.
|
||||||
|
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
|
||||||
|
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
|
||||||
|
# - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
|
||||||
|
default-severity: error
|
||||||
|
|
||||||
|
# The default value is false.
|
||||||
|
# If set to true severity-rules regular expressions become case sensitive.
|
||||||
|
case-sensitive: false
|
||||||
|
|
||||||
|
# Default value is empty list.
|
||||||
|
# When a list of severity rules are provided, severity information will be added to lint
|
||||||
|
# issues. Severity rules have the same filtering capability as exclude rules except you
|
||||||
|
# are allowed to specify one matcher per severity rule.
|
||||||
|
# Only affects out formats that support setting severity information.
|
||||||
|
rules:
|
||||||
|
- linters:
|
||||||
|
- dupl
|
||||||
|
severity: info
|
||||||
1
CHANGELOG.md
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
CHANGELOG/CHANGELOG.md
|
||||||
70
CHANGELOG/CHANGELOG-3.8.md
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
## [v3.8.3-patch.6](https://github.com/openimsdk/open-im-server-deploy/releases/tag/v3.8.3-patch.6) (2025-07-23)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
* fix: Add friend DB in notification sender [#3438](https://github.com/openimsdk/open-im-server-deploy/pull/3438)
|
||||||
|
* fix: remove update version file workflows have new line in 3.8.3-patch branch. [#3452](https://github.com/openimsdk/open-im-server-deploy/pull/3452)
|
||||||
|
* fix: s3 aws init [#3454](https://github.com/openimsdk/open-im-server-deploy/pull/3454)
|
||||||
|
* fix: use safe submodule init in workflows in v3.8.3-patch. [#3469](https://github.com/openimsdk/open-im-server-deploy/pull/3469)
|
||||||
|
|
||||||
|
**Full Changelog**: [v3.8.3-patch.5...v3.8.3-patch.6](https://github.com/openimsdk/open-im-server-deploy/compare/v3.8.3-patch.5...v3.8.3-patch.6)
|
||||||
|
|
||||||
|
## [v3.8.3-patch.5](https://github.com/openimsdk/open-im-server-deploy/releases/tag/v3.8.3-patch.5) (2025-06-10)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
* feat: optimize friend and group applications [#3396](https://github.com/openimsdk/open-im-server-deploy/pull/3396)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
* fix: solve unocrrect invite notification [Created [#3219](https://github.com/openimsdk/open-im-server-deploy/pull/3219)
|
||||||
|
|
||||||
|
### Builds
|
||||||
|
* build: update gomake version in dockerfile.[Patch branch] [#3416](https://github.com/openimsdk/open-im-server-deploy/pull/3416)
|
||||||
|
|
||||||
|
**Full Changelog**: [v3.8.3...v3.8.3-patch.5](https://github.com/openimsdk/open-im-server-deploy/compare/v3.8.3...v3.8.3-patch.5)
|
||||||
|
|
||||||
|
## [v3.8.3-patch.4](https://github.com/openimsdk/open-im-server-deploy/releases/tag/v3.8.3-patch.4) (2025-03-13)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
* fix: solve unocrrect invite notificationfrom #3213
|
||||||
|
|
||||||
|
**Full Changelog**: [v3.8.3-patch.3...v3.8.3-patch.4](https://github.com/openimsdk/open-im-server-deploy/compare/v3.8.3-patch.3...v3.8.3-patch.4)
|
||||||
|
|
||||||
|
## [v3.8.3-patch.3](https://github.com/openimsdk/open-im-server-deploy/releases/tag/v3.8.3-patch.3) (2025-03-07)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
* feat: optimizing BatchGetIncrementalGroupMember #3180
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
* fix: solve uncorrect notification when set group info #3172
|
||||||
|
* fix: the sorting is wrong after canceling the administrator in group settings #3185
|
||||||
|
* fix: solve uncorrect GroupMember enter group notification type. #3188
|
||||||
|
|
||||||
|
### Refactors
|
||||||
|
* refactor: change sendNotification to sendMessage to avoid ambiguity regarding message sending behavior. #3173
|
||||||
|
|
||||||
|
**Full Changelog**: [v3.8.3-patch.2...v3.8.3-patch.3](https://github.com/openimsdk/open-im-server-deploy/compare/v3.8.3-patch.2...v3.8.3-patch.3)
|
||||||
|
|
||||||
|
## [v3.8.3-patch.2](https://github.com/openimsdk/open-im-server-deploy/releases/tag/v3.8.3-patch.2) (2025-02-28)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
* fix: Offline push does not have a badge && Android offline push (#3146) [#3174](https://github.com/openimsdk/open-im-server-deploy/pull/3174)
|
||||||
|
|
||||||
|
**Full Changelog**: [v3.8.3-patch.1...v3.8.3-patch.2](https://github.com/openimsdk/open-im-server-deploy/compare/v3.8.3-patch.1...v3.8.3-patch.2)
|
||||||
|
|
||||||
|
## [v3.8.3-patch.1](https://github.com/openimsdk/open-im-server-deploy/releases/tag/v3.8.3-patch.1) (2025-02-25)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
* feat: add backup volume && optimize log print [Created [#3121](https://github.com/openimsdk/open-im-server-deploy/pull/3121)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
* fix: seq conversion failed without exiting [Created [#3120](https://github.com/openimsdk/open-im-server-deploy/pull/3120)
|
||||||
|
* fix: check error in BatchSetTokenMapByUidPid [Created [#3123](https://github.com/openimsdk/open-im-server-deploy/pull/3123)
|
||||||
|
* fix: DeleteDoc crash [Created [#3124](https://github.com/openimsdk/open-im-server-deploy/pull/3124)
|
||||||
|
* fix: the abnormal message has no sending time, causing the SDK to be abnormal [Created [#3126](https://github.com/openimsdk/open-im-server-deploy/pull/3126)
|
||||||
|
* fix: crash caused [#3127](https://github.com/openimsdk/open-im-server-deploy/pull/3127)
|
||||||
|
* fix: the user sets the conversation timer cleanup timestamp unit incorrectly [Created [#3128](https://github.com/openimsdk/open-im-server-deploy/pull/3128)
|
||||||
|
* fix: seq conversion not reading env in docker environment [Created [#3131](https://github.com/openimsdk/open-im-server-deploy/pull/3131)
|
||||||
|
|
||||||
|
### Builds
|
||||||
|
* build: improve workflows contents. [Created [#3125](https://github.com/openimsdk/open-im-server-deploy/pull/3125)
|
||||||
|
|
||||||
|
**Full Changelog**: [v3.8.3-e-v1.1.5...v3.8.3-patch.1-e-v1.1.5](https://github.com/openimsdk/open-im-server-deploy-enterprise/compare/v3.8.3-e-v1.1.5...v3.8.3-patch.1-e-v1.1.5)
|
||||||
4
CHANGELOG/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# CHANGELOGs
|
||||||
|
|
||||||
|
- [CHANGELOG-3.8.md](./CHANGELOG-3.8.md)
|
||||||
|
|
||||||
128
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
* Demonstrating empathy and kindness toward other people
|
||||||
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
* Giving and gracefully accepting constructive feedback
|
||||||
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery, and sexual attention or
|
||||||
|
advances of any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or email
|
||||||
|
address, without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
`security@openim.io`.
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.0, available at
|
||||||
|
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
|
enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
https://www.contributor-covenant.org/faq. Translations are available at
|
||||||
|
https://www.contributor-covenant.org/translations.
|
||||||
96
CONTRIBUTING-zh_CN.md
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# 如何给 OpenIM 贡献代码(提交 Pull Request)
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./CONTRIBUTING.md">English</a> ·
|
||||||
|
<a href="./CONTRIBUTING-zh_CN.md">中文</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-UA.md">Українська</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-CS.md">Česky</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-HU.md">Magyar</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-ES.md">Español</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-FA.md">فارسی</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-FR.md">Français</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-DE.md">Deutsch</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-PL.md">Polski</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-ID.md">Indonesian</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-FI.md">Suomi</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-ML.md">മലയാളം</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-JP.md">日本語</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-NL.md">Nederlands</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-IT.md">Italiano</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-RU.md">Русский</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-PTBR.md">Português (Brasil)</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-EO.md">Esperanto</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-KR.md">한국어</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-AR.md">العربي</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-VN.md">Tiếng Việt</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-DA.md">Dansk</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-GR.md">Ελληνικά</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-TR.md">Türkçe</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
本指南将以 [openimsdk/open-im-server-deploy](https://github.com/openimsdk/open-im-server-deploy) 为例,详细说明如何为 OpenIM 项目贡献代码。我们采用“一问题一分支”的策略,确保每个 Issue 都对应一个专门的分支,以便有效管理代码变更。
|
||||||
|
|
||||||
|
### 1. Fork 仓库
|
||||||
|
前往 [openimsdk/open-im-server-deploy](https://github.com/openimsdk/open-im-server-deploy) GitHub 页面,点击右上角的 "Fork" 按钮,将仓库 Fork 到你的 GitHub 账户下。
|
||||||
|
|
||||||
|
### 2. 克隆仓库
|
||||||
|
将你 Fork 的仓库克隆到本地:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/your-username/open-im-server-deploy.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 设置远程上游
|
||||||
|
添加原始仓库为远程上游以便跟踪其更新:
|
||||||
|
```bash
|
||||||
|
git remote add upstream https://github.com/openimsdk/open-im-server-deploy.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
|
||||||
|
```
|
||||||
|
|
||||||
|
### 编程规范
|
||||||
|
请参考以下文档以了解关于 Go 语言编程规范的详细信息:
|
||||||
|
- [Go 编码规范](https://github.com/openimsdk/open-im-server-deploy/blob/main/docs/contrib/go-code.md)
|
||||||
|
- [代码约定](https://github.com/openimsdk/open-im-server-deploy/blob/main/docs/contrib/code-conventions.md)
|
||||||
|
|
||||||
|
### 日志规范
|
||||||
|
- **禁止使用标准的 `log` 包**。
|
||||||
|
- 应使用 `"github.com/openimsdk/tools/log"` 包来打印日志,该包支持多种日志级别:`debug`、`info`、`warn`、`error`。
|
||||||
|
- **错误日志应仅在首次调用的函数中打印**,以防止日志重复,并确保错误的上下文清晰。
|
||||||
|
|
||||||
|
### 异常及错误处理
|
||||||
|
- **禁止使用 `panic`**:程序中不应使用 `panic`,以避免在遇到不可恢复的错误时突然终止。
|
||||||
|
- **错误包裹**:使用 `"github.com/openimsdk/tools/errs"` 来包裹错误,保持错误信息的完整性并增加调试便利。
|
||||||
|
- **错误传递**:如果函数本身不能处理错误,应将错误返回给调用者,而不是隐藏或忽略这些错误。
|
||||||
94
CONTRIBUTING.md
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# How to Contribute to OpenIM (Submitting Pull Requests)
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./CONTRIBUTING.md">English</a> ·
|
||||||
|
<a href="./CONTRIBUTING-zh_CN.md">中文</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-UA.md">Українська</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-CS.md">Česky</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-HU.md">Magyar</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-ES.md">Español</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-FA.md">فارسی</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-FR.md">Français</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-DE.md">Deutsch</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-PL.md">Polski</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-ID.md">Indonesian</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-FI.md">Suomi</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-ML.md">മലയാളം</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-JP.md">日本語</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-NL.md">Nederlands</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-IT.md">Italiano</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-RU.md">Русский</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-PTBR.md">Português (Brasil)</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-EO.md">Esperanto</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-KR.md">한국어</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-AR.md">العربي</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-VN.md">Tiếng Việt</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-DA.md">Dansk</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-GR.md">Ελληνικά</a> ·
|
||||||
|
<a href="docs/contributing/CONTRIBUTING-TR.md">Türkçe</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
This guide will use [openimsdk/open-im-server-deploy](https://github.com/openimsdk/open-im-server-deploy) as an example to explain in detail how to contribute code to the OpenIM project. We adopt a "one issue, one branch" strategy to ensure each issue corresponds to a dedicated branch for effective code change management.
|
||||||
|
|
||||||
|
### 1. Fork the Repository
|
||||||
|
Go to the [openimsdk/open-im-server-deploy](https://github.com/openimsdk/open-im-server-deploy) 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 repository you forked to your local machine:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/your-username/open-im-server-deploy.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Set Upstream Remote
|
||||||
|
Add the original repository as a remote upstream to track updates:
|
||||||
|
```bash
|
||||||
|
git remote add upstream https://github.com/openimsdk/open-im-server-deploy.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Create an Issue
|
||||||
|
Create a new issue in the original repository detailing the problem you encountered or the new feature you wish to add.
|
||||||
|
|
||||||
|
### 5. Create a New Branch
|
||||||
|
Create a new branch off the main branch with a descriptive name and Issue ID, for example:
|
||||||
|
```bash
|
||||||
|
git checkout -b fix-bug-123
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. Commit Changes
|
||||||
|
After making changes on your local branch, commit these changes:
|
||||||
|
```bash
|
||||||
|
git add .
|
||||||
|
git commit -m "Describe your changes
|
||||||
|
|
||||||
|
in detail"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. Push the Branch
|
||||||
|
Push your branch back to your GitHub fork:
|
||||||
|
```bash
|
||||||
|
git push origin fix-bug-123
|
||||||
|
```
|
||||||
|
|
||||||
|
### 8. Create a Pull Request
|
||||||
|
Go to your fork on GitHub and click the "Pull Request" button. Ensure the PR description is clear and links to the related issue.
|
||||||
|
|
||||||
|
### 9. Sign the CLA
|
||||||
|
If this is your first time submitting a PR, you will need to reply in the comments of the PR:
|
||||||
|
```
|
||||||
|
I have read the CLA Document and I hereby sign the CLA
|
||||||
|
```
|
||||||
|
|
||||||
|
### Programming Standards
|
||||||
|
Please refer to the following documents for detailed information on Go language programming standards:
|
||||||
|
- [Go Coding Standards](https://github.com/openimsdk/open-im-server-deploy/blob/main/docs/contrib/go-code.md)
|
||||||
|
- [Code Conventions](https://github.com/openimsdk/open-im-server-deploy/blob/main/docs/contrib/code-conventions.md)
|
||||||
|
|
||||||
|
### Logging Standards
|
||||||
|
- **Do not use the standard `log` package**.
|
||||||
|
- Use the `"github.com/openimsdk/tools/log"` package for logging, which supports multiple log levels: `debug`, `info`, `warn`, `error`.
|
||||||
|
- **Error logs should only be printed in the function where they are first actively called** to prevent log duplication and ensure clear error context.
|
||||||
|
|
||||||
|
### Exception and Error Handling
|
||||||
|
- **Prohibit the use of `panic`**: The code should not use `panic` to avoid abrupt termination when encountering unrecoverable errors.
|
||||||
|
- **Error Wrapping**: Use `"github.com/openimsdk/tools/errs"` to wrap errors, maintaining the integrity of error information and facilitating debugging.
|
||||||
|
- **Error Propagation**: If a function cannot handle an error itself, it should return the error to the caller, rather than hiding or ignoring it.
|
||||||
49
Dockerfile
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# 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 . .
|
||||||
|
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
|
# Optionally build your application if needed
|
||||||
|
RUN mage build
|
||||||
|
|
||||||
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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.15-alpha.1
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
||||||
201
LICENSE
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
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.
|
||||||
140
README.md
@@ -1,2 +1,140 @@
|
|||||||
# open-im-server-deploy
|
<p align="center">
|
||||||
|
<a href="https://openim.io">
|
||||||
|
<img src="./assets/logo-gif/openim-logo.gif" width="60%" height="30%"/>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
[](https://github.com/openimsdk/open-im-server-deploy/stargazers)
|
||||||
|
[](https://github.com/openimsdk/open-im-server-deploy/network/members)
|
||||||
|
[](https://app.codecov.io/gh/openimsdk/open-im-server-deploy)
|
||||||
|
[](https://goreportcard.com/report/github.com/openimsdk/open-im-server-deploy)
|
||||||
|
[](https://pkg.go.dev/git.imall.cloud/openim/open-im-server-deploy)
|
||||||
|
[](https://github.com/openimsdk/open-im-server-deploy/blob/main/LICENSE)
|
||||||
|
[](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
|
||||||
|
[](https://www.bestpractices.dev/projects/8045)
|
||||||
|
[](https://github.com/openimsdk/open-im-server-deploy/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22)
|
||||||
|
[](https://golang.org/)
|
||||||
|
[](https://gurubase.io/g/openim)
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./README.md">English</a> ·
|
||||||
|
<a href="./README_zh_CN.md">中文</a> ·
|
||||||
|
<a href="./docs/readme/README_uk.md">Українська</a> ·
|
||||||
|
<a href="./docs/readme/README_cs.md">Česky</a> ·
|
||||||
|
<a href="./docs/readme/README_hu.md">Magyar</a> ·
|
||||||
|
<a href="./docs/readme/README_es.md">Español</a> ·
|
||||||
|
<a href="./docs/readme/README_fa.md">فارسی</a> ·
|
||||||
|
<a href="./docs/readme/README_fr.md">Français</a> ·
|
||||||
|
<a href="./docs/readme/README_de.md">Deutsch</a> ·
|
||||||
|
<a href="./docs/readme/README_pl.md">Polski</a> ·
|
||||||
|
<a href="./docs/readme/README_id.md">Indonesian</a> ·
|
||||||
|
<a href="./docs/readme/README_fi.md">Suomi</a> ·
|
||||||
|
<a href="./docs/readme/README_ml.md">മലയാളം</a> ·
|
||||||
|
<a href="./docs/readme/README_ja.md">日本語</a> ·
|
||||||
|
<a href="./docs/readme/README_nl.md">Nederlands</a> ·
|
||||||
|
<a href="./docs/readme/README_it.md">Italiano</a> ·
|
||||||
|
<a href="./docs/readme/README_ru.md">Русский</a> ·
|
||||||
|
<a href="./docs/readme/README_pt_BR.md">Português (Brasil)</a> ·
|
||||||
|
<a href="./docs/readme/README_eo.md">Esperanto</a> ·
|
||||||
|
<a href="./docs/readme/README_ko.md">한국어</a> ·
|
||||||
|
<a href="./docs/readme/README_ar.md">العربي</a> ·
|
||||||
|
<a href="./docs/readme/README_vi.md">Tiếng Việt</a> ·
|
||||||
|
<a href="./docs/readme/README_da.md">Dansk</a> ·
|
||||||
|
<a href="./docs/readme/README_el.md">Ελληνικά</a> ·
|
||||||
|
<a href="./docs/readme/README_tr.md">Türkçe</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## :busts_in_silhouette: Join Our Community
|
||||||
|
|
||||||
|
- 💬 [Follow us on Twitter](https://twitter.com/founder_im63606)
|
||||||
|
- 🚀 [Join our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
|
||||||
|
- :eyes: [Join our WeChat Group](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
|
||||||
|
|
||||||
|
## Ⓜ️ About OpenIM
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 🚀 Introduction to OpenIMSDK
|
||||||
|
|
||||||
|
**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
|
||||||
|
|
||||||
|
- 📚 Main Modules:
|
||||||
|
1. 🚀 Initialization and Login
|
||||||
|
2. 👤 User Management
|
||||||
|
3. 👫 Friends Management
|
||||||
|
4. 🤖 Group Functions
|
||||||
|
5. 💬 Session Handling
|
||||||
|
|
||||||
|
Built with Golang and supports cross-platform deployment to ensure a consistent integration experience across all platforms.
|
||||||
|
|
||||||
|
👉 **[Explore the GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
||||||
|
|
||||||
|
## 🌐 Introduction to OpenIMServer
|
||||||
|
|
||||||
|
- **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.
|
||||||
|
|
||||||
|
### Enhanced Business Functions:
|
||||||
|
|
||||||
|
- **REST API**: Provides a REST API for business systems to enhance functionality, such as group creation and message pushing through backend interfaces.
|
||||||
|
|
||||||
|
- **Webhooks**: Expands business forms through callbacks, sending requests to business servers before or after certain events.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## :rocket: Quick Start
|
||||||
|
|
||||||
|
Experience online for iOS/Android/H5/PC/Web:
|
||||||
|
|
||||||
|
👉 **[OpenIM Online Demo](https://www.openim.io/en/commercial)**
|
||||||
|
|
||||||
|
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)**
|
||||||
|
|
||||||
|
## System Support
|
||||||
|
|
||||||
|
Supports Linux, Windows, Mac systems, and ARM and AMD CPU architectures.
|
||||||
|
|
||||||
|
## :link: Links
|
||||||
|
|
||||||
|
- **[Developer Manual](https://docs.openim.io/)**
|
||||||
|
- **[Changelog](https://github.com/openimsdk/open-im-server-deploy/blob/main/CHANGELOG.md)**
|
||||||
|
|
||||||
|
## :writing_hand: How to Contribute
|
||||||
|
|
||||||
|
We welcome contributions of any kind! Please make sure to read our [Contributor Documentation](https://github.com/openimsdk/open-im-server-deploy/blob/main/CONTRIBUTING.md) before submitting a Pull Request.
|
||||||
|
|
||||||
|
- **[Report a Bug](https://github.com/openimsdk/open-im-server-deploy/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
|
||||||
|
- **[Suggest a Feature](https://github.com/openimsdk/open-im-server-deploy/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
|
||||||
|
- **[Submit a Pull Request](https://github.com/openimsdk/open-im-server-deploy/pulls)**
|
||||||
|
|
||||||
|
Thank you for contributing to building a powerful instant messaging solution!
|
||||||
|
|
||||||
|
## :closed_book: License
|
||||||
|
|
||||||
|
This software is licensed under the Apache License 2.0
|
||||||
|
|
||||||
|
## 🔮 Thanks to our contributors!
|
||||||
|
|
||||||
|
<a href="https://github.com/openimsdk/open-im-server-deploy/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=openimsdk/open-im-server-deploy" />
|
||||||
|
</a>
|
||||||
|
|||||||
139
README_zh_CN.md
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
<p align="center">
|
||||||
|
<a href="https://openim.io">
|
||||||
|
<img src="./assets/logo-gif/openim-logo.gif" width="60%" height="30%"/>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
[](https://github.com/openimsdk/open-im-server-deploy/stargazers)
|
||||||
|
[](https://github.com/openimsdk/open-im-server-deploy/network/members)
|
||||||
|
[](https://app.codecov.io/gh/openimsdk/open-im-server-deploy)
|
||||||
|
[](https://goreportcard.com/report/github.com/openimsdk/open-im-server-deploy)
|
||||||
|
[](https://pkg.go.dev/git.imall.cloud/openim/open-im-server-deploy)
|
||||||
|
[](https://github.com/openimsdk/open-im-server-deploy/blob/main/LICENSE)
|
||||||
|
[](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
|
||||||
|
[](https://www.bestpractices.dev/projects/8045)
|
||||||
|
[](https://github.com/openimsdk/open-im-server-deploy/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22)
|
||||||
|
[](https://golang.org/)
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./README.md">English</a> ·
|
||||||
|
<a href="./README_zh_CN.md">中文</a> ·
|
||||||
|
<a href="./docs/readme/README_uk.md">Українська</a> ·
|
||||||
|
<a href="./docs/readme/README_cs.md">Česky</a> ·
|
||||||
|
<a href="./docs/readme/README_hu.md">Magyar</a> ·
|
||||||
|
<a href="./docs/readme/README_es.md">Español</a> ·
|
||||||
|
<a href="./docs/readme/README_fa.md">فارسی</a> ·
|
||||||
|
<a href="./docs/readme/README_fr.md">Français</a> ·
|
||||||
|
<a href="./docs/readme/README_de.md">Deutsch</a> ·
|
||||||
|
<a href="./docs/readme/README_pl.md">Polski</a> ·
|
||||||
|
<a href="./docs/readme/README_id.md">Indonesian</a> ·
|
||||||
|
<a href="./docs/readme/README_fi.md">Suomi</a> ·
|
||||||
|
<a href="./docs/readme/README_ml.md">മലയാളം</a> ·
|
||||||
|
<a href="./docs/readme/README_ja.md">日本語</a> ·
|
||||||
|
<a href="./docs/readme/README_nl.md">Nederlands</a> ·
|
||||||
|
<a href="./docs/readme/README_it.md">Italiano</a> ·
|
||||||
|
<a href="./docs/readme/README_ru.md">Русский</a> ·
|
||||||
|
<a href="./docs/readme/README_pt_BR.md">Português (Brasil)</a> ·
|
||||||
|
<a href="./docs/readme/README_eo.md">Esperanto</a> ·
|
||||||
|
<a href="./docs/readme/README_ko.md">한국어</a> ·
|
||||||
|
<a href="./docs/readme/README_ar.md">العربي</a> ·
|
||||||
|
<a href="./docs/readme/README_vi.md">Tiếng Việt</a> ·
|
||||||
|
<a href="./docs/readme/README_da.md">Dansk</a> ·
|
||||||
|
<a href="./docs/readme/README_el.md">Ελληνικά</a> ·
|
||||||
|
<a href="./docs/readme/README_tr.md">Türkçe</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## :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
|
||||||
|
|
||||||
|
与 Telegram、Signal、Rocket.Chat 等独立聊天应用不同,OpenIM 提供了专为开发者设计的开源即时通讯解决方案,而不是直接安装使用的独立聊天应用。OpenIM 由 OpenIM SDK 和 OpenIM Server 两大部分组成,为开发者提供了一整套集成即时通讯功能的工具和服务,包括消息发送接收、用户管理和群组管理等。总体来说,OpenIM 旨在为开发者提供必要的工具和框架,帮助他们在自己的应用中实现高效的即时通讯解决方案。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 🚀 OpenIMSDK 介绍
|
||||||
|
|
||||||
|
**OpenIMSDK** 是为 **OpenIMServer** 设计的 IM SDK,专为集成到客户端应用而生。它支持多种功能和模块:
|
||||||
|
|
||||||
|
- 🌟 主要功能:
|
||||||
|
|
||||||
|
- 📦 本地存储
|
||||||
|
- 🔔 监听器回调
|
||||||
|
- 🛡️ API 封装
|
||||||
|
- 🌐 连接管理
|
||||||
|
|
||||||
|
- 📚 主要模块:
|
||||||
|
1. 🚀 初始化及登录
|
||||||
|
2. 👤 用户管理
|
||||||
|
3. 👫 好友管理
|
||||||
|
4. 🤖 群组功能
|
||||||
|
5. 💬 会话处理
|
||||||
|
|
||||||
|
它使用 Golang 构建,并支持跨平台部署,确保在所有平台上提供一致的接入体验。
|
||||||
|
|
||||||
|
👉 **[探索 GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
||||||
|
|
||||||
|
## 🌐 OpenIMServer 介绍
|
||||||
|
|
||||||
|
- **OpenIMServer** 的特点包括:
|
||||||
|
- 🌐 微服务架构:支持集群模式,包括网关(gateway)和多个 rpc 服务。
|
||||||
|
- 🚀 多样的部署方式:支持源代码、Kubernetes 或 Docker 部署。
|
||||||
|
- 海量用户支持:支持十万级超大群组,千万级用户和百亿级消息。
|
||||||
|
|
||||||
|
### 增强的业务功能:
|
||||||
|
|
||||||
|
- **REST API**:为业务系统提供 REST API,增加群组创建、消息推送等后台接口功能。
|
||||||
|
|
||||||
|
- **Webhooks**:通过事件前后的回调,向业务服务器发送请求,扩展更多的业务形态。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## :rocket: 快速入门
|
||||||
|
|
||||||
|
在线体验 iOS/Android/H5/PC/Web:
|
||||||
|
|
||||||
|
👉 **[OpenIM 在线演示](https://www.openim.io/en/commercial)**
|
||||||
|
|
||||||
|
为了便于用户体验,我们提供了多种部署解决方案,您可以根据以下列表选择适合您的部署方式:
|
||||||
|
|
||||||
|
- **[源代码部署指南](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||||
|
- **[Docker 部署指南](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||||
|
|
||||||
|
## 系统支持
|
||||||
|
|
||||||
|
支持 Linux、Windows、Mac 系统以及 ARM 和 AMD CPU 架构。
|
||||||
|
|
||||||
|
## :link: 相关链接
|
||||||
|
|
||||||
|
- **[开发手册](https://docs.openim.io/)**
|
||||||
|
- **[更新日志](https://github.com/openimsdk/open-im-server-deploy/blob/main/CHANGELOG.md)**
|
||||||
|
|
||||||
|
## :writing_hand: 如何贡献
|
||||||
|
|
||||||
|
我们欢迎任何形式的贡献!在提交 Pull Request 之前,请确保阅读我们的[贡献者文档](https://github.com/openimsdk/open-im-server-deploy/blob/main/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
- **[报告 Bug](https://github.com/openimsdk/open-im-server-deploy/issues/new?assignees=&labels=bug&template=bug_report.md&title=)**
|
||||||
|
- **[提出新特性](https://github.com/openimsdk/open-im-server-deploy/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)**
|
||||||
|
- **[提交 Pull Request](https://github.com/openimsdk/open-im-server-deploy/pulls)**
|
||||||
|
|
||||||
|
感谢您的贡献,一起来打造强大的即时通讯解决方案!
|
||||||
|
|
||||||
|
## :closed_book: 开源许可证 License
|
||||||
|
|
||||||
|
This software is licensed under the Apache License 2.0
|
||||||
|
|
||||||
|
## 🔮 Thanks to our contributors!
|
||||||
|
|
||||||
|
<a href="https://github.com/openimsdk/open-im-server-deploy/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=openimsdk/open-im-server-deploy" />
|
||||||
|
</a>
|
||||||
32
assets/README.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# `/assets`
|
||||||
|
|
||||||
|
The `/assets` directory in the OpenIM repository contains various assets such as images, logos, and animated GIFs. These assets serve different purposes and contribute to the functionality and aesthetics of the OpenIM project.
|
||||||
|
|
||||||
|
## Directory Structure:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
assets/
|
||||||
|
├── README.md # Documentation for the assets directory
|
||||||
|
├── images # Directory holding images related to OpenIM
|
||||||
|
│ ├── architecture.png # Image depicting the architecture of OpenIM
|
||||||
|
│ └── mvc.png # Image illustrating the Model-View-Controller (MVC) pattern
|
||||||
|
├── intive-slack.png # Image displaying the Intive Slack logo
|
||||||
|
├── logo # Directory containing various logo variations for OpenIM
|
||||||
|
│ ├── openim-logo-black.png # OpenIM logo with a black background
|
||||||
|
│ ├── openim-logo-blue.png # OpenIM logo with a blue background
|
||||||
|
│ ├── openim-logo-green.png # OpenIM logo with a green background
|
||||||
|
│ ├── openim-logo-purple.png # OpenIM logo with a purple background
|
||||||
|
│ ├── openim-logo-white.png # OpenIM logo with a white background
|
||||||
|
│ ├── openim-logo-yellow.png # OpenIM logo with a yellow background
|
||||||
|
│ └── openim-logo.png # OpenIM logo with a transparent background
|
||||||
|
└── logo-gif # Directory containing animated GIF versions of the OpenIM logo
|
||||||
|
└── openim-log.gif # Animated OpenIM logo with a transparent background
|
||||||
|
```
|
||||||
|
|
||||||
|
## Copyright Notice:
|
||||||
|
|
||||||
|
The OpenIM logo, including its variations and animated versions, displayed in this repository [OpenIM](https://github.com/openimsdk/open-im-server-deploy) under the `/assets/logo` and `/assets/logo-gif` directories, are protected by copyright laws.
|
||||||
|
|
||||||
|
The logo design is credited to @Xx(席欣).
|
||||||
|
|
||||||
|
Please respect the intellectual property rights and refrain from unauthorized use and distribution of these assets.
|
||||||
11
assets/colors.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Official Colors
|
||||||
|
|
||||||
|
The openim logo has an official blue color. When reproducing the logo, please use the official color, when possible.
|
||||||
|
|
||||||
|
## Pantone
|
||||||
|
|
||||||
|
When possible, the Pantone color is preferred for print material. The official Pantone color is *285C*.
|
||||||
|
|
||||||
|
## RGB
|
||||||
|
|
||||||
|
When used digitally, the official RGB color code is *#326CE5*.
|
||||||
14
assets/demo/README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
## :star2: Why OpenIM
|
||||||
|
|
||||||
|
**🔍 Function screenshot display**
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
|
||||||
|
| multiple message | Efficient meetings |
|
||||||
|
| :---------------------------------------: | :---------------------------------------------: |
|
||||||
|
|  |  |
|
||||||
|
| **One-to-one and group chats** | **Special features - Custom messages** |
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
</div>
|
||||||
BIN
assets/demo/efficient-meetings.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
assets/demo/group-chat.png
Normal file
|
After Width: | Height: | Size: 418 KiB |
BIN
assets/demo/hello-openim.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
assets/demo/multi-terminal-synchronization.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
assets/demo/multiple-message.png
Normal file
|
After Width: | Height: | Size: 931 KiB |
BIN
assets/demo/special-function.png
Normal file
|
After Width: | Height: | Size: 318 KiB |
BIN
assets/intive-slack.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
1
assets/logo-gif/LICENSE
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# The OpenIM logo files are licensed under a choice of either Apache-2.0 or CC-BY-4.0 (Creative Commons Attribution 4.0 International).
|
||||||
BIN
assets/logo-gif/openim-logo.gif
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
1
assets/logo/LICENSE
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# The OpenIM logo files are licensed under a choice of either Apache-2.0 or CC-BY-4.0 (Creative Commons Attribution 4.0 International).
|
||||||
BIN
assets/logo/openim-logo-blue.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
assets/logo/openim-logo-cyan.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
assets/logo/openim-logo-gradient.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
assets/logo/openim-logo-green.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
assets/logo/openim-logo-orange.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
assets/logo/openim-logo-purple.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
assets/logo/openim-logo-red.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
assets/logo/openim-logo-yellow.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
assets/logo/openim-logo.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
assets/openim-logo-gradient.pdf
Normal file
1
assets/openim-logo-gradient.svg
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
assets/openim-logo-green.pdf
Normal file
1
assets/openim-logo-green.svg
Normal file
|
After Width: | Height: | Size: 58 KiB |
31
bootstrap.bat
Normal file
@@ -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
|
||||||
23
bootstrap.sh
Normal file
@@ -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
|
||||||
65
build/README.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# Building OpenIM
|
||||||
|
|
||||||
|
Building OpenIM is easy if you take advantage of the containerized build environment. This document will help guide you through understanding this build process.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
1. Docker, using one of the following configurations:
|
||||||
|
* **macOS** Install Docker for Mac. See installation instructions [here](https://docs.docker.com/docker-for-mac/).
|
||||||
|
**Note**: You will want to set the Docker VM to have at least 4GB of initial memory or building will likely fail.
|
||||||
|
* **Linux with local Docker** Install Docker according to the [instructions](https://docs.docker.com/installation/#installation) for your OS.
|
||||||
|
* **Windows with Docker Desktop WSL2 backend** Install Docker according to the [instructions](https://docs.docker.com/docker-for-windows/wsl-tech-preview/). Be sure to store your sources in the local Linux file system, not the Windows remote mount at `/mnt/c`.
|
||||||
|
|
||||||
|
**Note**: You will need to check if Docker CLI plugin buildx is properly installed (`docker-buildx` file should be present in `~/.docker/cli-plugins`). You can install buildx according to the [instructions](https://github.com/docker/buildx/blob/master/README.md#installing).
|
||||||
|
|
||||||
|
2. **Optional** [Google Cloud SDK](https://developers.google.com/cloud/sdk/)
|
||||||
|
|
||||||
|
You must install and configure Google Cloud SDK if you want to upload your release to Google Cloud Storage and may safely omit this otherwise.
|
||||||
|
|
||||||
|
## Actions
|
||||||
|
|
||||||
|
About [Images packages](https://github.com/orgs/OpenIMSDK/packages?repo_name=Open-IM-Server)
|
||||||
|
|
||||||
|
All files in the `build/images` directory are not templated and are instead rendered by Github Actions, which is an automated process.
|
||||||
|
|
||||||
|
Trigger condition:
|
||||||
|
1. create a new tag with the format `vX.Y.Z` (e.g. `v1.0.0`)
|
||||||
|
2. push the tag to the remote repository
|
||||||
|
3. wait for the build to finish
|
||||||
|
4. download the artifacts from the release page
|
||||||
|
|
||||||
|
## Make images
|
||||||
|
|
||||||
|
**help info:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ make image.help
|
||||||
|
```
|
||||||
|
|
||||||
|
**build images:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ make image
|
||||||
|
```
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
While it is possible to build OpenIM using a local golang installation, we have a build process that runs in a Docker container. This simplifies initial set up and provides for a very consistent build and test environment.
|
||||||
|
|
||||||
|
|
||||||
|
## Basic Flow
|
||||||
|
|
||||||
|
The scripts directly under [`build/`](.) are used to build and test. They will ensure that the `openim-build` Docker image is built (based on [`build/build-image/Dockerfile`](../Dockerfile) and after base image's `OPENIM_BUILD_IMAGE_CROSS_TAG` from Dockerfile is replaced with one of those actual tags of the base image, like `v1.13.9-2`) and then execute the appropriate command in that container. These scripts will both ensure that the right data is cached from run to run for incremental builds and will copy the results back out of the container. You can specify a different registry/name and version for `openim-cross` by setting `OPENIM_CROSS_IMAGE` and `OPENIM_CROSS_VERSION`, see [`common.sh`](common.sh) for more details.
|
||||||
|
|
||||||
|
The `openim-build` container image is built by first creating a "context" directory in `_output/images/build-image`. It is done there instead of at the root of the OpenIM repo to minimize the amount of data we need to package up when building the image.
|
||||||
|
|
||||||
|
There are 3 different containers instances that are run from this image. The first is a "data" container to store all data that needs to persist across to support incremental builds. Next there is an "rsync" container that is used to transfer data in and out to the data container. Lastly there is a "build" container that is used for actually doing build actions. The data container persists across runs while the rsync and build containers are deleted after each use.
|
||||||
|
|
||||||
|
`rsync` is used transparently behind the scenes to efficiently move data in and out of the container. This will use an ephemeral port picked by Docker. You can modify this by setting the `OPENIM_RSYNC_PORT` env variable.
|
||||||
|
|
||||||
|
All Docker names are suffixed with a hash derived from the file path (to allow concurrent usage on things like CI machines) and a version number. When the version number changes all state is cleared and clean build is started. This allows the build infrastructure to be changed and signal to CI systems that old artifacts need to be deleted.
|
||||||
|
|
||||||
|
## Build artifacts
|
||||||
|
The build system output all its products to a top level directory in the source repository named `_output`.
|
||||||
|
These include the binary compiled packages (e.g. imctl, openim-api etc.) and archived Docker images.
|
||||||
|
If you intend to run a component with a docker image you will need to import it from this directory with
|
||||||
431
build/goreleaser.yaml
Normal file
@@ -0,0 +1,431 @@
|
|||||||
|
# This is an example .goreleaser.yml file with some sensible defaults.
|
||||||
|
# Make sure to check the documentation at https://goreleaser.com
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- make clean
|
||||||
|
# You may remove this if you don't use go modules.
|
||||||
|
- make tidy
|
||||||
|
- make copyright.add
|
||||||
|
# you may remove this if you don't need go generate
|
||||||
|
- go generate ./...
|
||||||
|
|
||||||
|
git:
|
||||||
|
# What should be used to sort tags when gathering the current and previous
|
||||||
|
# tags if there are more than one tag in the same commit.
|
||||||
|
#
|
||||||
|
# Default: '-version:refname'
|
||||||
|
tag_sort: -version:creatordate
|
||||||
|
|
||||||
|
# What should be used to specify prerelease suffix while sorting tags when gathering
|
||||||
|
# the current and previous tags if there are more than one tag in the same commit.
|
||||||
|
#
|
||||||
|
# Since: v1.17
|
||||||
|
prerelease_suffix: "-"
|
||||||
|
|
||||||
|
# Tags to be ignored by GoReleaser.
|
||||||
|
# This means that GoReleaser will not pick up tags that match any of the
|
||||||
|
# provided values as either previous or current tags.
|
||||||
|
#
|
||||||
|
# Templates: allowed.
|
||||||
|
# Since: v1.21.
|
||||||
|
ignore_tags:
|
||||||
|
- nightly
|
||||||
|
# - "{{.Env.IGNORE_TAG}}"
|
||||||
|
|
||||||
|
snapshot:
|
||||||
|
name_template: "{{ incpatch .Version }}-next"
|
||||||
|
|
||||||
|
# gomod:
|
||||||
|
# proxy: true
|
||||||
|
|
||||||
|
report_sizes: true
|
||||||
|
|
||||||
|
# metadata:
|
||||||
|
# mod_timestamp: "{{ .CommitTimestamp }}"
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- binary: openim-api
|
||||||
|
id: openim-api
|
||||||
|
main: ./cmd/openim-api/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-cmdutils
|
||||||
|
id: openim-cmdutils
|
||||||
|
main: ./cmd/openim-cmdutils/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-crontask
|
||||||
|
id: openim-crontask
|
||||||
|
main: ./cmd/openim-crontask/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-msggateway
|
||||||
|
id: openim-msggateway
|
||||||
|
main: ./cmd/openim-msggateway/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-msgtransfer
|
||||||
|
id: openim-msgtransfer
|
||||||
|
main: ./cmd/openim-msgtransfer/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-push
|
||||||
|
id: openim-push
|
||||||
|
main: ./cmd/openim-push/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-rpc-auth
|
||||||
|
id: openim-rpc-auth
|
||||||
|
main: ./cmd/openim-rpc/openim-rpc-auth/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-rpc-conversation
|
||||||
|
id: openim-rpc-conversation
|
||||||
|
main: ./cmd/openim-rpc/openim-rpc-conversation/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-rpc-friend
|
||||||
|
id: openim-rpc-friend
|
||||||
|
main: ./cmd/openim-rpc/openim-rpc-friend/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-rpc-group
|
||||||
|
id: openim-rpc-group
|
||||||
|
main: ./cmd/openim-rpc/openim-rpc-group/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-rpc-msg
|
||||||
|
id: openim-rpc-msg
|
||||||
|
main: ./cmd/openim-rpc/openim-rpc-msg/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-rpc-third
|
||||||
|
id: openim-rpc-third
|
||||||
|
main: ./cmd/openim-rpc/openim-rpc-third/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
- binary: openim-rpc-user
|
||||||
|
id: openim-rpc-user
|
||||||
|
main: ./cmd/openim-rpc/openim-rpc-user/main.go
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- linux
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
|
||||||
|
|
||||||
|
# TODO:Need a script, such as the init - release to help binary to find the right directory
|
||||||
|
# ,which can be compiled binary
|
||||||
|
archives:
|
||||||
|
- format: tar.gz
|
||||||
|
# this name template makes the OS and Arch compatible with the results of uname.
|
||||||
|
name_template: >-
|
||||||
|
{{ .ProjectName }}_
|
||||||
|
{{- title .Os }}_
|
||||||
|
{{- if eq .Arch "amd64" }}x86_64
|
||||||
|
{{- else if eq .Arch "386" }}i386
|
||||||
|
{{- else }}{{ .Arch }}{{ end }}
|
||||||
|
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||||
|
|
||||||
|
# Set this to true if you want all files in the archive to be in a single directory.
|
||||||
|
# If set to true and you extract the archive 'goreleaser_Linux_arm64.tar.gz',
|
||||||
|
# you'll get a folder 'goreleaser_Linux_arm64'.
|
||||||
|
# If set to false, all files are extracted separately.
|
||||||
|
# You can also set it to a custom folder name (templating is supported).
|
||||||
|
wrap_in_directory: true
|
||||||
|
|
||||||
|
# use zip for windows archives
|
||||||
|
files:
|
||||||
|
- CHANGELOG/*
|
||||||
|
- deployment/*
|
||||||
|
- config/*
|
||||||
|
- build/*
|
||||||
|
- scripts/*
|
||||||
|
- Makefile
|
||||||
|
- install.sh
|
||||||
|
- docs/*
|
||||||
|
- src: "*.md"
|
||||||
|
dst: docs
|
||||||
|
|
||||||
|
# Strip parent folders when adding files to the archive.
|
||||||
|
strip_parent: true
|
||||||
|
|
||||||
|
# File info.
|
||||||
|
# Not all fields are supported by all formats available formats.
|
||||||
|
#
|
||||||
|
# Default: copied from the source file
|
||||||
|
info:
|
||||||
|
# Templates: allowed (since v1.14)
|
||||||
|
owner: root
|
||||||
|
|
||||||
|
# Templates: allowed (since v1.14)
|
||||||
|
group: root
|
||||||
|
|
||||||
|
# Must be in time.RFC3339Nano format.
|
||||||
|
#
|
||||||
|
# Templates: allowed (since v1.14)
|
||||||
|
mtime: "{{ .CommitDate }}"
|
||||||
|
|
||||||
|
# File mode.
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
format: zip
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
sort: asc
|
||||||
|
use: github
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- "^test:"
|
||||||
|
- "^chore"
|
||||||
|
- "merge conflict"
|
||||||
|
- Merge pull request
|
||||||
|
- Merge remote-tracking branch
|
||||||
|
- Merge branch
|
||||||
|
- go mod tidy
|
||||||
|
groups:
|
||||||
|
- title: Dependency updates
|
||||||
|
regexp: '^.*?(feat|fix)\(deps\)!?:.+$'
|
||||||
|
order: 300
|
||||||
|
- title: "New Features"
|
||||||
|
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
|
||||||
|
order: 100
|
||||||
|
- title: "Security updates"
|
||||||
|
regexp: '^.*?sec(\([[:word:]]+\))??!?:.+$'
|
||||||
|
order: 150
|
||||||
|
- title: "Bug fixes"
|
||||||
|
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
|
||||||
|
order: 200
|
||||||
|
- title: "Documentation updates"
|
||||||
|
regexp: ^.*?doc(\([[:word:]]+\))??!?:.+$
|
||||||
|
order: 400
|
||||||
|
- title: "Build process updates"
|
||||||
|
regexp: ^.*?build(\([[:word:]]+\))??!?:.+$
|
||||||
|
order: 400
|
||||||
|
- title: Other work
|
||||||
|
order: 9999
|
||||||
|
|
||||||
|
# dockers:
|
||||||
|
# - image_templates:
|
||||||
|
# - "openimsdk/open-im-server-deploy:{{ .Tag }}-amd64"
|
||||||
|
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-amd64"
|
||||||
|
# dockerfile: build/images/openim-api/Dockerfile.release
|
||||||
|
# ids:
|
||||||
|
# - openim-api
|
||||||
|
# use: buildx
|
||||||
|
# build_flag_templates:
|
||||||
|
# - "--pull"
|
||||||
|
# - "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/openimsdk/open-im-server-deploy/main/README.md"
|
||||||
|
# - "--label=io.artifacthub.package.logo-url=hhttps://github.com/openimsdk/open-im-server-deploy/blob/main/assets/logo/openim-logo-green.png"
|
||||||
|
# - '--label=io.artifacthub.package.maintainers=[{"name":"Xinwei Xiong","email":"3293172751nss@gmail.com"}]'
|
||||||
|
# - "--label=io.artifacthub.package.license=Apace-2.0"
|
||||||
|
# - "--label=org.opencontainers.image.description=OpenIM Open source top instant messaging system"
|
||||||
|
# - "--label=org.opencontainers.image.created={{.Date}}"
|
||||||
|
# - "--label=org.opencontainers.image.name={{.ProjectName}}"
|
||||||
|
# - "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||||
|
# - "--label=org.opencontainers.image.version={{.Version}}"
|
||||||
|
# - "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||||
|
# - "--platform=linux/amd64"
|
||||||
|
# extra_files:
|
||||||
|
# - scripts/entrypoint.sh
|
||||||
|
# - image_templates:
|
||||||
|
# - "goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||||
|
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||||
|
# dockerfile: build/images/openim-api/Dockerfile.release
|
||||||
|
# use: buildx
|
||||||
|
# build_flag_templates:
|
||||||
|
# - "--pull"
|
||||||
|
# - "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/openimsdk/open-im-server-deploy/main/README.md"
|
||||||
|
# - "--label=io.artifacthub.package.logo-url=hhttps://github.com/openimsdk/open-im-server-deploy/blob/main/assets/logo/openim-logo-green.png"
|
||||||
|
# - '--label=io.artifacthub.package.maintainers=[{"name":"Xinwei Xiong","email":"3293172751nss@gmail.com"}]'
|
||||||
|
# - "--label=io.artifacthub.package.license=Apace-2.0"
|
||||||
|
# - "--label=org.opencontainers.image.description=OpenIM Open source top instant messaging system"
|
||||||
|
# - "--label=org.opencontainers.image.created={{.Date}}"
|
||||||
|
# - "--label=org.opencontainers.image.name={{.ProjectName}}"
|
||||||
|
# - "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||||
|
# - "--label=org.opencontainers.image.version={{.Version}}"
|
||||||
|
# - "--label=org.opencontainers.image.source={{.GitURL}}"
|
||||||
|
# - "--platform=linux/arm64"
|
||||||
|
# goarch: arm64
|
||||||
|
# extra_files:
|
||||||
|
# - scripts/entrypoint.sh
|
||||||
|
|
||||||
|
# docker_manifests:
|
||||||
|
# - name_template: "goreleaser/goreleaser:{{ .Tag }}"
|
||||||
|
# image_templates:
|
||||||
|
# - "goreleaser/goreleaser:{{ .Tag }}-amd64"
|
||||||
|
# - "goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||||
|
# - name_template: "ghcr.io/goreleaser/goreleaser:{{ .Tag }}"
|
||||||
|
# image_templates:
|
||||||
|
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-amd64"
|
||||||
|
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||||
|
# - name_template: "goreleaser/goreleaser:latest"
|
||||||
|
# image_templates:
|
||||||
|
# - "goreleaser/goreleaser:{{ .Tag }}-amd64"
|
||||||
|
# - "goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||||
|
# - name_template: "ghcr.io/goreleaser/goreleaser:latest"
|
||||||
|
# image_templates:
|
||||||
|
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-amd64"
|
||||||
|
# - "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-arm64"
|
||||||
|
|
||||||
|
nfpms:
|
||||||
|
- id: packages
|
||||||
|
builds:
|
||||||
|
- openim-api
|
||||||
|
- openim-cmdutils
|
||||||
|
- openim-crontask
|
||||||
|
- openim-msggateway
|
||||||
|
- openim-msgtransfer
|
||||||
|
- openim-push
|
||||||
|
- openim-rpc-auth
|
||||||
|
- openim-rpc-conversation
|
||||||
|
- openim-rpc-friend
|
||||||
|
- openim-rpc-group
|
||||||
|
- openim-rpc-msg
|
||||||
|
- openim-rpc-third
|
||||||
|
- openim-rpc-user
|
||||||
|
# Your app's vendor.
|
||||||
|
vendor: OpenIMSDK
|
||||||
|
homepage: https://github.com/openimsdk/open-im-server-deploy
|
||||||
|
maintainer: kubbot <https://github.com/kubbot>
|
||||||
|
description: |-
|
||||||
|
Auto sync github labels
|
||||||
|
kubbot && openimbot
|
||||||
|
license: MIT
|
||||||
|
formats:
|
||||||
|
- apk
|
||||||
|
- deb
|
||||||
|
- rpm
|
||||||
|
- termux.deb # Since: v1.11
|
||||||
|
- archlinux # Since: v1.13
|
||||||
|
dependencies:
|
||||||
|
- git
|
||||||
|
recommends:
|
||||||
|
- golang
|
||||||
|
|
||||||
|
|
||||||
|
# The lines beneath this are called `modelines`. See `:help modeline`
|
||||||
|
# Feel free to remove those if you don't want/use them.
|
||||||
|
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||||
|
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||||
|
|
||||||
|
# Default: './dist'
|
||||||
|
dist: ./_output/dist
|
||||||
|
|
||||||
|
# .goreleaser.yaml
|
||||||
|
milestones:
|
||||||
|
# You can have multiple milestone configs
|
||||||
|
-
|
||||||
|
# Repository for the milestone
|
||||||
|
# Default is extracted from the origin remote URL
|
||||||
|
repo:
|
||||||
|
owner: OpenIMSDK
|
||||||
|
name: Open-IM-Server
|
||||||
|
|
||||||
|
# Whether to close the milestone
|
||||||
|
close: true
|
||||||
|
|
||||||
|
# Fail release on errors, such as missing milestone.
|
||||||
|
fail_on_error: false
|
||||||
|
|
||||||
|
# Name of the milestone
|
||||||
|
#
|
||||||
|
# Default: '{{ .Tag }}'
|
||||||
|
name_template: "Current Release"
|
||||||
|
|
||||||
|
# publishers:
|
||||||
|
# - name: "fury.io"
|
||||||
|
# ids:
|
||||||
|
# - packages
|
||||||
|
# dir: "{{ dir .ArtifactPath }}"
|
||||||
|
# cmd: |
|
||||||
|
# bash -c '
|
||||||
|
# if [[ "{{ .Tag }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
# curl -F package=@{{ .ArtifactName }} https://{{ .Env.FURY_TOKEN }}@push.fury.io/{{ .Env.USERNAME }}/
|
||||||
|
# else
|
||||||
|
# echo "Skipping deployment: Non-production release detected"
|
||||||
|
# fi'
|
||||||
|
|
||||||
|
checksum:
|
||||||
|
name_template: "{{ .ProjectName }}_checksums.txt"
|
||||||
|
algorithm: sha256
|
||||||
|
|
||||||
|
release:
|
||||||
|
prerelease: auto
|
||||||
24
build/images/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# # 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.
|
||||||
|
|
||||||
|
# FROM BASE_IMAGE
|
||||||
|
|
||||||
|
# WORKDIR ${SERVER_WORKDIR}
|
||||||
|
|
||||||
|
# # Set HTTP proxy
|
||||||
|
# ARG BINARY_NAME
|
||||||
|
|
||||||
|
# COPY BINARY_NAME ./bin/BINARY_NAME
|
||||||
|
|
||||||
|
# ENTRYPOINT ["./bin/BINARY_NAME"]
|
||||||
42
build/images/openim-api/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory first (must be before COPY . . to avoid conflicts)
|
||||||
|
# This copies protocol to /protocol, which is ../protocol relative to SERVER_DIR
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN echo "执行 go mod tidy..." && go mod tidy || (echo "go mod tidy 失败" && exit 1)
|
||||||
|
|
||||||
|
RUN echo "开始编译 openim-api..." && \
|
||||||
|
go build -v -o _output/openim-api ./cmd/openim-api || \
|
||||||
|
(echo "编译失败,查看详细错误信息" && exit 1)
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-api"]
|
||||||
42
build/images/openim-crontask/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN go build -o _output/openim-crontask ./cmd/openim-crontask
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-crontask"]
|
||||||
43
build/images/openim-msggateway/Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory first (must be before COPY . . to avoid conflicts)
|
||||||
|
# This copies protocol to /protocol, which is ../protocol relative to SERVER_DIR
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN echo "执行 go mod tidy..." && go mod tidy || (echo "go mod tidy 失败" && exit 1)
|
||||||
|
|
||||||
|
RUN echo "开始编译 openim-msggateway..." && \
|
||||||
|
go build -v -o _output/openim-msggateway ./cmd/openim-msggateway || \
|
||||||
|
(echo "编译失败,查看详细错误信息" && exit 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-msggateway"]
|
||||||
43
build/images/openim-msgtransfer/Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory first (must be before COPY . . to avoid conflicts)
|
||||||
|
# This copies protocol to /protocol, which is ../protocol relative to SERVER_DIR
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN echo "执行 go mod tidy..." && go mod tidy || (echo "go mod tidy 失败" && exit 1)
|
||||||
|
|
||||||
|
RUN echo "开始编译 openim-msgtransfer..." && \
|
||||||
|
go build -v -o _output/openim-msgtransfer ./cmd/openim-msgtransfer || \
|
||||||
|
(echo "编译失败,查看详细错误信息" && exit 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-msgtransfer"]
|
||||||
43
build/images/openim-push/Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory first (must be before COPY . . to avoid conflicts)
|
||||||
|
# This copies protocol to /protocol, which is ../protocol relative to SERVER_DIR
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN echo "执行 go mod tidy..." && go mod tidy || (echo "go mod tidy 失败" && exit 1)
|
||||||
|
|
||||||
|
RUN echo "开始编译 openim-push..." && \
|
||||||
|
go build -v -o _output/openim-push ./cmd/openim-push || \
|
||||||
|
(echo "编译失败,查看详细错误信息" && exit 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-push"]
|
||||||
42
build/images/openim-rpc-auth/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN go build -o _output/openim-rpc-auth ./cmd/openim-rpc/openim-rpc-auth
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-auth"]
|
||||||
42
build/images/openim-rpc-conversation/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN go build -o _output/openim-rpc-conversation ./cmd/openim-rpc/openim-rpc-conversation
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-conversation"]
|
||||||
42
build/images/openim-rpc-friend/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN go build -o _output/openim-rpc-friend ./cmd/openim-rpc/openim-rpc-friend
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-friend"]
|
||||||
42
build/images/openim-rpc-group/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN go build -o _output/openim-rpc-group ./cmd/openim-rpc/openim-rpc-group
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-group"]
|
||||||
64
build/images/openim-rpc-msg/Dockerfile
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git, build tools and dependencies for Quirc
|
||||||
|
RUN apk add --no-cache git ca-certificates build-base make gcc musl-dev pkgconfig
|
||||||
|
|
||||||
|
# Build and install Quirc library (static library)
|
||||||
|
RUN cd /tmp && \
|
||||||
|
git clone --depth 1 https://github.com/dlbeer/quirc.git && \
|
||||||
|
cd quirc && \
|
||||||
|
sed -i 's/\$(shell pkg-config --cflags sdl 2>&1)/\$(shell pkg-config --cflags sdl 2>\/dev\/null || true)/g' Makefile && \
|
||||||
|
sed -i 's/\$(shell pkg-config --libs sdl)/\$(shell pkg-config --libs sdl 2>\/dev\/null || true)/g' Makefile && \
|
||||||
|
sed -i 's/\$(shell pkg-config --cflags opencv4 2>&1)/\$(shell pkg-config --cflags opencv4 2>\/dev\/null || true)/g' Makefile && \
|
||||||
|
sed -i 's/\$(shell pkg-config --libs opencv4)/\$(shell pkg-config --libs opencv4 2>\/dev\/null || true)/g' Makefile && \
|
||||||
|
make libquirc.a && \
|
||||||
|
mkdir -p /usr/local/lib /usr/local/include && \
|
||||||
|
cp libquirc.a /usr/local/lib/ && \
|
||||||
|
cp lib/quirc.h /usr/local/include/ && \
|
||||||
|
ls -la /usr/local/lib/libquirc.a /usr/local/include/quirc.h && \
|
||||||
|
rm -rf /tmp/quirc
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
ENV CGO_ENABLED=1
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
# Build with static linking for Quirc (静态链接,运行时无需库文件)
|
||||||
|
# 使用 -ldflags 强制静态链接 Quirc 库和数学库
|
||||||
|
# 注意:Alpine Linux 使用 musl libc,需要静态链接数学库
|
||||||
|
RUN go build -tags cgo \
|
||||||
|
-ldflags '-linkmode external -extldflags "-static -L/usr/local/lib -lquirc -lm"' \
|
||||||
|
-o _output/openim-rpc-msg ./cmd/openim-rpc/openim-rpc-msg && \
|
||||||
|
echo "构建完成,验证二进制文件..." && \
|
||||||
|
file _output/openim-rpc-msg && \
|
||||||
|
ldd _output/openim-rpc-msg 2>&1 | head -5 || echo "静态链接验证:二进制文件不依赖动态库(这是正常的)"
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-msg"]
|
||||||
42
build/images/openim-rpc-third/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN go build -o _output/openim-rpc-third ./cmd/openim-rpc/openim-rpc-third
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-third"]
|
||||||
40
build/images/openim-rpc-user/Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
|
||||||
|
# Install git for repository access
|
||||||
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# Copy protocol directory
|
||||||
|
COPY protocol /protocol
|
||||||
|
|
||||||
|
# Copy current directory
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
RUN go build -o _output/openim-rpc-user ./cmd/openim-rpc/openim-rpc-user
|
||||||
|
|
||||||
|
|
||||||
|
# Using Alpine Linux for the final image
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-user"]
|
||||||
108
build/images/openim-tools/component/Dockerfile
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# # 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
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
# WORKDIR /openim/openim-server
|
||||||
|
|
||||||
|
#
|
||||||
|
# ENV GOPROXY=$GOPROXY
|
||||||
|
|
||||||
|
# COPY go.mod go.sum ./
|
||||||
|
# RUN go mod download
|
||||||
|
|
||||||
|
# COPY . .
|
||||||
|
|
||||||
|
# RUN make clean
|
||||||
|
# RUN make build BINS=component
|
||||||
|
|
||||||
|
# # FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||||
|
# FROM ghcr.io/openim-sigs/openim-bash-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/config /openim/openim-server/config
|
||||||
|
|
||||||
|
# ENV OPENIM_SERVER_CONFIG_NAME=/openim/openim-server/config
|
||||||
|
|
||||||
|
# RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/component /usr/bin/component
|
||||||
|
|
||||||
|
# ENTRYPOINT ["bash", "-c", "component -c $OPENIM_SERVER_CONFIG_NAME"]
|
||||||
|
|
||||||
|
|
||||||
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
|
FROM golang:1.22-alpine AS builder
|
||||||
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
|
# 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 . .
|
||||||
|
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
|
# ENV BINS=openim-rpc-user
|
||||||
|
|
||||||
|
# Optionally build your application if needed
|
||||||
|
# RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
RUN mage build check-free-memory seq || true
|
||||||
|
|
||||||
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add bash
|
||||||
|
|
||||||
|
# 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 echo -e "serviceBinaries:\n \n" \
|
||||||
|
> $SERVER_DIR/start-config.yml && \
|
||||||
|
echo -e "toolBinaries:\n - check-free-memory\n - seq\n" >> $SERVER_DIR/start-config.yml && \
|
||||||
|
echo "maxFileDescriptors: 10000" >> $SERVER_DIR/start-config.yml
|
||||||
|
|
||||||
|
RUN go get github.com/openimsdk/gomake@v0.0.15-alpha.1
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
||||||
406
cmd/main.go
Normal file
@@ -0,0 +1,406 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/api"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/msggateway"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/msgtransfer"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/push"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/rpc/auth"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/rpc/conversation"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/rpc/group"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/rpc/msg"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/rpc/relation"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/rpc/third"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/rpc/user"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/internal/tools/cron"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/config"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/prommetrics"
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/version"
|
||||||
|
"github.com/mitchellh/mapstructure"
|
||||||
|
"github.com/openimsdk/tools/discovery"
|
||||||
|
"github.com/openimsdk/tools/discovery/standalone"
|
||||||
|
"github.com/openimsdk/tools/log"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
"github.com/openimsdk/tools/utils/datautil"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
config.SetStandalone()
|
||||||
|
prommetrics.RegistryAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var configPath string
|
||||||
|
flag.StringVar(&configPath, "c", "", "config path")
|
||||||
|
flag.Parse()
|
||||||
|
if configPath == "" {
|
||||||
|
_, _ = fmt.Fprintln(os.Stderr, "config path is empty")
|
||||||
|
os.Exit(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
cmd := newCmds(configPath)
|
||||||
|
putCmd(cmd, false, auth.Start)
|
||||||
|
putCmd(cmd, false, conversation.Start)
|
||||||
|
putCmd(cmd, false, relation.Start)
|
||||||
|
putCmd(cmd, false, group.Start)
|
||||||
|
putCmd(cmd, false, msg.Start)
|
||||||
|
putCmd(cmd, false, third.Start)
|
||||||
|
putCmd(cmd, false, user.Start)
|
||||||
|
putCmd(cmd, false, push.Start)
|
||||||
|
putCmd(cmd, true, msggateway.Start)
|
||||||
|
putCmd(cmd, true, msgtransfer.Start)
|
||||||
|
putCmd(cmd, true, api.Start)
|
||||||
|
putCmd(cmd, true, cron.Start)
|
||||||
|
ctx := context.Background()
|
||||||
|
if err := cmd.run(ctx); err != nil {
|
||||||
|
_, _ = fmt.Fprintf(os.Stderr, "server exit %s", err)
|
||||||
|
os.Exit(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func newCmds(confPath string) *cmds {
|
||||||
|
return &cmds{confPath: confPath}
|
||||||
|
}
|
||||||
|
|
||||||
|
type cmdName struct {
|
||||||
|
Name string
|
||||||
|
Func func(ctx context.Context) error
|
||||||
|
Block bool
|
||||||
|
}
|
||||||
|
type cmds struct {
|
||||||
|
confPath string
|
||||||
|
cmds []cmdName
|
||||||
|
config config.AllConfig
|
||||||
|
conf map[string]reflect.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmds) getTypePath(typ reflect.Type) string {
|
||||||
|
return path.Join(typ.PkgPath(), typ.Name())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmds) initDiscovery() {
|
||||||
|
x.config.Discovery.Enable = "standalone"
|
||||||
|
vof := reflect.ValueOf(&x.config.Discovery.RpcService).Elem()
|
||||||
|
tof := reflect.TypeOf(&x.config.Discovery.RpcService).Elem()
|
||||||
|
num := tof.NumField()
|
||||||
|
for i := 0; i < num; i++ {
|
||||||
|
field := tof.Field(i)
|
||||||
|
if !field.IsExported() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if field.Type.Kind() != reflect.String {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
vof.Field(i).SetString(field.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmds) initAllConfig() error {
|
||||||
|
x.conf = make(map[string]reflect.Value)
|
||||||
|
vof := reflect.ValueOf(&x.config).Elem()
|
||||||
|
num := vof.NumField()
|
||||||
|
for i := 0; i < num; i++ {
|
||||||
|
field := vof.Field(i)
|
||||||
|
for ptr := true; ptr; {
|
||||||
|
if field.Kind() == reflect.Ptr {
|
||||||
|
field = field.Elem()
|
||||||
|
} else {
|
||||||
|
ptr = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.conf[x.getTypePath(field.Type())] = field
|
||||||
|
val := field.Addr().Interface()
|
||||||
|
name := val.(interface{ GetConfigFileName() string }).GetConfigFileName()
|
||||||
|
confData, err := os.ReadFile(filepath.Join(x.confPath, name))
|
||||||
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
v := viper.New()
|
||||||
|
v.SetConfigType("yaml")
|
||||||
|
if err := v.ReadConfig(bytes.NewReader(confData)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
opt := func(conf *mapstructure.DecoderConfig) {
|
||||||
|
conf.TagName = config.StructTagName
|
||||||
|
}
|
||||||
|
if err := v.Unmarshal(val, opt); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x.initDiscovery()
|
||||||
|
x.config.Redis.Disable = false
|
||||||
|
x.config.LocalCache = config.LocalCache{}
|
||||||
|
config.InitNotification(&x.config.Notification)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmds) parseConf(conf any) error {
|
||||||
|
vof := reflect.ValueOf(conf)
|
||||||
|
for {
|
||||||
|
if vof.Kind() == reflect.Ptr {
|
||||||
|
vof = vof.Elem()
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tof := vof.Type()
|
||||||
|
numField := vof.NumField()
|
||||||
|
for i := 0; i < numField; i++ {
|
||||||
|
typeField := tof.Field(i)
|
||||||
|
if !typeField.IsExported() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
field := vof.Field(i)
|
||||||
|
pkt := x.getTypePath(field.Type())
|
||||||
|
val, ok := x.conf[pkt]
|
||||||
|
if !ok {
|
||||||
|
switch field.Interface().(type) {
|
||||||
|
case config.Index:
|
||||||
|
case config.Path:
|
||||||
|
field.SetString(x.confPath)
|
||||||
|
case config.AllConfig:
|
||||||
|
field.Set(reflect.ValueOf(x.config))
|
||||||
|
case *config.AllConfig:
|
||||||
|
field.Set(reflect.ValueOf(&x.config))
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("config field %s %s not found", vof.Type().Name(), typeField.Name)
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
field.Set(val)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmds) add(name string, block bool, fn func(ctx context.Context) error) {
|
||||||
|
x.cmds = append(x.cmds, cmdName{Name: name, Block: block, Func: fn})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmds) initLog() error {
|
||||||
|
conf := x.config.Log
|
||||||
|
if err := log.InitLoggerFromConfig(
|
||||||
|
"openim-server",
|
||||||
|
program.GetProcessName(),
|
||||||
|
"", "",
|
||||||
|
conf.RemainLogLevel,
|
||||||
|
conf.IsStdout,
|
||||||
|
conf.IsJson,
|
||||||
|
conf.StorageLocation,
|
||||||
|
conf.RemainRotationCount,
|
||||||
|
conf.RotationTime,
|
||||||
|
strings.TrimSpace(version.Version),
|
||||||
|
conf.IsSimplify,
|
||||||
|
); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmds) run(ctx context.Context) error {
|
||||||
|
if len(x.cmds) == 0 {
|
||||||
|
return fmt.Errorf("no command to run")
|
||||||
|
}
|
||||||
|
if err := x.initAllConfig(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := x.initLog(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithCancelCause(ctx)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
<-ctx.Done()
|
||||||
|
log.ZError(ctx, "context server exit cause", context.Cause(ctx))
|
||||||
|
}()
|
||||||
|
|
||||||
|
if prometheus := x.config.API.Prometheus; prometheus.Enable {
|
||||||
|
var (
|
||||||
|
port int
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if !prometheus.AutoSetPorts {
|
||||||
|
port, err = datautil.GetElemByIndex(prometheus.Ports, 0)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("prometheus listen %d error %w", port, err)
|
||||||
|
}
|
||||||
|
defer listener.Close()
|
||||||
|
log.ZDebug(ctx, "prometheus start", "addr", listener.Addr())
|
||||||
|
go func() {
|
||||||
|
err := prommetrics.Start(listener)
|
||||||
|
if err == nil {
|
||||||
|
err = fmt.Errorf("http done")
|
||||||
|
}
|
||||||
|
cancel(fmt.Errorf("prometheus %w", err))
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
sigs := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(sigs, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case val := <-sigs:
|
||||||
|
log.ZDebug(ctx, "recv signal", "signal", val.String())
|
||||||
|
cancel(fmt.Errorf("signal %s", val.String()))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
for i := range x.cmds {
|
||||||
|
cmd := x.cmds[i]
|
||||||
|
if cmd.Block {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if err := cmd.Func(ctx); err != nil {
|
||||||
|
cancel(fmt.Errorf("server %s exit %w", cmd.Name, err))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
if cmd.Block {
|
||||||
|
cancel(fmt.Errorf("server %s exit", cmd.Name))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
var wait cmdManger
|
||||||
|
for i := range x.cmds {
|
||||||
|
cmd := x.cmds[i]
|
||||||
|
if !cmd.Block {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
wait.Start(cmd.Name)
|
||||||
|
go func() {
|
||||||
|
defer wait.Shutdown(cmd.Name)
|
||||||
|
if err := cmd.Func(ctx); err != nil {
|
||||||
|
cancel(fmt.Errorf("server %s exit %w", cmd.Name, err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
cancel(fmt.Errorf("server %s exit", cmd.Name))
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
<-ctx.Done()
|
||||||
|
exitCause := context.Cause(ctx)
|
||||||
|
log.ZWarn(ctx, "notification of service closure", exitCause)
|
||||||
|
done := wait.Wait()
|
||||||
|
timeout := time.NewTimer(time.Second * 10)
|
||||||
|
defer timeout.Stop()
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-timeout.C:
|
||||||
|
log.ZWarn(ctx, "server exit timeout", nil, "running", wait.Running())
|
||||||
|
return exitCause
|
||||||
|
case _, ok := <-done:
|
||||||
|
if ok {
|
||||||
|
log.ZWarn(ctx, "waiting for the service to exit", nil, "running", wait.Running())
|
||||||
|
} else {
|
||||||
|
log.ZInfo(ctx, "all server exit done")
|
||||||
|
return exitCause
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func putCmd[C any](cmd *cmds, block bool, fn func(ctx context.Context, config *C, client discovery.SvcDiscoveryRegistry, server grpc.ServiceRegistrar) error) {
|
||||||
|
name := path.Base(runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
||||||
|
if index := strings.Index(name, "."); index >= 0 {
|
||||||
|
name = name[:index]
|
||||||
|
}
|
||||||
|
cmd.add(name, block, func(ctx context.Context) error {
|
||||||
|
var conf C
|
||||||
|
if err := cmd.parseConf(&conf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return fn(ctx, &conf, standalone.GetSvcDiscoveryRegistry(), standalone.GetServiceRegistrar())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
type cmdManger struct {
|
||||||
|
lock sync.Mutex
|
||||||
|
done chan struct{}
|
||||||
|
count int
|
||||||
|
names map[string]struct{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmdManger) Start(name string) {
|
||||||
|
x.lock.Lock()
|
||||||
|
defer x.lock.Unlock()
|
||||||
|
if x.names == nil {
|
||||||
|
x.names = make(map[string]struct{})
|
||||||
|
}
|
||||||
|
if x.done == nil {
|
||||||
|
x.done = make(chan struct{}, 1)
|
||||||
|
}
|
||||||
|
if _, ok := x.names[name]; ok {
|
||||||
|
panic(fmt.Errorf("cmd %s already exists", name))
|
||||||
|
}
|
||||||
|
x.count++
|
||||||
|
x.names[name] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmdManger) Shutdown(name string) {
|
||||||
|
x.lock.Lock()
|
||||||
|
defer x.lock.Unlock()
|
||||||
|
if _, ok := x.names[name]; !ok {
|
||||||
|
panic(fmt.Errorf("cmd %s not exists", name))
|
||||||
|
}
|
||||||
|
delete(x.names, name)
|
||||||
|
x.count--
|
||||||
|
if x.count == 0 {
|
||||||
|
close(x.done)
|
||||||
|
} else {
|
||||||
|
select {
|
||||||
|
case x.done <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmdManger) Wait() <-chan struct{} {
|
||||||
|
x.lock.Lock()
|
||||||
|
defer x.lock.Unlock()
|
||||||
|
if x.count == 0 || x.done == nil {
|
||||||
|
tmp := make(chan struct{})
|
||||||
|
close(tmp)
|
||||||
|
return tmp
|
||||||
|
}
|
||||||
|
return x.done
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *cmdManger) Running() []string {
|
||||||
|
x.lock.Lock()
|
||||||
|
defer x.lock.Unlock()
|
||||||
|
names := make([]string, 0, len(x.names))
|
||||||
|
for name := range x.names {
|
||||||
|
names = append(names, name)
|
||||||
|
}
|
||||||
|
return names
|
||||||
|
}
|
||||||
28
cmd/openim-api/main.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "net/http/pprof"
|
||||||
|
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewApiCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
66
cmd/openim-cmdutils/main.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
msgUtilsCmd := cmd.NewMsgUtilsCmd("openIMCmdUtils", "openIM cmd utils", nil)
|
||||||
|
getCmd := cmd.NewGetCmd()
|
||||||
|
fixCmd := cmd.NewFixCmd()
|
||||||
|
clearCmd := cmd.NewClearCmd()
|
||||||
|
seqCmd := cmd.NewSeqCmd()
|
||||||
|
msgCmd := cmd.NewMsgCmd()
|
||||||
|
getCmd.AddCommand(seqCmd.GetSeqCmd(), msgCmd.GetMsgCmd())
|
||||||
|
getCmd.AddSuperGroupIDFlag()
|
||||||
|
getCmd.AddUserIDFlag()
|
||||||
|
getCmd.AddConfigDirFlag()
|
||||||
|
getCmd.AddIndexFlag()
|
||||||
|
getCmd.AddBeginSeqFlag()
|
||||||
|
getCmd.AddLimitFlag()
|
||||||
|
// openIM get seq --userID=xxx
|
||||||
|
// openIM get seq --superGroupID=xxx
|
||||||
|
// openIM get msg --userID=xxx --beginSeq=100 --limit=10
|
||||||
|
// openIM get msg --superGroupID=xxx --beginSeq=100 --limit=10
|
||||||
|
|
||||||
|
fixCmd.AddCommand(seqCmd.FixSeqCmd())
|
||||||
|
fixCmd.AddSuperGroupIDFlag()
|
||||||
|
fixCmd.AddUserIDFlag()
|
||||||
|
fixCmd.AddConfigDirFlag()
|
||||||
|
fixCmd.AddIndexFlag()
|
||||||
|
fixCmd.AddFixAllFlag()
|
||||||
|
// openIM fix seq --userID=xxx
|
||||||
|
// openIM fix seq --superGroupID=xxx
|
||||||
|
// openIM fix seq --fixAll
|
||||||
|
|
||||||
|
clearCmd.AddCommand(msgCmd.ClearMsgCmd())
|
||||||
|
clearCmd.AddSuperGroupIDFlag()
|
||||||
|
clearCmd.AddUserIDFlag()
|
||||||
|
clearCmd.AddConfigDirFlag()
|
||||||
|
clearCmd.AddIndexFlag()
|
||||||
|
clearCmd.AddClearAllFlag()
|
||||||
|
clearCmd.AddBeginSeqFlag()
|
||||||
|
clearCmd.AddLimitFlag()
|
||||||
|
// openIM clear msg --userID=xxx --beginSeq=100 --limit=10
|
||||||
|
// openIM clear msg --superGroupID=xxx --beginSeq=100 --limit=10
|
||||||
|
// openIM clear msg --clearAll
|
||||||
|
msgUtilsCmd.AddCommand(&getCmd.Command, &fixCmd.Command, &clearCmd.Command)
|
||||||
|
if err := msgUtilsCmd.Execute(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-crontask/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewCronTaskCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-msggateway/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewMsgGatewayCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-msgtransfer/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewMsgTransferCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-push/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewPushRpcCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-rpc/openim-rpc-auth/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewAuthRpcCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-rpc/openim-rpc-conversation/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewConversationRpcCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-rpc/openim-rpc-friend/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewFriendRpcCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-rpc/openim-rpc-group/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewGroupRpcCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-rpc/openim-rpc-msg/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewMsgRpcCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-rpc/openim-rpc-third/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewThirdRpcCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
26
cmd/openim-rpc/openim-rpc-user/main.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.imall.cloud/openim/open-im-server-deploy/pkg/common/cmd"
|
||||||
|
"github.com/openimsdk/tools/system/program"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := cmd.NewUserRpcCmd().Exec(); err != nil {
|
||||||
|
program.ExitWithError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
87
config/README.md
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# OpenIM Configuration File Descriptions and Common Configuration Modifications
|
||||||
|
|
||||||
|
## External Component Configurations
|
||||||
|
|
||||||
|
| Configuration File | Description |
|
||||||
|
| ------------------ |-------------------------------------------------------------|
|
||||||
|
| **kafka.yml** | Configuration for Kafka username, password, address, etc. |
|
||||||
|
| **redis.yml** | Configuration for Redis password, address, etc. |
|
||||||
|
| **minio.yml** | Configuration for MinIO username, password, address, etc. |
|
||||||
|
| **mongodb.yml** | Configuration for MongoDB username, password, address, etc. |
|
||||||
|
| **discovery.yml** | Service discovery and etcd credentials and address. |
|
||||||
|
|
||||||
|
## OpenIMServer Related Configurations
|
||||||
|
| Configuration File | Description |
|
||||||
|
| ------------------------------- | ---------------------------------------------- |
|
||||||
|
| **log.yml** | Configuration for logging levels and storage directory |
|
||||||
|
| **notification.yml** | Event notification settings (e.g., add friend, create group) |
|
||||||
|
| **share.yml** | Common settings for all services (e.g., secrets) |
|
||||||
|
| **webhooks.yml** | Webhook URLs and related settings |
|
||||||
|
| **local-cache.yml** | Local cache settings (generally do not modify) |
|
||||||
|
| **openim-rpc-third.yml** | openim-rpc-third listen IP, port, and object storage settings |
|
||||||
|
| **openim-rpc-user.yml** | openim-rpc-user listen IP and port settings |
|
||||||
|
| **openim-api.yml** | openim-api listen IP, port, and other settings |
|
||||||
|
| **openim-crontask.yml** | openim-crontask scheduled task settings |
|
||||||
|
| **openim-msggateway.yml** | openim-msggateway listen IP, port, and other settings |
|
||||||
|
| **openim-msgtransfer.yml** | Settings for openim-msgtransfer service |
|
||||||
|
| **openim-push.yml** | openim-push listen IP, port, and offline push settings |
|
||||||
|
| **openim-rpc-auth.yml** | openim-rpc-auth listen IP, port, token validity settings |
|
||||||
|
| **openim-rpc-conversation.yml** | openim-rpc-conversation listen IP and port settings |
|
||||||
|
| **openim-rpc-friend.yml** | openim-rpc-friend listen IP and port settings |
|
||||||
|
| **openim-rpc-group.yml** | openim-rpc-group listen IP and port settings |
|
||||||
|
| **openim-rpc-msg.yml** | openim-rpc-msg listen IP and port settings |
|
||||||
|
|
||||||
|
|
||||||
|
## Monitoring and Alerting Related Configurations
|
||||||
|
| Configuration File | Description |
|
||||||
|
| ------------------------------ | --------------- |
|
||||||
|
| **prometheus.yml** | Prometheus configuration |
|
||||||
|
| **instance-down-rules.yml** | Alert rules |
|
||||||
|
| **alertmanager.yml** | Alertmanager configuration |
|
||||||
|
| **email.tmpl** | Email alert template |
|
||||||
|
| **grefana-template/Demo.json** | Default Grafana dashboard |
|
||||||
|
|
||||||
|
## Common Configuration Modifications
|
||||||
|
| Configuration Item | Configuration File |
|
||||||
|
| -------------------------------------------------------- | ----------------------- |
|
||||||
|
| Configure MinIO as object storage (focus on the externalAddress field) | `minio.yml` |
|
||||||
|
| Adjust log level and number of log files | `log.yml` |
|
||||||
|
| Enable or disable friend verification when sending messages | `openim-rpc-msg.yml` |
|
||||||
|
| OpenIMServer secret | `share.yml` |
|
||||||
|
| Configure OSS, COS, AWS, or Kodo as object storage | `openim-rpc-third.yml` |
|
||||||
|
| Multi-end mutual kick strategy and max concurrent connections per gateway | `openim-msggateway.yml` |
|
||||||
|
| Offline message push configuration | `openim-push.yml` |
|
||||||
|
| Configure webhooks for callback notifications (e.g., before/after message send) | `webhooks.yml` |
|
||||||
|
| Whether new group members can view historical messages | `openim-rpc-group.yml` |
|
||||||
|
| Token expiration time settings | `openim-rpc-auth.yml` |
|
||||||
|
| Scheduled task settings (e.g., how long to retain messages) | `openim-crontask.yml` |
|
||||||
|
|
||||||
|
## Starting Multiple Instances of a Service and Maximum File Descriptors
|
||||||
|
|
||||||
|
|
||||||
|
To start multiple instances of an OpenIM service, simply add the corresponding port numbers and modify the `start-config.yml` file in the project’s root directory,
|
||||||
|
then restart the service. For example, to start 2 instances of `openim-rpc-user`:
|
||||||
|
|
||||||
|
```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
|
||||||
|
```
|
||||||
|
|
||||||
|
To set the maximum number of open file descriptors (typically one per online user):
|
||||||
|
|
||||||
|
```
|
||||||
|
maxFileDescriptors: 10000
|
||||||
|
```
|
||||||
86
config/README_zh_CN.md
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# OpenIM配置文件说明以及常用配置修改说明
|
||||||
|
|
||||||
|
## 外部组件相关配置
|
||||||
|
|
||||||
|
| Configuration File | Description |
|
||||||
|
| ------------------ | ---------------------------------- |
|
||||||
|
| **kafka.yml** | Kafka用户名、密码、地址等配置 |
|
||||||
|
| **redis.yml** | Redis密码、地址等配置 |
|
||||||
|
| **minio.yml** | MinIO用户名、密码、地址等配置 |
|
||||||
|
| **mongodb.yml** | MongoDB用户名、密码、地址等配置 |
|
||||||
|
| **discovery.yml** | 服务发现以及etcd用户名、密码、地址 |
|
||||||
|
|
||||||
|
## OpenIMServer相关配置
|
||||||
|
| Configuration File | Description |
|
||||||
|
| ------------------------------- | ---------------------------------------------- |
|
||||||
|
| **log.yml** | 日志级别及存储目录等配置 |
|
||||||
|
| **notification.yml** | 添加好友、创建群组等事件通知配置 |
|
||||||
|
| **share.yml** | 各服务所需的公共配置,如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、端口等配置 |
|
||||||
|
|
||||||
|
|
||||||
|
## 监控告警相关配置
|
||||||
|
| Configuration File | Description |
|
||||||
|
| ------------------------------ | --------------- |
|
||||||
|
| **prometheus.yml** | prometheus配置 |
|
||||||
|
| **instance-down-rules.yml** | 告警规则 |
|
||||||
|
| **alertmanager.yml** | 告警管理配置 |
|
||||||
|
| **email.tmpl** | 邮件告警模版 |
|
||||||
|
| **grefana-template/Demo.json** | 默认的dashboard |
|
||||||
|
|
||||||
|
## 常用配置修改
|
||||||
|
| 修改配置项 | 配置文件 |
|
||||||
|
| -------------------------------------------------------- | ----------------------- |
|
||||||
|
| 使用minio作为对象存储时配置,重点关注externalAddress字段 | `minio.yml` |
|
||||||
|
| 日志级别及日志文件数量调整 | `log.yml` |
|
||||||
|
| 发送消息是否需要验证好友关系 | `openim-rpc-msg.yml` |
|
||||||
|
| OpenIMServer秘钥 | `share.yml` |
|
||||||
|
| 使用oss, cos, aws, kodo作为对象存储时配置 | `openim-rpc-third.yml` |
|
||||||
|
| 多端互踢策略,单个gateway同时最大连接数 | `openim-msggateway.yml` |
|
||||||
|
| 消息离线推送 | `openim-push.yml` |
|
||||||
|
| 配置webhook来通知回调服务器,如消息发送前后回调 | `webhooks.yml` |
|
||||||
|
| 新入群用户是否可以查看历史消息 | `openim-rpc-group.yml` |
|
||||||
|
| token 过期时间设置 | `openim-rpc-auth.yml` |
|
||||||
|
| 定时任务设置,例如消息保存多长时间 | `openim-crontask.yml` |
|
||||||
|
|
||||||
|
## 启动某个服务的多个实例和最大文件句柄数
|
||||||
|
|
||||||
|
|
||||||
|
若要启动某个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
|
||||||
|
```
|
||||||
|
|
||||||
|
修改最大同时打开的文件句柄数,一般是每个在线用户占用一个
|
||||||
|
|
||||||
|
```
|
||||||
|
maxFileDescriptors: 10000
|
||||||
|
```
|
||||||
34
config/alertmanager.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
global:
|
||||||
|
resolve_timeout: 5m
|
||||||
|
smtp_from: alert@openim.io
|
||||||
|
smtp_smarthost: smtp.163.com:465
|
||||||
|
smtp_auth_username: alert@openim.io
|
||||||
|
smtp_auth_password: YOURAUTHPASSWORD
|
||||||
|
smtp_require_tls: false
|
||||||
|
smtp_hello: xxx
|
||||||
|
|
||||||
|
templates:
|
||||||
|
- /etc/alertmanager/email.tmpl
|
||||||
|
|
||||||
|
route:
|
||||||
|
group_by: [ 'alertname' ]
|
||||||
|
group_wait: 5s
|
||||||
|
group_interval: 5s
|
||||||
|
repeat_interval: 5m
|
||||||
|
receiver: email
|
||||||
|
routes:
|
||||||
|
- matchers:
|
||||||
|
- alertname = "XXX"
|
||||||
|
group_by: [ 'instance' ]
|
||||||
|
group_wait: 5s
|
||||||
|
group_interval: 5s
|
||||||
|
repeat_interval: 5m
|
||||||
|
receiver: email
|
||||||
|
|
||||||
|
receivers:
|
||||||
|
- name: email
|
||||||
|
email_configs:
|
||||||
|
- to: 'alert@example.com'
|
||||||
|
html: '{{ template "email.to.html" . }}'
|
||||||
|
headers: { Subject: "[OPENIM-SERVER]Alarm" }
|
||||||
|
send_resolved: true
|
||||||
22
config/discovery.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
enable: etcd
|
||||||
|
etcd:
|
||||||
|
rootDirectory: openim
|
||||||
|
address: [localhost:12379]
|
||||||
|
## Attention: If you set auth in etcd
|
||||||
|
## you must also update the username and password in Chat project.
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
|
||||||
|
kubernetes:
|
||||||
|
namespace: default
|
||||||
|
|
||||||
|
rpcService:
|
||||||
|
user: user-rpc-service
|
||||||
|
friend: friend-rpc-service
|
||||||
|
msg: msg-rpc-service
|
||||||
|
push: push-rpc-service
|
||||||
|
messageGateway: messagegateway-rpc-service
|
||||||
|
group: group-rpc-service
|
||||||
|
auth: auth-rpc-service
|
||||||
|
conversation: conversation-rpc-service
|
||||||
|
third: third-rpc-service
|
||||||
36
config/email.tmpl
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{{ define "email.to.html" }}
|
||||||
|
{{ if eq .Status "firing" }}
|
||||||
|
{{ range .Alerts }}
|
||||||
|
<!-- Begin of OpenIM Alert -->
|
||||||
|
<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
|
||||||
|
<h3>OpenIM Alert</h3>
|
||||||
|
<p><strong>Alert Status:</strong> firing</p>
|
||||||
|
<p><strong>Alert Program:</strong> Prometheus Alert</p>
|
||||||
|
<p><strong>Severity Level:</strong> {{ .Labels.severity }}</p>
|
||||||
|
<p><strong>Alert Type:</strong> {{ .Labels.alertname }}</p>
|
||||||
|
<p><strong>Affected Host:</strong> {{ .Labels.instance }}</p>
|
||||||
|
<p><strong>Affected Service:</strong> {{ .Labels.job }}</p>
|
||||||
|
<p><strong>Alert Subject:</strong> {{ .Annotations.summary }}</p>
|
||||||
|
<p><strong>Trigger Time:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{ else if eq .Status "resolved" }}
|
||||||
|
{{ range .Alerts }}
|
||||||
|
<!-- Begin of OpenIM Alert -->
|
||||||
|
<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
|
||||||
|
<h3>OpenIM Alert</h3>
|
||||||
|
<p><strong>Alert Status:</strong> resolved</p>
|
||||||
|
<p><strong>Alert Program:</strong> Prometheus Alert</p>
|
||||||
|
<p><strong>Severity Level:</strong> {{ .Labels.severity }}</p>
|
||||||
|
<p><strong>Alert Type:</strong> {{ .Labels.alertname }}</p>
|
||||||
|
<p><strong>Affected Host:</strong> {{ .Labels.instance }}</p>
|
||||||
|
<p><strong>Affected Service:</strong> {{ .Labels.job }}</p>
|
||||||
|
<p><strong>Alert Subject:</strong> {{ .Annotations.summary }}</p>
|
||||||
|
<p><strong>Trigger Time:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
<!-- End of OpenIM Alert -->
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
5576
config/grafana-template/Demo.json
Normal file
44
config/instance-down-rules.yml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
groups:
|
||||||
|
- name: instance_down
|
||||||
|
rules:
|
||||||
|
- alert: InstanceDown
|
||||||
|
expr: up == 0
|
||||||
|
for: 1m
|
||||||
|
labels:
|
||||||
|
severity: critical
|
||||||
|
annotations:
|
||||||
|
summary: "Instance {{ $labels.instance }} down"
|
||||||
|
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minutes."
|
||||||
|
|
||||||
|
- name: database_insert_failure_alerts
|
||||||
|
rules:
|
||||||
|
- alert: DatabaseInsertFailed
|
||||||
|
expr: (increase(msg_insert_redis_failed_total[5m]) > 0) or (increase(msg_insert_mongo_failed_total[5m]) > 0)
|
||||||
|
for: 1m
|
||||||
|
labels:
|
||||||
|
severity: critical
|
||||||
|
annotations:
|
||||||
|
summary: "Increase in MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter detected"
|
||||||
|
description: "Either MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter has increased in the last 5 minutes, indicating failures in message insert operations to Redis or MongoDB,maybe the redis or mongodb is crash."
|
||||||
|
|
||||||
|
- name: registrations_few
|
||||||
|
rules:
|
||||||
|
- alert: RegistrationsFew
|
||||||
|
expr: increase(user_login_total[1h]) == 0
|
||||||
|
for: 1m
|
||||||
|
labels:
|
||||||
|
severity: info
|
||||||
|
annotations:
|
||||||
|
summary: "Too few registrations within the time frame"
|
||||||
|
description: "The number of registrations in the last hour is 0. There might be some issues."
|
||||||
|
|
||||||
|
- name: messages_few
|
||||||
|
rules:
|
||||||
|
- alert: MessagesFew
|
||||||
|
expr: (increase(single_chat_msg_process_success_total[1h])+increase(group_chat_msg_process_success_total[1h])) == 0
|
||||||
|
for: 1m
|
||||||
|
labels:
|
||||||
|
severity: info
|
||||||
|
annotations:
|
||||||
|
summary: "Too few messages within the time frame"
|
||||||
|
description: "The number of messages sent in the last hour is 0. There might be some issues."
|
||||||
40
config/kafka.yml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
## Kafka authentication
|
||||||
|
username:
|
||||||
|
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
|
||||||
|
# Kafka topic for offline push notifications
|
||||||
|
toOfflinePushTopic: toOfflinePush
|
||||||
|
# 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
|
||||||
|
# Consumer group ID for offline push notifications topic
|
||||||
|
toOfflinePushGroupID: offlinePush
|
||||||
|
# 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
|
||||||
34
config/local-cache.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
auth:
|
||||||
|
topic: DELETE_CACHE_AUTH
|
||||||
|
slotNum: 100
|
||||||
|
slotSize: 2000
|
||||||
|
successExpire: 300
|
||||||
|
failedExpire: 5
|
||||||
|
|
||||||
|
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
|
||||||
14
config/log.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# 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: true
|
||||||
|
# Whether to log in JSON format, default is acceptable
|
||||||
|
isJson: false
|
||||||
|
# output simplify log when KeyAndValues's value len is bigger than 50 in rpc method log
|
||||||
|
isSimplify: true
|
||||||
16
config/minio.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Name of the bucket in MinIO
|
||||||
|
bucket: images
|
||||||
|
# Access key ID for MinIO authentication
|
||||||
|
accessKeyID: Z9Mgqtdm9OczzeRG
|
||||||
|
# Secret access key for MinIO authentication
|
||||||
|
secretAccessKey: vV6CzNvxYaN9jSZ8g7nOhGF1N4ygLJbE
|
||||||
|
# Session token for MinIO authentication (optional)
|
||||||
|
sessionToken:
|
||||||
|
# Internal address of the MinIO server
|
||||||
|
internalAddress: s3.jizhying.com
|
||||||
|
# External address of the MinIO server, accessible from outside. Supports both HTTP and HTTPS using a domain name
|
||||||
|
externalAddress: https://s3.jizhying.com
|
||||||
|
# Flag to enable or disable public read access to the bucket
|
||||||
|
publicRead: true
|
||||||
|
|
||||||
|
|
||||||
51
config/mongodb.yml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# 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
|
||||||
|
# Authentication source for database authentication, if use root user, set it to admin
|
||||||
|
authSource: openim_v3
|
||||||
|
# Maximum number of connections in the connection pool
|
||||||
|
maxPoolSize: 100
|
||||||
|
# Maximum number of retry attempts for a failed database connection
|
||||||
|
maxRetry: 10
|
||||||
|
# MongoDB Mode, including "standalone", "replicaSet"
|
||||||
|
mongoMode: "standalone"
|
||||||
|
|
||||||
|
# The following configurations only take effect when mongoMode is set to "replicaSet"
|
||||||
|
replicaSet:
|
||||||
|
name: rs0
|
||||||
|
hosts: [127.0.0.1:37017, 127.0.0.1:37018, 127.0.0.1:37019]
|
||||||
|
# Read concern level: "local", "available", "majority", "linearizable", "snapshot"
|
||||||
|
readConcern: majority
|
||||||
|
# maximum staleness of data in seconds
|
||||||
|
maxStaleness: 90s
|
||||||
|
|
||||||
|
# The following configurations only take effect when mongoMode is set to "replicaSet"
|
||||||
|
readPreference:
|
||||||
|
# Read preference mode, can be "primary", "primaryPreferred", "secondary", "secondaryPreferred", "nearest"
|
||||||
|
mode: primary
|
||||||
|
maxStaleness: 90s
|
||||||
|
# TagSets is an array of maps with priority based on order, empty map must be placed last for fallback tagSets
|
||||||
|
tagSets:
|
||||||
|
- datacenter: "cn-east"
|
||||||
|
rack: "1"
|
||||||
|
storage: "ssd"
|
||||||
|
- datacenter: "cn-east"
|
||||||
|
storage: "ssd"
|
||||||
|
- datacenter: "cn-east"
|
||||||
|
- {} # Empty map, indicates any node
|
||||||
|
|
||||||
|
# The following configurations only take effect when mongoMode is set to "replicaSet"
|
||||||
|
writeConcern:
|
||||||
|
# Write node count or tag (int, "majority", or custom tag)
|
||||||
|
w: majority
|
||||||
|
# Whether to wait for journal confirmation
|
||||||
|
j: true
|
||||||
|
# Write timeout duration
|
||||||
|
wtimeout: 30s
|
||||||
326
config/notification.yml
Normal file
@@ -0,0 +1,326 @@
|
|||||||
|
groupCreated:
|
||||||
|
isSendMsg: true
|
||||||
|
# Deprecated. Fixed as 1.
|
||||||
|
reliabilityLevel: 1
|
||||||
|
# Deprecated. Fixed as false.
|
||||||
|
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: true
|
||||||
|
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: true
|
||||||
|
title: groupApplicationAccepted title
|
||||||
|
desc: groupApplicationAccepted desc
|
||||||
|
ext: groupApplicationAccepted ext
|
||||||
|
|
||||||
|
groupApplicationRejected:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
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: true
|
||||||
|
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: false
|
||||||
|
title: We have become friends
|
||||||
|
desc: We have become friends
|
||||||
|
ext: We have become friends
|
||||||
|
|
||||||
|
friendDeleted:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: deleted a friend
|
||||||
|
desc: deleted a friend
|
||||||
|
ext: deleted a friend
|
||||||
|
|
||||||
|
friendRemarkSet:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
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: false
|
||||||
|
title: blocked a user
|
||||||
|
desc: blocked a user
|
||||||
|
ext: blocked a user
|
||||||
|
|
||||||
|
blackDeleted:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: Remove a blocked user
|
||||||
|
desc: Remove a blocked user
|
||||||
|
ext: Remove a blocked user
|
||||||
|
|
||||||
|
friendInfoUpdated:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: friend info updated
|
||||||
|
desc: friend info updated
|
||||||
|
ext: friend info updated
|
||||||
|
|
||||||
|
#####################user#########################
|
||||||
|
userInfoUpdated:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: userInfo updated
|
||||||
|
desc: userInfo updated
|
||||||
|
ext: userInfo updated
|
||||||
|
|
||||||
|
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: false
|
||||||
|
title: conversation changed
|
||||||
|
desc: conversation changed
|
||||||
|
ext: conversation changed
|
||||||
|
|
||||||
|
conversationSetPrivate:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: burn after reading
|
||||||
|
desc: burn after reading
|
||||||
|
ext: burn after reading
|
||||||
33
config/openim-api.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
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 ]
|
||||||
|
# API compression level; 0: default compression, 1: best compression, 2: best speed, -1: no compression
|
||||||
|
compressionLevel: 0
|
||||||
|
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
# Whether to enable prometheus
|
||||||
|
enable: true
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
autoSetPorts: true
|
||||||
|
# Prometheus listening ports, must match the number of api.ports
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
# This address can be accessed via a browser
|
||||||
|
grafanaURL:
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
onlineCountRefresh:
|
||||||
|
enable: true
|
||||||
|
interval: 30s
|
||||||
4
config/openim-crontask.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
cronExecuteTime: 0 2 * * *
|
||||||
|
retainChatRecords: 365
|
||||||
|
fileExpireTime: 180
|
||||||
|
deleteObjectType: ["msg-picture","msg-file", "msg-voice","msg-video","msg-video-snapshot","sdklog"]
|
||||||
45
config/openim-msggateway.yml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
rpc:
|
||||||
|
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||||
|
registerIP:
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
# 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
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
25
config/openim-msgtransfer.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
prometheus:
|
||||||
|
# Enable or disable Prometheus monitoring
|
||||||
|
enable: true
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
autoSetPorts: true
|
||||||
|
# List of ports that Prometheus listens on; each port corresponds to an instance of monitoring. Ensure these are managed accordingly
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
64
config/openim-push.yml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
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
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
maxConcurrentWorkers: 50
|
||||||
|
#Use geTui for offline push notifications, or choose fcm or jpns; corresponding configuration settings must be specified.
|
||||||
|
enable:
|
||||||
|
getui:
|
||||||
|
pushUrl: https://restapi.getui.com/v2/$appId
|
||||||
|
masterSecret:
|
||||||
|
appKey:
|
||||||
|
intent:
|
||||||
|
channelID:
|
||||||
|
channelName:
|
||||||
|
fcm:
|
||||||
|
# Prioritize using file paths. If the file path is empty, use URL
|
||||||
|
filePath: # File path is concatenated with the parameters passed in through - c(`mage` default pass in `config/`) and filePath.
|
||||||
|
authURL: # Must start with https or http.
|
||||||
|
jpush:
|
||||||
|
appKey:
|
||||||
|
masterSecret:
|
||||||
|
pushURL:
|
||||||
|
pushIntent:
|
||||||
|
|
||||||
|
# iOS system push sound and badge count
|
||||||
|
iosPush:
|
||||||
|
pushSound: xxx
|
||||||
|
badgeCount: true
|
||||||
|
production: false
|
||||||
|
|
||||||
|
fullUserCache: true
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
39
config/openim-rpc-auth.yml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
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
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
tokenPolicy:
|
||||||
|
# Token validity period, in days
|
||||||
|
expire: 90
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
35
config/openim-rpc-conversation.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
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
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
35
config/openim-rpc-friend.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
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
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
38
config/openim-rpc-group.yml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
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
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
|
||||||
|
enableHistoryForNewMembers: true
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
39
config/openim-rpc-msg.yml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
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
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
|
||||||
|
# Does sending messages require friend verification
|
||||||
|
friendVerify: false
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
69
config/openim-rpc-third.yml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
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
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
|
|
||||||
|
object:
|
||||||
|
# Use MinIO as object storage, or set to "cos", "oss", "kodo", "aws", while also configuring the corresponding settings
|
||||||
|
# Cloudflare R2 使用 aws 模式,配置 endpoint 即可
|
||||||
|
enable: minio
|
||||||
|
cos:
|
||||||
|
endpoint: https://e032b3e2e74d56c41118001d0f8e8106.r2.cloudflarestorage.com
|
||||||
|
secretID: TVLQOpXcTCjpePajNI8qnD2tp4C9eean4tVdOT17
|
||||||
|
secretKey: fbafa94b5036c147d5f27ffa55417a5daab662e348acb3a21b73c33405633cc8
|
||||||
|
sessionToken:
|
||||||
|
publicRead: true
|
||||||
|
oss:
|
||||||
|
endpoint: https://oss-ap-southeast-1.aliyuncs.com
|
||||||
|
bucket: chatall
|
||||||
|
bucketURL: http://asset.imall.cloud
|
||||||
|
accessKeyID: LTAI5t6DiZgPducgW28HW9sv
|
||||||
|
accessKeySecret: Hre20TaRDQadYZfQzp8ZwS9HfHIPrw
|
||||||
|
sessionToken:
|
||||||
|
publicRead: true
|
||||||
|
kodo:
|
||||||
|
endpoint: https://s3.cn-south-1.qiniucs.com
|
||||||
|
bucket: testdemo12313
|
||||||
|
bucketURL: http://so2at6d05.hn-bkt.clouddn.com
|
||||||
|
accessKeyID:
|
||||||
|
accessKeySecret:
|
||||||
|
sessionToken:
|
||||||
|
publicRead: false
|
||||||
|
aws:
|
||||||
|
region: ap-southeast-1
|
||||||
|
bucket: im1688
|
||||||
|
accessKeyID: AKIA5TMMSZWVFYCLKJ2G
|
||||||
|
secretAccessKey: P+slboxgk8MqqXFHBFYRxBCKNfXQVuL7n5GJS56p
|
||||||
|
sessionToken:
|
||||||
|
publicRead: true
|
||||||
35
config/openim-rpc-user.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
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
|
||||||
|
# autoSetPorts indicates whether to automatically set the ports
|
||||||
|
# if you use in kubernetes, set it to false
|
||||||
|
autoSetPorts: true
|
||||||
|
# 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
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
# Whether to enable prometheus
|
||||||
|
enable: true
|
||||||
|
# Prometheus listening ports, must be consistent with the number of rpc.ports
|
||||||
|
# It will only take effect when autoSetPorts is set to false.
|
||||||
|
ports:
|
||||||
|
|
||||||
|
ratelimiter:
|
||||||
|
# Whether to enable rate limiting
|
||||||
|
enable: false
|
||||||
|
# WindowSize defines time duration per window
|
||||||
|
window: 20s
|
||||||
|
# BucketNum defines bucket number for each window
|
||||||
|
bucket: 500
|
||||||
|
# CPU threshold; valid range 0–1000 (1000 = 100%)
|
||||||
|
cpuThreshold: 850
|
||||||
|
|
||||||
|
circuitBreaker:
|
||||||
|
enable: false
|
||||||
|
window: 5s # Time window size (seconds)
|
||||||
|
bucket: 100 # Number of buckets
|
||||||
|
success: 0.6 # Success rate threshold (0.6 means 60%)
|
||||||
|
request: 500 # Request threshold; circuit breaker evaluation occurs when reached
|
||||||
119
config/prometheus.yml
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
# my global config
|
||||||
|
global:
|
||||||
|
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||||
|
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||||
|
# scrape_timeout is set to the global default (10s).
|
||||||
|
|
||||||
|
# Alertmanager configuration
|
||||||
|
alerting:
|
||||||
|
alertmanagers:
|
||||||
|
- static_configs:
|
||||||
|
- targets: [127.0.0.1:19093]
|
||||||
|
|
||||||
|
# Load rules once and periodically evaluate them according to the global evaluation_interval.
|
||||||
|
rule_files:
|
||||||
|
- instance-down-rules.yml
|
||||||
|
# - first_rules.yml
|
||||||
|
# - second_rules.yml
|
||||||
|
|
||||||
|
# A scrape configuration containing exactly one endpoint to scrape:
|
||||||
|
# Here it's Prometheus itself.
|
||||||
|
scrape_configs:
|
||||||
|
# The job name is added as a label "job=job_name" to any timeseries scraped from this config.
|
||||||
|
# Monitored information captured by prometheus
|
||||||
|
|
||||||
|
# prometheus fetches application services
|
||||||
|
- job_name: node_exporter
|
||||||
|
static_configs:
|
||||||
|
- targets: [ 127.0.0.1:19100 ]
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-api
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/api"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12002 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-msggateway
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/msg_gateway"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12140 ]
|
||||||
|
# # - targets: [ 127.0.0.1:12140, 127.0.0.1:12141, 127.0.0.1:12142, 127.0.0.1:12143, 127.0.0.1:12144, 127.0.0.1:12145, 127.0.0.1:12146, 127.0.0.1:12147, 127.0.0.1:12148, 127.0.0.1:12149, 127.0.0.1:12150, 127.0.0.1:12151, 127.0.0.1:12152, 127.0.0.1:12153, 127.0.0.1:12154, 127.0.0.1:12155 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-msgtransfer
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/msg_transfer"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12020, 127.0.0.1:12021, 127.0.0.1:12022, 127.0.0.1:12023, 127.0.0.1:12024, 127.0.0.1:12025, 127.0.0.1:12026, 127.0.0.1:12027 ]
|
||||||
|
# # - targets: [ 127.0.0.1:12020, 127.0.0.1:12021, 127.0.0.1:12022, 127.0.0.1:12023, 127.0.0.1:12024, 127.0.0.1:12025, 127.0.0.1:12026, 127.0.0.1:12027, 127.0.0.1:12028, 127.0.0.1:12029, 127.0.0.1:12030, 127.0.0.1:12031, 127.0.0.1:12032, 127.0.0.1:12033, 127.0.0.1:12034, 127.0.0.1:12035 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-push
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/push"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12170, 127.0.0.1:12171, 127.0.0.1:12172, 127.0.0.1:12173, 127.0.0.1:12174, 127.0.0.1:12175, 127.0.0.1:12176, 127.0.0.1:12177 ]
|
||||||
|
## - targets: [ 127.0.0.1:12170, 127.0.0.1:12171, 127.0.0.1:12172, 127.0.0.1:12173, 127.0.0.1:12174, 127.0.0.1:12175, 127.0.0.1:12176, 127.0.0.1:12177, 127.0.0.1:12178, 127.0.0.1:12179, 127.0.0.1:12180, 127.0.0.1:12182, 127.0.0.1:12183, 127.0.0.1:12184, 127.0.0.1:12185, 127.0.0.1:12186 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-rpc-auth
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/auth"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12200 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-rpc-conversation
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/conversation"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12220 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-rpc-friend
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/friend"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12240 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-rpc-group
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/group"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12260 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default.
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-rpc-msg
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/msg"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12280 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-rpc-third
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/third"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12300 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||
|
|
||||||
|
- job_name: openimserver-openim-rpc-user
|
||||||
|
http_sd_configs:
|
||||||
|
- url: "http://127.0.0.1:10002/prometheus_discovery/user"
|
||||||
|
# static_configs:
|
||||||
|
# - targets: [ 127.0.0.1:12320 ]
|
||||||
|
# labels:
|
||||||
|
# namespace: default
|
||||||