docs: add readme docs (#691)

* docs: add readme docs

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

* feat: add script yaml

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

* feat: add script yaml

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

* feat: add test

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

* feat: add test

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

* fix bug: reject group req bug

* feat: add go relase

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

* feat: add test

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

* feat: add test

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

* fix: config env command

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>

---------

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
Co-authored-by: wangchuxiao <wangchuxiao97@outlook.com>
pull/692/head
Xinwei Xiong 12 months ago committed by GitHub
parent 114d77b9d8
commit e7040d3b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,6 +18,7 @@ on:
push: push:
branches: branches:
- main - main
- release-*
tags: tags:
- v* - v*
workflow_dispatch: workflow_dispatch:
@ -29,29 +30,38 @@ jobs:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v3 uses: actions/checkout@v3
# docker.io/openim/openim-server:latest - name: Build OpenIM Server
- name: Log in to Docker Hub run: |
uses: docker/login-action@v2 sudo make build
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# docker.io/openim/openim-server:latest
- name: Extract metadata (tags, labels) for Docker - name: Extract metadata (tags, labels) for Docker
id: meta id: meta
uses: docker/metadata-action@v4.6.0 uses: docker/metadata-action@v4.6.0
with: with:
images: openim/openim-server images: openim/openim-server
tags: latest
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: true push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
# registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest # registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
- name: Extract metadata (tags, labels) for Docker
id: meta2
uses: docker/metadata-action@v4.6.0
with:
images: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server
- name: Log in to AliYun Docker Hub - name: Log in to AliYun Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
@ -59,22 +69,21 @@ jobs:
username: ${{ secrets.ALIREGISTRY_USERNAME }} username: ${{ secrets.ALIREGISTRY_USERNAME }}
password: ${{ secrets.ALIREGISTRY_TOKEN }} password: ${{ secrets.ALIREGISTRY_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta2
uses: docker/metadata-action@v4.6.0
with:
images: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server
tags: latest
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: true push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta2.outputs.tags }} tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }} labels: ${{ steps.meta2.outputs.labels }}
# ghcr.io/openim/openim-server:latest # ghcr.io/openimsdk/openim-server:latest
- name: Extract metadata (tags, labels) for Docker
id: meta3
uses: docker/metadata-action@v4.6.0
with:
images: ghcr.io/openimsdk/openim-server
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
@ -82,53 +91,10 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta3
uses: docker/metadata-action@v4.6.0
with:
images: openim/openim-server
tags: latest
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: true push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta3.outputs.tags }} tags: ${{ steps.meta3.outputs.tags }}
labels: ${{ steps.meta3.outputs.labels }} labels: ${{ steps.meta3.outputs.labels }}
# name: OpenIM Build Docker Images
# on:
# push:
# tags:
# - v*
# jobs:
# build:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# bin:
# - openim-server
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Setup Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Docker metadata
# id: metadata
# uses: docker/metadata-action@v4
# with:
# images: ghcr.io/${{ github.repository_owner }}/openim-${{ matrix.bin }}
# - name: Build and release Docker images
# uses: docker/build-push-action@v3
# with:
# platforms: linux/386,linux/amd64,linux/arm64/v8
# target: ${{ matrix.bin }}
# tags: ${{ steps.metadata.outputs.tags }}
# push: true

@ -18,6 +18,7 @@ on:
push: push:
branches: branches:
- 'devops' # Only for the dev branch - 'devops' # Only for the dev branch
- 'main'
paths: paths:
- '.github/workflows/*' - '.github/workflows/*'
# - '__test__/**' # dev No immediate testing is required # - '__test__/**' # dev No immediate testing is required
@ -26,38 +27,47 @@ on:
- 'docker-compose.yml' - 'docker-compose.yml'
- 'bin/*' - 'bin/*'
env:
SERVER_PRIVATE_KEY: ${{ secrets.SERVER_PRIVATE_KEY }} # server private key
SERVER_HOST: ${{ secrets.SERVER_HOST }} # server ip address
USER_NAME: ${{ secrets.USER_NAME }} # server username
cache-name: note
jobs: jobs:
deploy-dev: deploy-dev:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: set ssh key # Temporarily set up ssh key - name: executing remote ssh commands using password
run: | uses: appleboy/ssh-action@v1.0.0
mkdir -p ~/.ssh/ env:
# secrets.WFP_ID_RSA set in GitHub OWNER: ${{ github.repository_owner }}
echo "${{secrets.WFP_ID_RSA}}" > ~/.ssh/id_rsa REPO: ${{ github.event.repository.name }}
chmod 600 ~/.ssh/id_rsa with:
ssh-keyscan "182.92.xxx.xxx" >> ~/.ssh/known_hosts host: "${{ secrets.SG_M1_HOST }}, ${{ secrets.SG_N1_HOST }}, ${{ secrets.SG_N2_HOST}}"
- name: deploy # Deployment username: ${{ secrets.SG_USERNAME }}
run: | password: ${{ secrets.SG_PASSWORD }}
ssh work@182.92.xxx.xxx " port: ${{ secrets.SG_PORT }}
# 【Attention】Log in with the 'work' account, manually create /home/work/imooc-lego directory envs: OWNER,REPO
# Then git clone https://username:password@github.com/imooc-lego/biz-editor-server.git -b dev (private repository, use GitHub username and password) script_stop: true
# Remember to delete origin to avoid exposing GitHub password script: |
cd /home/work/imooc-lego/biz-editor-server; mkdir -p /test/openim
git remote add origin https://openimbot:${{secrets.WFP_PASSWORD}}@github.com/OpenIMSDK/open-im-server.git; cd /test/openim
git checkout dev; pwd;ls -al
git pull origin dev; # Download the latest code again echo "OWNER: $OWNER"
git remote remove origin; # Remove origin to avoid exposing GitHub password echo "REPO: $REPO"
# Start docker git clone -b develop https://github.com/${OWNER}/${REPO}.git; cd ${REPO}
docker-compose build editor-server; # Same as the service name in docker-compose.yml docker compose up -d
docker-compose up -d;
"
- name: delete ssh key # Delete ssh key # - name: deploy # Deployment
run: rm -rf ~/.ssh/id_rsa # run: |
# ssh work@182.92.xxx.xxx "
# # 【Attention】Log in with the 'work' account, manually create /home/work/imooc-lego directory
# # Then git clone https://username:password@github.com/imooc-lego/biz-editor-server.git -b dev (private repository, use GitHub username and password)
# # Remember to delete origin to avoid exposing GitHub password
# cd /home/work/imooc-lego/biz-editor-server;
# git remote add origin https://openimbot:${{secrets.WFP_PASSWORD}}@github.com/OpenIMSDK/open-im-server.git;
# git checkout dev;
# git pull origin dev; # Download the latest code again
# git remote remove origin; # Remove origin to avoid exposing GitHub password
# # Start docker
# docker-compose build editor-server; # Same as the service name in docker-compose.yml
# docker-compose up -d;
# "
# - name: delete ssh key # Delete ssh key
# run: rm -rf ~/.ssh/id_rsa

@ -480,6 +480,9 @@ checksum:
release: release:
footer: | footer: |
## Welcome to the {{ .Tag }} release of [chat](https://github.com/OpenIMSDK/chat)!🎉🎉!
**Full Changelog**: https://github.com/OpenIMSDK/Open-IM-Server/compare/{{ .PreviousTag }}...{{ .Tag }} **Full Changelog**: https://github.com/OpenIMSDK/Open-IM-Server/compare/{{ .PreviousTag }}...{{ .Tag }}
## Helping out ## Helping out

@ -22,7 +22,8 @@ RUN /bin/sh -c "make build"
# Production Stage # Production Stage
FROM alpine FROM alpine
RUN apk --no-cache add tzdata RUN apk --no-cache add tzdata; \
apt --no-cache add ca-certificates
# Set directory to map logs, config files, scripts, and SDK # Set directory to map logs, config files, scripts, and SDK
VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"] VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"]

@ -0,0 +1,69 @@
# OpenIM Image Management Strategy and Pulling Guide
OpenIM is an efficient, stable, and scalable instant messaging framework that provides convenient deployment methods through Docker images. OpenIM manages multiple image sources, hosted respectively on GitHub (ghcr), Alibaba Cloud, and Docker Hub. This document is aimed at detailing the image management strategy of OpenIM and providing the steps for pulling these images.
## Image Management Strategy
OpenIM's versions correspond to GitHub's tag versions. Each time we release a new version and tag it on GitHub, an automated process is triggered that pushes the new Docker image version to the following three platforms:
1. **GitHub (ghcr.io):** We use GitHub Container Registry (ghcr.io) to host OpenIM's Docker images. This allows us to better integrate with the GitHub source code repository, providing better version control and continuous integration/deployment (CI/CD) features. You can view all GitHub images [here](https://github.com/orgs/OpenIMSDK/packages).
2. **Alibaba Cloud (registry.cn-hangzhou.aliyuncs.com):** For users in Mainland China, we also host OpenIM's Docker images on Alibaba Cloud to provide faster pull speeds. You can view all Alibaba Cloud images on this [page](https://cr.console.aliyun.com/cn-hangzhou/instances/repositories) of Alibaba Cloud Image Service (note that you need to log in to your Alibaba Cloud account first).
3. **Docker Hub (docker.io):** Docker Hub is the most commonly used Docker image hosting platform, and we also host OpenIM's images there to facilitate developers worldwide. You can view all Docker Hub images on the [OpenIM's Docker Hub page](https://hub.docker.com/r/openim).
## Methods and Steps for Pulling Images
When pulling OpenIM's Docker images, you can choose the most suitable source based on your geographic location and network conditions. Here are the steps to pull OpenIM images from each source:
1. First, make sure Docker is installed on your machine. If not, you can refer to the [Docker official documentation](https://docs.docker.com/get-docker/) for installation.
2. Open the terminal and run the following commands to pull the images:
For OpenIM Server:
- Pull from GitHub:
```
bashCopy code
docker pull ghcr.io/openimsdk/openim-server:latest
```
- Pull from Alibaba Cloud:
```
bashCopy code
docker pull registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
```
- Pull from Docker Hub:
```
bashCopy code
docker pull docker.io/openim/openim-server:latest
```
For OpenIM Chat:
- Pull from GitHub:
```
bashCopy code
docker pull ghcr.io/openimsdk/openim-chat:latest
```
- Pull from Alibaba Cloud:
```
bashCopy code
docker pull registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest
```
- Pull from Docker Hub:
```
bashCopy code
docker pull docker.io/openim/openim-chat:latest
```
3. Run the `docker images` command to confirm that the image has been successfully pulled.
This concludes OpenIM's image management strategy and the steps for pulling images. If you have any questions, please feel free to ask.

@ -54,4 +54,8 @@ git merge release-v3.1
git push origin main git push origin main
``` ```
Remember, communication with your team is key throughout this process, keeping everyone up-to-date with the changes being made. Remember, communication with your team is key throughout this process, keeping everyone up-to-date with the changes being made.
## Docker images version management

@ -17,14 +17,15 @@ package group
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
"math/big" "math/big"
"math/rand" "math/rand"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
pbConversation "github.com/OpenIMSDK/protocol/conversation" pbConversation "github.com/OpenIMSDK/protocol/conversation"
"github.com/OpenIMSDK/protocol/wrapperspb" "github.com/OpenIMSDK/protocol/wrapperspb"
@ -718,11 +719,11 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup
if err := s.GroupDatabase.HandlerGroupRequest(ctx, req.GroupID, req.FromUserID, req.HandledMsg, req.HandleResult, member); err != nil { if err := s.GroupDatabase.HandlerGroupRequest(ctx, req.GroupID, req.FromUserID, req.HandledMsg, req.HandleResult, member); err != nil {
return nil, err return nil, err
} }
if err := s.conversationRpcClient.GroupChatFirstCreateConversation(ctx, req.GroupID, []string{req.FromUserID}); err != nil {
return nil, err
}
switch req.HandleResult { switch req.HandleResult {
case constant.GroupResponseAgree: case constant.GroupResponseAgree:
if err := s.conversationRpcClient.GroupChatFirstCreateConversation(ctx, req.GroupID, []string{req.FromUserID}); err != nil {
return nil, err
}
s.Notification.GroupApplicationAcceptedNotification(ctx, req) s.Notification.GroupApplicationAcceptedNotification(ctx, req)
case constant.GroupResponseRefuse: case constant.GroupResponseRefuse:
s.Notification.GroupApplicationRejectedNotification(ctx, req) s.Notification.GroupApplicationRejectedNotification(ctx, req)

Loading…
Cancel
Save