Compare commits

...

10 Commits

Author SHA1 Message Date
Xinwei Xiong(cubxxw-openim) a0d1c47e42 fix: config env command
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-28 14:19:21 +08:00
Xinwei Xiong(cubxxw-openim) 6922520545 feat: add test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-27 21:30:04 +08:00
Xinwei Xiong(cubxxw-openim) 246a1f0314 feat: add test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-27 21:08:59 +08:00
Xinwei Xiong(cubxxw-openim) 5eb97766b6 feat: add go relase
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-27 20:45:01 +08:00
wangchuxiao 340ce42b17 fix bug: reject group req bug 2023-07-27 20:27:05 +08:00
Xinwei Xiong(cubxxw-openim) e9f5752e29 feat: add test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-27 16:27:43 +08:00
Xinwei Xiong(cubxxw-openim) c509f7d4d2 feat: add test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-27 16:16:13 +08:00
Xinwei Xiong(cubxxw-openim) 692ff29a0c feat: add script yaml
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-27 15:51:57 +08:00
Xinwei Xiong(cubxxw-openim) de641f574c feat: add script yaml
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-27 15:36:24 +08:00
Xinwei Xiong(cubxxw-openim) 57374a4df4 docs: add readme docs
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-07-27 15:36:24 +08:00
8 changed files with 187 additions and 105 deletions
+45 -55
View File
@@ -18,6 +18,7 @@ on:
push:
branches:
- main
- release-*
tags:
- v*
workflow_dispatch:
@@ -29,82 +30,71 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v3
- name: Build OpenIM Server
run: |
sudo make build
# docker.io/openim/openim-server:latest
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.6.0
with:
images: openim/openim-server
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: openim/openim-server
tags: latest
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v4
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# 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
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALIREGISTRY_USERNAME }}
password: ${{ secrets.ALIREGISTRY_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta2
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server
tags: latest
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v4
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.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
# 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
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta3.outputs.tags }}
labels: ${{ steps.meta3.outputs.labels }}
+53 -39
View File
@@ -12,48 +12,62 @@
# See the License for the specific language governing permissions and
# limitations under the License.
name: deploy for dev
name: OpenIM Deploy for dev
on:
push:
branches:
- 'devops' # Only for the dev branch
paths:
- '.github/workflows/*'
# - '__test__/**' # dev No immediate testing is required
- 'src/**'
- 'Dockerfile'
- 'docker-compose.yml'
- 'bin/*'
push:
branches:
- 'devops' # Only for the dev branch
- 'main'
paths:
- '.github/workflows/*'
# - '__test__/**' # dev No immediate testing is required
- 'src/**'
- 'Dockerfile'
- 'docker-compose.yml'
- 'bin/*'
jobs:
deploy-dev:
runs-on: ubuntu-latest
deploy-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.0.0
env:
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
with:
host: "${{ secrets.SG_M1_HOST }}, ${{ secrets.SG_N1_HOST }}, ${{ secrets.SG_N2_HOST}}"
username: ${{ secrets.SG_USERNAME }}
password: ${{ secrets.SG_PASSWORD }}
port: ${{ secrets.SG_PORT }}
envs: OWNER,REPO
script_stop: true
script: |
mkdir -p /test/openim
cd /test/openim
pwd;ls -al
echo "OWNER: $OWNER"
echo "REPO: $REPO"
git clone -b develop https://github.com/${OWNER}/${REPO}.git; cd ${REPO}
docker compose up -d
steps:
- uses: actions/checkout@v2
- name: set ssh key # Temporarily set up ssh key
run: |
mkdir -p ~/.ssh/
# secrets.WFP_ID_RSA set in GitHub
echo "${{secrets.WFP_ID_RSA}}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan "182.92.xxx.xxx" >> ~/.ssh/known_hosts
- name: deploy # Deployment
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
# - name: deploy # Deployment
# 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
+5 -2
View File
@@ -337,8 +337,8 @@ changelog:
dockers:
- image_templates:
- "openimsdk/open-im-server:{{ .Tag }}-amd64"
- "ghcr.io/goreleaser/goreleaser:{{ .Tag }}-amd64"
- "openim/openim-server:{{ .Tag }}-amd64"
- "ghcr.io/openimsdk/openim-server:{{ .Tag }}-amd64"
dockerfile: Dockerfile
use: buildx
build_flag_templates:
@@ -480,6 +480,9 @@ checksum:
release:
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 }}
## Helping out
+2 -1
View File
@@ -22,7 +22,8 @@ RUN /bin/sh -c "make build"
# Production Stage
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
VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"]
+2 -2
View File
@@ -126,10 +126,10 @@ api:
# Configuration for Aliyun OSS
object:
enable: "minio"
apiURL: "http://127.0.0.1:10002/object/"
apiURL: http://113.99.98.99:10002/object/
minio:
bucket: "openim"
endpoint: http://127.0.0.1:10005
endpoint: http://113.99.98.99:10005
accessKeyID: root
secretAccessKey: openIM123
sessionToken: ""
+69
View File
@@ -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.
+5 -1
View File
@@ -54,4 +54,8 @@ git merge release-v3.1
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
+6 -5
View File
@@ -17,14 +17,15 @@ package group
import (
"context"
"fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
"math/big"
"math/rand"
"strconv"
"strings"
"time"
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
pbConversation "github.com/OpenIMSDK/protocol/conversation"
"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 {
return nil, err
}
if err := s.conversationRpcClient.GroupChatFirstCreateConversation(ctx, req.GroupID, []string{req.FromUserID}); err != nil {
return nil, err
}
switch req.HandleResult {
case constant.GroupResponseAgree:
if err := s.conversationRpcClient.GroupChatFirstCreateConversation(ctx, req.GroupID, []string{req.FromUserID}); err != nil {
return nil, err
}
s.Notification.GroupApplicationAcceptedNotification(ctx, req)
case constant.GroupResponseRefuse:
s.Notification.GroupApplicationRejectedNotification(ctx, req)