mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 19:02:31 +08:00
Merge branch 'openimsdk:main' into main
This commit is contained in:
commit
2d295e2f75
1
.github/workflows/openimci.yml
vendored
1
.github/workflows/openimci.yml
vendored
@ -201,7 +201,6 @@ jobs:
|
|||||||
- name: Build, Start, Check Services and Print Logs for Ubuntu
|
- name: Build, Start, Check Services and Print Logs for Ubuntu
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: |
|
run: |
|
||||||
sudo make init && \
|
|
||||||
sudo make build && \
|
sudo make build && \
|
||||||
sudo make start && \
|
sudo make start && \
|
||||||
sudo make check || \
|
sudo make check || \
|
||||||
|
|||||||
@ -506,7 +506,7 @@ callback:
|
|||||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||||
prometheus:
|
prometheus:
|
||||||
enable: false
|
enable: false
|
||||||
prometheusUrl: 172.28.0.1:13000
|
grafanaUrl: 172.28.0.1:13000
|
||||||
apiPrometheusPort: [20100]
|
apiPrometheusPort: [20100]
|
||||||
userPrometheusPort: [ 20110 ]
|
userPrometheusPort: [ 20110 ]
|
||||||
friendPrometheusPort: [ 20120 ]
|
friendPrometheusPort: [ 20120 ]
|
||||||
|
|||||||
@ -1,42 +1,23 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# -----------------------------------------------------------------------------
|
||||||
#
|
# General Configuration
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# This section contains general configuration options for the entire environment.
|
||||||
# you may not use this file except in compliance with the License.
|
# These options can be set via environment variables. If both environment variables
|
||||||
# You may obtain a copy of the License at
|
# and settings in this .env file exist, the environment variables take precedence.
|
||||||
#
|
# -----------------------------------------------------------------------------
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# ==========================
|
||||||
#
|
# General Configuration
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# ==========================
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# These settings apply to the overall environment.
|
||||||
# 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.
|
|
||||||
|
|
||||||
# ======================================
|
# Data storage directory for persistent data.
|
||||||
# ========= Basic Configuration ========
|
# Example: DATA_DIR=/path/to/data
|
||||||
# ======================================
|
|
||||||
|
|
||||||
# The user for authentication or system operations.
|
|
||||||
# Default: OPENIM_USER=root
|
|
||||||
USER=${OPENIM_USER}
|
|
||||||
|
|
||||||
# Password associated with the specified user for authentication.
|
|
||||||
# Default: PASSWORD=openIM123
|
|
||||||
PASSWORD=${PASSWORD}
|
|
||||||
|
|
||||||
# Base URL for the application programming interface (API).
|
|
||||||
# Default: API_URL=http://172.28.0.1:10002
|
|
||||||
API_URL=${API_URL}
|
|
||||||
|
|
||||||
# Directory path for storing data files or related information.
|
|
||||||
# Default: DATA_DIR=./
|
|
||||||
DATA_DIR=${DATA_DIR}
|
DATA_DIR=${DATA_DIR}
|
||||||
|
|
||||||
# Choose the appropriate image address, the default is GITHUB image,
|
# Docker image registry. Uncomment the preferred one.
|
||||||
# you can choose docker hub, for Chinese users can choose Ali Cloud
|
# Options: ghcr.io/openimsdk, openim, registry.cn-hangzhou.aliyuncs.com/openimsdk
|
||||||
# export IMAGE_REGISTRY="ghcr.io/openimsdk"
|
# IMAGE_REGISTRY="ghcr.io/openimsdk"
|
||||||
# export IMAGE_REGISTRY="openim"
|
# IMAGE_REGISTRY="openim"
|
||||||
# export IMAGE_REGISTRY="registry.cn-hangzhou.aliyuncs.com/openimsdk"
|
# IMAGE_REGISTRY="registry.cn-hangzhou.aliyuncs.com/openimsdk"
|
||||||
IMAGE_REGISTRY=${IMAGE_REGISTRY}
|
IMAGE_REGISTRY=${IMAGE_REGISTRY}
|
||||||
|
|
||||||
# ======================================
|
# ======================================
|
||||||
@ -47,10 +28,9 @@ IMAGE_REGISTRY=${IMAGE_REGISTRY}
|
|||||||
# Default: DOCKER_BRIDGE_SUBNET=172.28.0.0/16
|
# Default: DOCKER_BRIDGE_SUBNET=172.28.0.0/16
|
||||||
DOCKER_BRIDGE_SUBNET=${DOCKER_BRIDGE_SUBNET}
|
DOCKER_BRIDGE_SUBNET=${DOCKER_BRIDGE_SUBNET}
|
||||||
|
|
||||||
# Gateway for the Docker network.
|
# Set and specify the IP addresses of some containers. Generally speaking,
|
||||||
# Default: DOCKER_BRIDGE_GATEWAY=172.28.0.1
|
# you do not need to modify these configurations to facilitate debugging
|
||||||
DOCKER_BRIDGE_GATEWAY=${DOCKER_BRIDGE_GATEWAY}
|
DOCKER_BRIDGE_GATEWAY=${DOCKER_BRIDGE_GATEWAY}
|
||||||
|
|
||||||
MONGO_NETWORK_ADDRESS=${MONGO_NETWORK_ADDRESS}
|
MONGO_NETWORK_ADDRESS=${MONGO_NETWORK_ADDRESS}
|
||||||
REDIS_NETWORK_ADDRESS=${REDIS_NETWORK_ADDRESS}
|
REDIS_NETWORK_ADDRESS=${REDIS_NETWORK_ADDRESS}
|
||||||
KAFKA_NETWORK_ADDRESS=${KAFKA_NETWORK_ADDRESS}
|
KAFKA_NETWORK_ADDRESS=${KAFKA_NETWORK_ADDRESS}
|
||||||
@ -65,25 +45,45 @@ NODE_EXPORTER_NETWORK_ADDRESS=${NODE_EXPORTER_NETWORK_ADDRESS}
|
|||||||
OPENIM_ADMIN_FRONT_NETWORK_ADDRESS=${OPENIM_ADMIN_FRONT_NETWORK_ADDRESS}
|
OPENIM_ADMIN_FRONT_NETWORK_ADDRESS=${OPENIM_ADMIN_FRONT_NETWORK_ADDRESS}
|
||||||
ALERT_MANAGER_NETWORK_ADDRESS=${ALERT_MANAGER_NETWORK_ADDRESS}
|
ALERT_MANAGER_NETWORK_ADDRESS=${ALERT_MANAGER_NETWORK_ADDRESS}
|
||||||
|
|
||||||
# ===============================================
|
# ==============================================================================
|
||||||
# = Component Extension Configuration =
|
# Configuration Update Instructions
|
||||||
# ===============================================
|
# ==============================================================================
|
||||||
|
# This header outlines the methods to update common variables in config.yaml and .env files.
|
||||||
|
# These instructions are vital for maintaining the OpenIM environment's configuration.
|
||||||
|
#
|
||||||
|
# METHOD 1: Regenerate All Configurations
|
||||||
|
# ----------------------------------------
|
||||||
|
# Use this method to regenerate all configurations.
|
||||||
|
# Steps:
|
||||||
|
# 1. Delete existing config files:
|
||||||
|
# - openim-server/config/config.yaml
|
||||||
|
# - openim-chat/config/config.yaml
|
||||||
|
# 2. Modify the .env file as required.
|
||||||
|
# 3. Run 'docker compose up -d'. This will regenerate:
|
||||||
|
# - config/config.yaml
|
||||||
|
#
|
||||||
|
# METHOD 2: Modify Individual Configuration Files
|
||||||
|
# -----------------------------------------------
|
||||||
|
# Use this method to update specific configuration files.
|
||||||
|
# Steps:
|
||||||
|
# 1. Modify the .env file as necessary.
|
||||||
|
# 2. Update the corresponding entries in:
|
||||||
|
# - config/config.yaml
|
||||||
|
# 3. Restart the services with 'docker compose up -d'.
|
||||||
|
# 4. Special Note: If you modify OPENIM_IP, API_OPENIM_PORT, or MINIO_PORT in .env,
|
||||||
|
# ensure to update the corresponding services and configurations accordingly.
|
||||||
|
#
|
||||||
|
# It is essential to follow these methods to ensure consistent and correct application behavior.
|
||||||
|
# ==============================================================================
|
||||||
|
# Local IP address of the service. Modify if necessary.
|
||||||
|
# Example: OPENIM_IP=172.28.0.1,
|
||||||
|
OPENIM_IP=${OPENIM_IP}
|
||||||
|
|
||||||
# ============ Component Extension Configuration ==========
|
|
||||||
# ----- ZooKeeper Configuration -----
|
# ----- ZooKeeper Configuration -----
|
||||||
# Address or hostname for the ZooKeeper service.
|
|
||||||
# Default: ZOOKEEPER_ADDRESS=172.28.0.1
|
|
||||||
ZOOKEEPER_ADDRESS=${ZOOKEEPER_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Port for ZooKeeper service.
|
# Port for ZooKeeper service.
|
||||||
# Default: ZOOKEEPER_PORT=12181
|
# Default: ZOOKEEPER_PORT=12181
|
||||||
ZOOKEEPER_PORT=${ZOOKEEPER_PORT}
|
ZOOKEEPER_PORT=${ZOOKEEPER_PORT}
|
||||||
|
|
||||||
# ----- MongoDB Configuration -----
|
|
||||||
# Address or hostname for the MongoDB service.
|
|
||||||
# Default: MONGO_ADDRESS=172.28.0.1
|
|
||||||
MONGO_ADDRESS=${MONGO_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Port on which MongoDB service is running.
|
# Port on which MongoDB service is running.
|
||||||
# Default: MONGO_PORT=37017
|
# Default: MONGO_PORT=37017
|
||||||
# MONGO_PORT=${MONGO_PORT}
|
# MONGO_PORT=${MONGO_PORT}
|
||||||
@ -101,9 +101,6 @@ MONGO_PASSWORD=${MONGO_PASSWORD}
|
|||||||
MONGO_DATABASE=${MONGO_DATABASE}
|
MONGO_DATABASE=${MONGO_DATABASE}
|
||||||
|
|
||||||
# ----- Redis Configuration -----
|
# ----- Redis Configuration -----
|
||||||
# Address or hostname for the Redis service.
|
|
||||||
# Default: REDIS_ADDRESS=172.28.0.1
|
|
||||||
REDIS_ADDRESS=${REDIS_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Port on which Redis in-memory data structure store is running.
|
# Port on which Redis in-memory data structure store is running.
|
||||||
# Default: REDIS_PORT=16379
|
# Default: REDIS_PORT=16379
|
||||||
@ -113,11 +110,6 @@ REDIS_PORT=${REDIS_PORT}
|
|||||||
# Default: REDIS_PASSWORD=openIM123
|
# Default: REDIS_PASSWORD=openIM123
|
||||||
REDIS_PASSWORD=${REDIS_PASSWORD}
|
REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||||
|
|
||||||
# ----- Kafka Configuration -----
|
|
||||||
# Address or hostname for the Kafka service.
|
|
||||||
# Default: KAFKA_ADDRESS=172.28.0.1
|
|
||||||
KAFKA_ADDRESS=${KAFKA_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Kakfa username to authenticate with the Kafka service.
|
# Kakfa username to authenticate with the Kafka service.
|
||||||
# KAFKA_USERNAME=${KAFKA_USERNAME}
|
# KAFKA_USERNAME=${KAFKA_USERNAME}
|
||||||
|
|
||||||
@ -129,20 +121,13 @@ KAFKA_PORT=${KAFKA_PORT}
|
|||||||
# Default: KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
|
# Default: KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
|
||||||
KAFKA_LATESTMSG_REDIS_TOPIC=${KAFKA_LATESTMSG_REDIS_TOPIC}
|
KAFKA_LATESTMSG_REDIS_TOPIC=${KAFKA_LATESTMSG_REDIS_TOPIC}
|
||||||
|
|
||||||
# Topic in Kafka for pushing messages (e.g. notifications or updates).
|
# MINIO_PORT
|
||||||
# Default: KAFKA_MSG_PUSH_TOPIC=msgToPush
|
# ----------
|
||||||
KAFKA_MSG_PUSH_TOPIC=${KAFKA_MSG_PUSH_TOPIC}
|
# MINIO_PORT sets the port for the MinIO object storage service.
|
||||||
|
# Upon changing this port, the MinIO endpoint URLs in the `config/config.yaml` file must be updated
|
||||||
# Topic in Kafka for storing offline messages in MongoDB.
|
# to reflect this change. The endpoints include both the 'endpoint' and 'signEndpoint'
|
||||||
# Default: KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
|
# under the MinIO configuration.
|
||||||
KAFKA_OFFLINEMSG_MONGO_TOPIC=${KAFKA_OFFLINEMSG_MONGO_TOPIC}
|
#
|
||||||
|
|
||||||
# ----- MinIO Configuration ----
|
|
||||||
# Address or hostname for the MinIO object storage service.
|
|
||||||
# Default: MINIO_ADDRESS=172.28.0.1
|
|
||||||
MINIO_ADDRESS=${MINIO_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Port on which MinIO object storage service is running.
|
|
||||||
# Default: MINIO_PORT=10005
|
# Default: MINIO_PORT=10005
|
||||||
MINIO_PORT=${MINIO_PORT}
|
MINIO_PORT=${MINIO_PORT}
|
||||||
|
|
||||||
@ -155,19 +140,11 @@ MINIO_PORT=${MINIO_PORT}
|
|||||||
MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
|
MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
|
||||||
|
|
||||||
# ----- Prometheus Configuration -----
|
# ----- Prometheus Configuration -----
|
||||||
# Address or hostname for the Prometheus service.
|
|
||||||
# Default: PROMETHEUS_ADDRESS=172.28.0.1
|
|
||||||
PROMETHEUS_ADDRESS=${PROMETHEUS_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Port on which Prometheus service is running.
|
# Port on which Prometheus service is running.
|
||||||
# Default: PROMETHEUS_PORT=19090
|
# Default: PROMETHEUS_PORT=19090
|
||||||
PROMETHEUS_PORT=${PROMETHEUS_PORT}
|
PROMETHEUS_PORT=${PROMETHEUS_PORT}
|
||||||
|
|
||||||
# ----- Grafana Configuration -----
|
# ----- Grafana Configuration -----
|
||||||
# Address or hostname for the Grafana service.
|
|
||||||
# Default: GRAFANA_ADDRESS=172.28.0.1
|
|
||||||
GRAFANA_ADDRESS=${GRAFANA_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Port on which Grafana service is running.
|
# Port on which Grafana service is running.
|
||||||
# Default: GRAFANA_PORT=13000
|
# Default: GRAFANA_PORT=13000
|
||||||
GRAFANA_PORT=${GRAFANA_PORT}
|
GRAFANA_PORT=${GRAFANA_PORT}
|
||||||
@ -184,23 +161,19 @@ OPENIM_WEB_DIST_PATH=${OPENIM_WEB_DIST_PATH}
|
|||||||
# Default: OPENIM_WEB_PORT=11001
|
# Default: OPENIM_WEB_PORT=11001
|
||||||
OPENIM_WEB_PORT=${OPENIM_WEB_PORT}
|
OPENIM_WEB_PORT=${OPENIM_WEB_PORT}
|
||||||
|
|
||||||
# Address or hostname for the OpenIM web service.
|
|
||||||
# Default: OPENIM_WEB_ADDRESS=172.28.0.1
|
|
||||||
OPENIM_WEB_ADDRESS=${OPENIM_WEB_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# ======================================
|
# ======================================
|
||||||
# ========= OpenIM Server ==============
|
# ========= OpenIM Server ==============
|
||||||
# ======================================
|
# ======================================
|
||||||
|
|
||||||
# Address or hostname for the OpenIM server.
|
|
||||||
# Default: OPENIM_SERVER_ADDRESS=172.28.0.1
|
|
||||||
OPENIM_SERVER_ADDRESS=${OPENIM_SERVER_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Port for the OpenIM WebSockets.
|
# Port for the OpenIM WebSockets.
|
||||||
# Default: OPENIM_WS_PORT=10001
|
# Default: OPENIM_WS_PORT=10001
|
||||||
OPENIM_WS_PORT=${OPENIM_WS_PORT}
|
OPENIM_WS_PORT=${OPENIM_WS_PORT}
|
||||||
|
|
||||||
# Port for the OpenIM API.
|
# API_OPENIM_PORT
|
||||||
|
# ---------------
|
||||||
|
# This variable defines the port on which the OpenIM API service will listen.
|
||||||
|
# When changing this port, it's essential to update the apiURL in the config.yaml file
|
||||||
|
# to ensure the API service is accessible at the new port.
|
||||||
|
#
|
||||||
# Default: API_OPENIM_PORT=10002
|
# Default: API_OPENIM_PORT=10002
|
||||||
API_OPENIM_PORT=${API_OPENIM_PORT}
|
API_OPENIM_PORT=${API_OPENIM_PORT}
|
||||||
|
|
||||||
@ -213,10 +186,6 @@ API_OPENIM_PORT=${API_OPENIM_PORT}
|
|||||||
# Default: CHAT_IMAGE_VERSION=main
|
# Default: CHAT_IMAGE_VERSION=main
|
||||||
CHAT_IMAGE_VERSION=${CHAT_IMAGE_VERSION}
|
CHAT_IMAGE_VERSION=${CHAT_IMAGE_VERSION}
|
||||||
|
|
||||||
# Address or hostname for the OpenIM chat service.
|
|
||||||
# Default: OPENIM_CHAT_ADDRESS=172.28.0.1
|
|
||||||
OPENIM_CHAT_ADDRESS=${OPENIM_CHAT_NETWORK_ADDRESS}
|
|
||||||
|
|
||||||
# Port for the OpenIM chat API.
|
# Port for the OpenIM chat API.
|
||||||
# Default: OPENIM_CHAT_API_PORT=10008
|
# Default: OPENIM_CHAT_API_PORT=10008
|
||||||
OPENIM_CHAT_API_PORT=${OPENIM_CHAT_API_PORT}
|
OPENIM_CHAT_API_PORT=${OPENIM_CHAT_API_PORT}
|
||||||
@ -225,7 +194,6 @@ OPENIM_CHAT_API_PORT=${OPENIM_CHAT_API_PORT}
|
|||||||
# Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main
|
# Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main
|
||||||
OPENIM_CHAT_DATA_DIR=${OPENIM_CHAT_DATA_DIR}
|
OPENIM_CHAT_DATA_DIR=${OPENIM_CHAT_DATA_DIR}
|
||||||
|
|
||||||
|
|
||||||
# ======================================
|
# ======================================
|
||||||
# ========== OpenIM Admin ==============
|
# ========== OpenIM Admin ==============
|
||||||
# ======================================
|
# ======================================
|
||||||
|
|||||||
@ -506,7 +506,7 @@ callback:
|
|||||||
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||||
prometheus:
|
prometheus:
|
||||||
enable: ${PROMETHEUS_ENABLE}
|
enable: ${PROMETHEUS_ENABLE}
|
||||||
prometheusUrl: ${PROMETHEUS_URL}
|
grafanaUrl: ${GRAFANA_URL}
|
||||||
apiPrometheusPort: [${API_PROM_PORT}]
|
apiPrometheusPort: [${API_PROM_PORT}]
|
||||||
userPrometheusPort: [ ${USER_PROM_PORT} ]
|
userPrometheusPort: [ ${USER_PROM_PORT} ]
|
||||||
friendPrometheusPort: [ ${FRIEND_PROM_PORT} ]
|
friendPrometheusPort: [ ${FRIEND_PROM_PORT} ]
|
||||||
|
|||||||
@ -122,9 +122,9 @@ services:
|
|||||||
server:
|
server:
|
||||||
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS:-172.28.0.7}
|
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS:-172.28.0.7}
|
||||||
|
|
||||||
# Uncomment and configure the following services as needed
|
## Uncomment and configure the following services as needed
|
||||||
# openim-admin:
|
# openim-admin:
|
||||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-admin-front:v3.4.0
|
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-admin:toc-base-open-docker.35
|
||||||
# container_name: openim-admin
|
# container_name: openim-admin
|
||||||
# restart: always
|
# restart: always
|
||||||
# ports:
|
# ports:
|
||||||
@ -167,6 +167,12 @@ services:
|
|||||||
# hostname: grafana
|
# hostname: grafana
|
||||||
# user: root
|
# user: root
|
||||||
# restart: always
|
# restart: always
|
||||||
|
# environment:
|
||||||
|
# - GF_SECURITY_ALLOW_EMBEDDING=true
|
||||||
|
# - GF_SESSION_COOKIE_SAMESITE=none
|
||||||
|
# - GF_SESSION_COOKIE_SECURE=true
|
||||||
|
# - GF_AUTH_ANONYMOUS_ENABLED=true
|
||||||
|
# - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
|
||||||
# ports:
|
# ports:
|
||||||
# - "${GRAFANA_PORT:-13000}:3000"
|
# - "${GRAFANA_PORT:-13000}:3000"
|
||||||
# volumes:
|
# volumes:
|
||||||
|
|||||||
4
go.mod
4
go.mod
@ -4,7 +4,7 @@ go 1.19
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
firebase.google.com/go v3.13.0+incompatible
|
firebase.google.com/go v3.13.0+incompatible
|
||||||
github.com/OpenIMSDK/protocol v0.0.40
|
github.com/OpenIMSDK/protocol v0.0.42
|
||||||
github.com/OpenIMSDK/tools v0.0.21
|
github.com/OpenIMSDK/tools v0.0.21
|
||||||
github.com/bwmarrin/snowflake v0.3.0 // indirect
|
github.com/bwmarrin/snowflake v0.3.0 // indirect
|
||||||
github.com/dtm-labs/rockscache v0.1.1
|
github.com/dtm-labs/rockscache v0.1.1
|
||||||
@ -156,5 +156,3 @@ require (
|
|||||||
golang.org/x/crypto v0.14.0 // indirect
|
golang.org/x/crypto v0.14.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/OpenIMSDK/protocol v0.0.40 => github.com/luhaoling/protocol v0.0.0-20231227040641-2f934a0d64a3
|
|
||||||
|
|||||||
6
go.sum
6
go.sum
@ -18,8 +18,8 @@ firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIw
|
|||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/IBM/sarama v1.41.3 h1:MWBEJ12vHC8coMjdEXFq/6ftO6DUZnQlFYcxtOJFa7c=
|
github.com/IBM/sarama v1.41.3 h1:MWBEJ12vHC8coMjdEXFq/6ftO6DUZnQlFYcxtOJFa7c=
|
||||||
github.com/IBM/sarama v1.41.3/go.mod h1:Xxho9HkHd4K/MDUo/T/sOqwtX/17D33++E9Wib6hUdQ=
|
github.com/IBM/sarama v1.41.3/go.mod h1:Xxho9HkHd4K/MDUo/T/sOqwtX/17D33++E9Wib6hUdQ=
|
||||||
github.com/OpenIMSDK/protocol v0.0.40 h1:1/Oij6RSAaePCPrWGwp9Cyz976/8Uxr94hM5M5FXzlg=
|
github.com/OpenIMSDK/protocol v0.0.42 h1:vIWXqZJZZ1ddleJA25fxhjZ1GyEHATpYM3wVWh4/+PY=
|
||||||
github.com/OpenIMSDK/protocol v0.0.40/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
github.com/OpenIMSDK/protocol v0.0.42/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
||||||
github.com/OpenIMSDK/tools v0.0.21 h1:iTapc2mIEVH/xl5Nd6jfwPub11Pgp44tVcE1rjB3a48=
|
github.com/OpenIMSDK/tools v0.0.21 h1:iTapc2mIEVH/xl5Nd6jfwPub11Pgp44tVcE1rjB3a48=
|
||||||
github.com/OpenIMSDK/tools v0.0.21/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
|
github.com/OpenIMSDK/tools v0.0.21/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
|
||||||
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
|
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
|
||||||
@ -227,8 +227,6 @@ github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205Ah
|
|||||||
github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw=
|
github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw=
|
||||||
github.com/lithammer/shortuuid v3.0.0+incompatible h1:NcD0xWW/MZYXEHa6ITy6kaXN5nwm/V115vj2YXfhS0w=
|
github.com/lithammer/shortuuid v3.0.0+incompatible h1:NcD0xWW/MZYXEHa6ITy6kaXN5nwm/V115vj2YXfhS0w=
|
||||||
github.com/lithammer/shortuuid v3.0.0+incompatible/go.mod h1:FR74pbAuElzOUuenUHTK2Tciko1/vKuIKS9dSkDrA4w=
|
github.com/lithammer/shortuuid v3.0.0+incompatible/go.mod h1:FR74pbAuElzOUuenUHTK2Tciko1/vKuIKS9dSkDrA4w=
|
||||||
github.com/luhaoling/protocol v0.0.0-20231227040641-2f934a0d64a3 h1:HZz2U/M3T4x9SqPxWdrD9MZy7jxx7nS+nx/aRN9m3RQ=
|
|
||||||
github.com/luhaoling/protocol v0.0.0-20231227040641-2f934a0d64a3/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
|
||||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||||
|
|||||||
@ -33,6 +33,10 @@ func (o *ConversationApi) GetAllConversations(c *gin.Context) {
|
|||||||
a2r.Call(conversation.ConversationClient.GetAllConversations, o.Client, c)
|
a2r.Call(conversation.ConversationClient.GetAllConversations, o.Client, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *ConversationApi) GetConversationsList(c *gin.Context) {
|
||||||
|
a2r.Call(conversation.ConversationClient.GetConversationList, o.Client, c)
|
||||||
|
}
|
||||||
|
|
||||||
func (o *ConversationApi) GetConversation(c *gin.Context) {
|
func (o *ConversationApi) GetConversation(c *gin.Context) {
|
||||||
a2r.Call(conversation.ConversationClient.GetConversation, o.Client, c)
|
a2r.Call(conversation.ConversationClient.GetConversation, o.Client, c)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -250,13 +250,14 @@ func (m *MessageApi) SendBusinessNotification(c *gin.Context) {
|
|||||||
req := struct {
|
req := struct {
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
SendUserID string `json:"sendUserID"`
|
SendUserID string `json:"sendUserID" binding:"required"`
|
||||||
RecvUserID string `json:"recvUserID"`
|
RecvUserID string `json:"recvUserID" binding:"required"`
|
||||||
}{}
|
}{}
|
||||||
if err := c.BindJSON(&req); err != nil {
|
if err := c.BindJSON(&req); err != nil {
|
||||||
apiresp.GinError(c, errs.ErrArgs.WithDetail(err.Error()).Wrap())
|
apiresp.GinError(c, errs.ErrArgs.WithDetail(err.Error()).Wrap())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !authverify.IsAppManagerUid(c) {
|
if !authverify.IsAppManagerUid(c) {
|
||||||
apiresp.GinError(c, errs.ErrNoPermission.Wrap("only app manager can send message"))
|
apiresp.GinError(c, errs.ErrNoPermission.Wrap("only app manager can send message"))
|
||||||
return
|
return
|
||||||
|
|||||||
@ -204,6 +204,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
|
|||||||
conversationGroup := r.Group("/conversation", ParseToken)
|
conversationGroup := r.Group("/conversation", ParseToken)
|
||||||
{
|
{
|
||||||
c := NewConversationApi(*conversationRpc)
|
c := NewConversationApi(*conversationRpc)
|
||||||
|
conversationGroup.POST("/get_conversations_list", c.GetConversationsList)
|
||||||
conversationGroup.POST("/get_all_conversations", c.GetAllConversations)
|
conversationGroup.POST("/get_all_conversations", c.GetAllConversations)
|
||||||
conversationGroup.POST("/get_conversation", c.GetConversation)
|
conversationGroup.POST("/get_conversation", c.GetConversation)
|
||||||
conversationGroup.POST("/get_conversations", c.GetConversations)
|
conversationGroup.POST("/get_conversations", c.GetConversations)
|
||||||
|
|||||||
@ -130,5 +130,5 @@ func (o *ThirdApi) SearchLogs(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetPrometheus(c *gin.Context) {
|
func GetPrometheus(c *gin.Context) {
|
||||||
c.Redirect(http.StatusFound, config2.Config.Prometheus.PrometheusUrl)
|
c.Redirect(http.StatusFound, config2.Config.Prometheus.GrafanaUrl)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,8 @@ package conversation
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/OpenIMSDK/protocol/sdkws"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/tools/tx"
|
"github.com/OpenIMSDK/tools/tx"
|
||||||
|
|
||||||
@ -41,6 +43,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type conversationServer struct {
|
type conversationServer struct {
|
||||||
|
msgRpcClient *rpcclient.MessageRpcClient
|
||||||
|
user *rpcclient.UserRpcClient
|
||||||
groupRpcClient *rpcclient.GroupRpcClient
|
groupRpcClient *rpcclient.GroupRpcClient
|
||||||
conversationDatabase controller.ConversationDatabase
|
conversationDatabase controller.ConversationDatabase
|
||||||
conversationNotificationSender *notification.ConversationNotificationSender
|
conversationNotificationSender *notification.ConversationNotificationSender
|
||||||
@ -61,7 +65,10 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
|
|||||||
}
|
}
|
||||||
groupRpcClient := rpcclient.NewGroupRpcClient(client)
|
groupRpcClient := rpcclient.NewGroupRpcClient(client)
|
||||||
msgRpcClient := rpcclient.NewMessageRpcClient(client)
|
msgRpcClient := rpcclient.NewMessageRpcClient(client)
|
||||||
|
userRpcClient := rpcclient.NewUserRpcClient(client)
|
||||||
pbconversation.RegisterConversationServer(server, &conversationServer{
|
pbconversation.RegisterConversationServer(server, &conversationServer{
|
||||||
|
msgRpcClient: &msgRpcClient,
|
||||||
|
user: &userRpcClient,
|
||||||
conversationNotificationSender: notification.NewConversationNotificationSender(&msgRpcClient),
|
conversationNotificationSender: notification.NewConversationNotificationSender(&msgRpcClient),
|
||||||
groupRpcClient: &groupRpcClient,
|
groupRpcClient: &groupRpcClient,
|
||||||
conversationDatabase: controller.NewConversationDatabase(conversationDB, cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), conversationDB), tx.NewMongo(mongo.GetClient())),
|
conversationDatabase: controller.NewConversationDatabase(conversationDB, cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), conversationDB), tx.NewMongo(mongo.GetClient())),
|
||||||
@ -82,6 +89,73 @@ func (c *conversationServer) GetConversation(ctx context.Context, req *pbconvers
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *conversationServer) GetConversationList(ctx context.Context, req *pbconversation.GetConversationListReq) (resp *pbconversation.GetConversationListResp, err error) {
|
||||||
|
log.ZDebug(ctx, "GetConversationList", "seqs", req, "userID", req.UserID)
|
||||||
|
var conversationIDs []string
|
||||||
|
if len(req.ConversationIDs) == 0 {
|
||||||
|
conversationIDs, err = m.conversationDatabase.GetConversationIDs(ctx, req.UserID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
conversationIDs = req.ConversationIDs
|
||||||
|
}
|
||||||
|
|
||||||
|
conversations, err := m.conversationDatabase.FindConversations(ctx, req.UserID, conversationIDs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(conversations) == 0 {
|
||||||
|
return nil, errs.ErrRecordNotFound.Wrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
maxSeqs, err := m.msgRpcClient.GetMaxSeqs(ctx, conversationIDs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
chatLogs, err := m.msgRpcClient.GetMsgByConversationIDs(ctx, conversationIDs, maxSeqs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
conversationMsg, err := m.getConversationInfo(ctx, chatLogs, req.UserID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
hasReadSeqs, err := m.msgRpcClient.GetHasReadSeqs(ctx, req.UserID, conversationIDs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
conversation_unreadCount := make(map[string]int64)
|
||||||
|
for conversationID, maxSeq := range maxSeqs {
|
||||||
|
conversation_unreadCount[conversationID] = maxSeq - hasReadSeqs[conversationID]
|
||||||
|
}
|
||||||
|
|
||||||
|
conversation_isPinkTime := make(map[int64]string)
|
||||||
|
conversation_notPinkTime := make(map[int64]string)
|
||||||
|
for _, v := range conversations {
|
||||||
|
conversationID := v.ConversationID
|
||||||
|
time := conversationMsg[conversationID].MsgInfo.LatestMsgRecvTime
|
||||||
|
conversationMsg[conversationID].RecvMsgOpt = v.RecvMsgOpt
|
||||||
|
if v.IsPinned {
|
||||||
|
conversationMsg[conversationID].IsPinned = v.IsPinned
|
||||||
|
conversation_isPinkTime[time] = conversationID
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
conversation_notPinkTime[time] = conversationID
|
||||||
|
}
|
||||||
|
resp = &pbconversation.GetConversationListResp{
|
||||||
|
ConversationElems: []*pbconversation.ConversationElem{},
|
||||||
|
}
|
||||||
|
|
||||||
|
m.conversationSort(conversation_isPinkTime, resp, conversation_unreadCount, conversationMsg)
|
||||||
|
m.conversationSort(conversation_notPinkTime, resp, conversation_unreadCount, conversationMsg)
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *conversationServer) GetAllConversations(ctx context.Context, req *pbconversation.GetAllConversationsReq) (*pbconversation.GetAllConversationsResp, error) {
|
func (c *conversationServer) GetAllConversations(ctx context.Context, req *pbconversation.GetAllConversationsReq) (*pbconversation.GetAllConversationsResp, error) {
|
||||||
conversations, err := c.conversationDatabase.GetUserAllConversation(ctx, req.OwnerUserID)
|
conversations, err := c.conversationDatabase.GetUserAllConversation(ctx, req.OwnerUserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -348,3 +422,102 @@ func (c *conversationServer) GetConversationOfflinePushUserIDs(
|
|||||||
}
|
}
|
||||||
return &pbconversation.GetConversationOfflinePushUserIDsResp{UserIDs: utils.Keys(userIDSet)}, nil
|
return &pbconversation.GetConversationOfflinePushUserIDsResp{UserIDs: utils.Keys(userIDSet)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *conversationServer) conversationSort(
|
||||||
|
conversations map[int64]string,
|
||||||
|
resp *pbconversation.GetConversationListResp,
|
||||||
|
conversation_unreadCount map[string]int64,
|
||||||
|
conversationMsg map[string]*pbconversation.ConversationElem,
|
||||||
|
) {
|
||||||
|
keys := []int64{}
|
||||||
|
for key := range conversations {
|
||||||
|
keys = append(keys, key)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(keys[:], func(i, j int) bool {
|
||||||
|
return keys[i] > keys[j]
|
||||||
|
})
|
||||||
|
index := 0
|
||||||
|
|
||||||
|
cons := make([]*pbconversation.ConversationElem, len(conversations))
|
||||||
|
for _, v := range keys {
|
||||||
|
conversationID := conversations[v]
|
||||||
|
conversationElem := conversationMsg[conversationID]
|
||||||
|
conversationElem.UnreadCount = conversation_unreadCount[conversationID]
|
||||||
|
cons[index] = conversationElem
|
||||||
|
index++
|
||||||
|
}
|
||||||
|
resp.ConversationElems = append(resp.ConversationElems, cons...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *conversationServer) getConversationInfo(
|
||||||
|
ctx context.Context,
|
||||||
|
chatLogs map[string]*sdkws.MsgData,
|
||||||
|
userID string) (map[string]*pbconversation.ConversationElem, error) {
|
||||||
|
var (
|
||||||
|
sendIDs []string
|
||||||
|
groupIDs []string
|
||||||
|
sendMap = make(map[string]*sdkws.UserInfo)
|
||||||
|
groupMap = make(map[string]*sdkws.GroupInfo)
|
||||||
|
conversationMsg = make(map[string]*pbconversation.ConversationElem)
|
||||||
|
)
|
||||||
|
for _, chatLog := range chatLogs {
|
||||||
|
switch chatLog.SessionType {
|
||||||
|
case constant.SingleChatType:
|
||||||
|
if chatLog.SendID == userID {
|
||||||
|
sendIDs = append(sendIDs, chatLog.RecvID)
|
||||||
|
}
|
||||||
|
sendIDs = append(sendIDs, chatLog.SendID)
|
||||||
|
case constant.GroupChatType, constant.SuperGroupChatType:
|
||||||
|
groupIDs = append(groupIDs, chatLog.GroupID)
|
||||||
|
sendIDs = append(sendIDs, chatLog.SendID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(sendIDs) != 0 {
|
||||||
|
sendInfos, err := c.user.GetUsersInfo(ctx, sendIDs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, sendInfo := range sendInfos {
|
||||||
|
sendMap[sendInfo.UserID] = sendInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(groupIDs) != 0 {
|
||||||
|
groupInfos, err := c.groupRpcClient.GetGroupInfos(ctx, groupIDs, false)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, groupInfo := range groupInfos {
|
||||||
|
groupMap[groupInfo.GroupID] = groupInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for conversationID, chatLog := range chatLogs {
|
||||||
|
pbchatLog := &pbconversation.ConversationElem{}
|
||||||
|
msgInfo := &pbconversation.MsgInfo{}
|
||||||
|
if err := utils.CopyStructFields(msgInfo, chatLog); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
switch chatLog.SessionType {
|
||||||
|
case constant.SingleChatType:
|
||||||
|
if chatLog.SendID == userID {
|
||||||
|
msgInfo.FaceURL = sendMap[chatLog.RecvID].FaceURL
|
||||||
|
msgInfo.SenderName = sendMap[chatLog.RecvID].Nickname
|
||||||
|
break
|
||||||
|
}
|
||||||
|
msgInfo.FaceURL = sendMap[chatLog.SendID].FaceURL
|
||||||
|
msgInfo.SenderName = sendMap[chatLog.SendID].Nickname
|
||||||
|
case constant.GroupChatType, constant.SuperGroupChatType:
|
||||||
|
msgInfo.GroupName = groupMap[chatLog.GroupID].GroupName
|
||||||
|
msgInfo.GroupFaceURL = groupMap[chatLog.GroupID].FaceURL
|
||||||
|
msgInfo.GroupMemberCount = groupMap[chatLog.GroupID].MemberCount
|
||||||
|
msgInfo.GroupID = chatLog.GroupID
|
||||||
|
msgInfo.GroupType = groupMap[chatLog.GroupID].GroupType
|
||||||
|
msgInfo.SenderName = sendMap[chatLog.SendID].Nickname
|
||||||
|
}
|
||||||
|
pbchatLog.ConversationID = conversationID
|
||||||
|
msgInfo.LatestMsgRecvTime = chatLog.SendTime
|
||||||
|
pbchatLog.MsgInfo = msgInfo
|
||||||
|
conversationMsg[conversationID] = pbchatLog
|
||||||
|
}
|
||||||
|
return conversationMsg, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
utils2 "github.com/OpenIMSDK/tools/utils"
|
utils2 "github.com/OpenIMSDK/tools/utils"
|
||||||
|
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
|
|
||||||
@ -26,8 +27,6 @@ import (
|
|||||||
"github.com/OpenIMSDK/protocol/sdkws"
|
"github.com/OpenIMSDK/protocol/sdkws"
|
||||||
"github.com/OpenIMSDK/tools/errs"
|
"github.com/OpenIMSDK/tools/errs"
|
||||||
"github.com/OpenIMSDK/tools/log"
|
"github.com/OpenIMSDK/tools/log"
|
||||||
|
|
||||||
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *msg.GetConversationsHasReadAndMaxSeqReq) (resp *msg.GetConversationsHasReadAndMaxSeqResp, err error) {
|
func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *msg.GetConversationsHasReadAndMaxSeqReq) (resp *msg.GetConversationsHasReadAndMaxSeqResp, err error) {
|
||||||
|
|||||||
@ -16,7 +16,6 @@ package msg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
pbmsg "github.com/OpenIMSDK/protocol/msg"
|
pbmsg "github.com/OpenIMSDK/protocol/msg"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,3 +29,27 @@ func (m *msgServer) GetConversationMaxSeq(
|
|||||||
}
|
}
|
||||||
return &pbmsg.GetConversationMaxSeqResp{MaxSeq: maxSeq}, nil
|
return &pbmsg.GetConversationMaxSeqResp{MaxSeq: maxSeq}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *msgServer) GetMaxSeqs(ctx context.Context, req *pbmsg.GetMaxSeqsReq) (*pbmsg.SeqsInfoResp, error) {
|
||||||
|
maxSeqs, err := m.MsgDatabase.GetMaxSeqs(ctx, req.ConversationIDs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &pbmsg.SeqsInfoResp{MaxSeqs: maxSeqs}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *msgServer) GetHasReadSeqs(ctx context.Context, req *pbmsg.GetHasReadSeqsReq) (*pbmsg.SeqsInfoResp, error) {
|
||||||
|
hasReadSeqs, err := m.MsgDatabase.GetHasReadSeqs(ctx, req.UserID, req.ConversationIDs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &pbmsg.SeqsInfoResp{MaxSeqs: hasReadSeqs}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *msgServer) GetMsgByConversationIDs(ctx context.Context, req *pbmsg.GetMsgByConversationIDsReq) (*pbmsg.GetMsgByConversationIDsResp, error) {
|
||||||
|
Msgs, err := m.MsgDatabase.FindOneByDocIDs(ctx, req.ConversationIDs, req.MaxSeqs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &pbmsg.GetMsgByConversationIDsResp{MsgDatas: Msgs}, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -16,7 +16,6 @@ package user
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
pbuser "github.com/OpenIMSDK/protocol/user"
|
pbuser "github.com/OpenIMSDK/protocol/user"
|
||||||
"github.com/OpenIMSDK/tools/utils"
|
"github.com/OpenIMSDK/tools/utils"
|
||||||
|
|
||||||
@ -67,16 +66,16 @@ func CallbackBeforeUpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUserI
|
|||||||
cbReq := &cbapi.CallbackBeforeUpdateUserInfoExReq{
|
cbReq := &cbapi.CallbackBeforeUpdateUserInfoExReq{
|
||||||
CallbackCommand: cbapi.CallbackBeforeUpdateUserInfoExCommand,
|
CallbackCommand: cbapi.CallbackBeforeUpdateUserInfoExCommand,
|
||||||
UserID: req.UserInfo.UserID,
|
UserID: req.UserInfo.UserID,
|
||||||
FaceURL: &req.UserInfo.FaceURL,
|
FaceURL: req.UserInfo.FaceURL,
|
||||||
Nickname: &req.UserInfo.Nickname,
|
Nickname: req.UserInfo.Nickname,
|
||||||
}
|
}
|
||||||
resp := &cbapi.CallbackBeforeUpdateUserInfoExResp{}
|
resp := &cbapi.CallbackBeforeUpdateUserInfoExResp{}
|
||||||
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeUpdateUserInfoEx); err != nil {
|
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeUpdateUserInfoEx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
utils.NotNilReplace(&req.UserInfo.FaceURL, resp.FaceURL)
|
utils.NotNilReplace(req.UserInfo.FaceURL, resp.FaceURL)
|
||||||
utils.NotNilReplace(req.UserInfo.Ex, resp.Ex)
|
utils.NotNilReplace(req.UserInfo.Ex, resp.Ex)
|
||||||
utils.NotNilReplace(&req.UserInfo.Nickname, resp.Nickname)
|
utils.NotNilReplace(req.UserInfo.Nickname, resp.Nickname)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func CallbackAfterUpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUserInfoExReq) error {
|
func CallbackAfterUpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUserInfoExReq) error {
|
||||||
|
|||||||
@ -168,7 +168,7 @@ func (s *userServer) UpdateUserInfoEx(ctx context.Context, req *pbuser.UpdateUse
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if req.UserInfo.Nickname != "" || req.UserInfo.FaceURL != "" {
|
if req.UserInfo.Nickname != nil || req.UserInfo.FaceURL != nil {
|
||||||
if err := s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil {
|
if err := s.groupRpcClient.NotificationUserInfoUpdate(ctx, req.UserInfo.UserID); err != nil {
|
||||||
log.ZError(ctx, "NotificationUserInfoUpdate", err)
|
log.ZError(ctx, "NotificationUserInfoUpdate", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,6 +64,30 @@ type SendMsgReq struct {
|
|||||||
SendMsg
|
SendMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetConversationListReq struct {
|
||||||
|
// userID uniquely identifies the user.
|
||||||
|
UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty" binding:"required"`
|
||||||
|
|
||||||
|
// ConversationIDs contains a list of unique identifiers for conversations.
|
||||||
|
ConversationIDs []string `protobuf:"bytes,2,rep,name=conversationIDs,proto3" json:"conversationIDs,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetConversationListResp struct {
|
||||||
|
// ConversationElems is a map that associates conversation IDs with their respective details.
|
||||||
|
ConversationElems map[string]*ConversationElem `protobuf:"bytes,1,rep,name=conversationElems,proto3" json:"conversationElems,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConversationElem struct {
|
||||||
|
// MaxSeq represents the maximum sequence number within the conversation.
|
||||||
|
MaxSeq int64 `protobuf:"varint,1,opt,name=maxSeq,proto3" json:"maxSeq,omitempty"`
|
||||||
|
|
||||||
|
// UnreadSeq represents the number of unread messages in the conversation.
|
||||||
|
UnreadSeq int64 `protobuf:"varint,2,opt,name=unreadSeq,proto3" json:"unreadSeq,omitempty"`
|
||||||
|
|
||||||
|
// LastSeqTime represents the timestamp of the last sequence in the conversation.
|
||||||
|
LastSeqTime int64 `protobuf:"varint,3,opt,name=LastSeqTime,proto3" json:"LastSeqTime,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// BatchSendMsgReq defines the structure for sending a message to multiple recipients.
|
// BatchSendMsgReq defines the structure for sending a message to multiple recipients.
|
||||||
type BatchSendMsgReq struct {
|
type BatchSendMsgReq struct {
|
||||||
SendMsg
|
SendMsg
|
||||||
|
|||||||
@ -47,22 +47,22 @@ type CallbackAfterUpdateUserInfoResp struct {
|
|||||||
type CallbackBeforeUpdateUserInfoExReq struct {
|
type CallbackBeforeUpdateUserInfoExReq struct {
|
||||||
CallbackCommand `json:"callbackCommand"`
|
CallbackCommand `json:"callbackCommand"`
|
||||||
UserID string `json:"userID"`
|
UserID string `json:"userID"`
|
||||||
Nickname *string `json:"nickName"`
|
Nickname *wrapperspb.StringValue `json:"nickName"`
|
||||||
FaceURL *string `json:"faceURL"`
|
FaceURL *wrapperspb.StringValue `json:"faceURL"`
|
||||||
Ex *wrapperspb.StringValue `json:"ex"`
|
Ex *wrapperspb.StringValue `json:"ex"`
|
||||||
}
|
}
|
||||||
type CallbackBeforeUpdateUserInfoExResp struct {
|
type CallbackBeforeUpdateUserInfoExResp struct {
|
||||||
CommonCallbackResp
|
CommonCallbackResp
|
||||||
Nickname *string `json:"nickName"`
|
Nickname *wrapperspb.StringValue `json:"nickName"`
|
||||||
FaceURL *string `json:"faceURL"`
|
FaceURL *wrapperspb.StringValue `json:"faceURL"`
|
||||||
Ex *wrapperspb.StringValue `json:"ex"`
|
Ex *wrapperspb.StringValue `json:"ex"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CallbackAfterUpdateUserInfoExReq struct {
|
type CallbackAfterUpdateUserInfoExReq struct {
|
||||||
CallbackCommand `json:"callbackCommand"`
|
CallbackCommand `json:"callbackCommand"`
|
||||||
UserID string `json:"userID"`
|
UserID string `json:"userID"`
|
||||||
Nickname string `json:"nickName"`
|
Nickname *wrapperspb.StringValue `json:"nickName"`
|
||||||
FaceURL string `json:"faceURL"`
|
FaceURL *wrapperspb.StringValue `json:"faceURL"`
|
||||||
Ex *wrapperspb.StringValue `json:"ex"`
|
Ex *wrapperspb.StringValue `json:"ex"`
|
||||||
}
|
}
|
||||||
type CallbackAfterUpdateUserInfoExResp struct {
|
type CallbackAfterUpdateUserInfoExResp struct {
|
||||||
|
|||||||
@ -314,7 +314,7 @@ type configStruct struct {
|
|||||||
|
|
||||||
Prometheus struct {
|
Prometheus struct {
|
||||||
Enable bool `yaml:"enable"`
|
Enable bool `yaml:"enable"`
|
||||||
PrometheusUrl string `yaml:"prometheusUrl"`
|
GrafanaUrl string `yaml:"grafanaUrl"`
|
||||||
ApiPrometheusPort []int `yaml:"apiPrometheusPort"`
|
ApiPrometheusPort []int `yaml:"apiPrometheusPort"`
|
||||||
UserPrometheusPort []int `yaml:"userPrometheusPort"`
|
UserPrometheusPort []int `yaml:"userPrometheusPort"`
|
||||||
FriendPrometheusPort []int `yaml:"friendPrometheusPort"`
|
FriendPrometheusPort []int `yaml:"friendPrometheusPort"`
|
||||||
|
|||||||
@ -79,14 +79,17 @@ func UserPb2DBMapEx(user *sdkws.UserInfoWithEx) map[string]any {
|
|||||||
val := make(map[string]any)
|
val := make(map[string]any)
|
||||||
|
|
||||||
// Map fields from UserInfoWithEx to val
|
// Map fields from UserInfoWithEx to val
|
||||||
val["nickname"] = user.Nickname
|
if user.Nickname != nil {
|
||||||
val["face_url"] = user.FaceURL
|
val["nickname"] = user.Nickname.Value
|
||||||
|
}
|
||||||
|
if user.FaceURL != nil {
|
||||||
|
val["face_url"] = user.FaceURL.Value
|
||||||
|
}
|
||||||
if user.Ex != nil {
|
if user.Ex != nil {
|
||||||
val["ex"] = user.Ex.Value
|
val["ex"] = user.Ex.Value
|
||||||
}
|
}
|
||||||
if user.GlobalRecvMsgOpt != 0 {
|
if user.GlobalRecvMsgOpt != nil {
|
||||||
val["global_recv_msg_opt"] = user.GlobalRecvMsgOpt
|
val["global_recv_msg_opt"] = user.GlobalRecvMsgOpt.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
return val
|
return val
|
||||||
|
|||||||
@ -98,6 +98,7 @@ type CommonMsgDatabase interface {
|
|||||||
SetSendMsgStatus(ctx context.Context, id string, status int32) error
|
SetSendMsgStatus(ctx context.Context, id string, status int32) error
|
||||||
GetSendMsgStatus(ctx context.Context, id string) (int32, error)
|
GetSendMsgStatus(ctx context.Context, id string) (int32, error)
|
||||||
SearchMessage(ctx context.Context, req *pbmsg.SearchMessageReq) (total int32, msgData []*sdkws.MsgData, err error)
|
SearchMessage(ctx context.Context, req *pbmsg.SearchMessageReq) (total int32, msgData []*sdkws.MsgData, err error)
|
||||||
|
FindOneByDocIDs(ctx context.Context, docIDs []string, seqs map[string]int64) (map[string]*sdkws.MsgData, error)
|
||||||
|
|
||||||
// to mq
|
// to mq
|
||||||
MsgToMQ(ctx context.Context, key string, msg2mq *sdkws.MsgData) error
|
MsgToMQ(ctx context.Context, key string, msg2mq *sdkws.MsgData) error
|
||||||
@ -1051,6 +1052,21 @@ func (db *commonMsgDatabase) SearchMessage(ctx context.Context, req *pbmsg.Searc
|
|||||||
return total, totalMsgs, nil
|
return total, totalMsgs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *commonMsgDatabase) FindOneByDocIDs(ctx context.Context, conversationIDs []string, seqs map[string]int64) (map[string]*sdkws.MsgData, error) {
|
||||||
|
totalMsgs := make(map[string]*sdkws.MsgData)
|
||||||
|
for _, conversationID := range conversationIDs {
|
||||||
|
seq := seqs[conversationID]
|
||||||
|
docID := db.msg.GetDocID(conversationID, seq)
|
||||||
|
msgs, err := db.msgDocDatabase.FindOneByDocID(ctx, docID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
index := db.msg.GetMsgIndex(seq)
|
||||||
|
totalMsgs[conversationID] = convert.MsgDB2Pb(msgs.Msg[index].Msg)
|
||||||
|
}
|
||||||
|
return totalMsgs, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (db *commonMsgDatabase) ConvertMsgsDocLen(ctx context.Context, conversationIDs []string) {
|
func (db *commonMsgDatabase) ConvertMsgsDocLen(ctx context.Context, conversationIDs []string) {
|
||||||
db.msgDocDatabase.ConvertMsgsDocLen(ctx, conversationIDs)
|
db.msgDocDatabase.ConvertMsgsDocLen(ctx, conversationIDs)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,14 +55,17 @@ func (cli *K8sDR) Register(serviceName, host string, port int, opts ...grpc.Dial
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *K8sDR) UnRegister() error {
|
func (cli *K8sDR) UnRegister() error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *K8sDR) CreateRpcRootNodes(serviceNames []string) error {
|
func (cli *K8sDR) CreateRpcRootNodes(serviceNames []string) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *K8sDR) RegisterConf2Registry(key string, conf []byte) error {
|
func (cli *K8sDR) RegisterConf2Registry(key string, conf []byte) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -123,6 +126,8 @@ func getMsgGatewayHost(ctx context.Context) []string {
|
|||||||
log.ZInfo(ctx, "getMsgGatewayHost", "instance", instance, "selfPodName", selfPodName, "replicas", replicas, "ns", ns, "ret", ret)
|
log.ZInfo(ctx, "getMsgGatewayHost", "instance", instance, "selfPodName", selfPodName, "replicas", replicas, "ns", ns, "ret", ret)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetConns returns the gRPC client connections to the specified service.
|
||||||
func (cli *K8sDR) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error) {
|
func (cli *K8sDR) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error) {
|
||||||
|
|
||||||
if serviceName != config.Config.RpcRegisterName.OpenImMessageGatewayName {
|
if serviceName != config.Config.RpcRegisterName.OpenImMessageGatewayName {
|
||||||
@ -142,6 +147,7 @@ func (cli *K8sDR) GetConns(ctx context.Context, serviceName string, opts ...grpc
|
|||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *K8sDR) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
|
func (cli *K8sDR) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
|
||||||
|
|
||||||
return grpc.DialContext(ctx, serviceName, append(cli.options, opts...)...)
|
return grpc.DialContext(ctx, serviceName, append(cli.options, opts...)...)
|
||||||
@ -151,9 +157,11 @@ func (cli *K8sDR) GetSelfConnTarget() string {
|
|||||||
|
|
||||||
return cli.rpcRegisterAddr
|
return cli.rpcRegisterAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *K8sDR) AddOption(opts ...grpc.DialOption) {
|
func (cli *K8sDR) AddOption(opts ...grpc.DialOption) {
|
||||||
cli.options = append(cli.options, opts...)
|
cli.options = append(cli.options, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *K8sDR) CloseConn(conn *grpc.ClientConn) {
|
func (cli *K8sDR) CloseConn(conn *grpc.ClientConn) {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,6 @@ package rpcclient
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
@ -157,6 +156,30 @@ func (m *MessageRpcClient) GetMaxSeq(ctx context.Context, req *sdkws.GetMaxSeqRe
|
|||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *MessageRpcClient) GetMaxSeqs(ctx context.Context, conversationIDs []string) (map[string]int64, error) {
|
||||||
|
log.ZDebug(ctx, "GetMaxSeqs", "conversationIDs", conversationIDs)
|
||||||
|
resp, err := m.Client.GetMaxSeqs(ctx, &msg.GetMaxSeqsReq{
|
||||||
|
ConversationIDs: conversationIDs,
|
||||||
|
})
|
||||||
|
return resp.MaxSeqs, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MessageRpcClient) GetHasReadSeqs(ctx context.Context, userID string, conversationIDs []string) (map[string]int64, error) {
|
||||||
|
resp, err := m.Client.GetHasReadSeqs(ctx, &msg.GetHasReadSeqsReq{
|
||||||
|
UserID: userID,
|
||||||
|
ConversationIDs: conversationIDs,
|
||||||
|
})
|
||||||
|
return resp.MaxSeqs, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MessageRpcClient) GetMsgByConversationIDs(ctx context.Context, docIDs []string, seqs map[string]int64) (map[string]*sdkws.MsgData, error) {
|
||||||
|
resp, err := m.Client.GetMsgByConversationIDs(ctx, &msg.GetMsgByConversationIDsReq{
|
||||||
|
ConversationIDs: docIDs,
|
||||||
|
MaxSeqs: seqs,
|
||||||
|
})
|
||||||
|
return resp.MsgDatas, err
|
||||||
|
}
|
||||||
|
|
||||||
func (m *MessageRpcClient) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) {
|
func (m *MessageRpcClient) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) {
|
||||||
resp, err := m.Client.PullMessageBySeqs(ctx, req)
|
resp, err := m.Client.PullMessageBySeqs(ctx, req)
|
||||||
return resp, err
|
return resp, err
|
||||||
|
|||||||
@ -30,29 +30,32 @@ OPENIM_VERBOSE=4
|
|||||||
|
|
||||||
openim::log::info "\n# Begin to check all openim service"
|
openim::log::info "\n# Begin to check all openim service"
|
||||||
|
|
||||||
# OpenIM status
|
# Elegant printing function
|
||||||
# Elegant printing function
|
# Elegant printing function
|
||||||
print_services_and_ports() {
|
print_services_and_ports() {
|
||||||
service_names=("$1[@]")
|
local service_names=("$@")
|
||||||
service_ports=("$2[@]")
|
local half_length=$((${#service_names[@]} / 2))
|
||||||
|
local service_ports=("${service_names[@]:half_length}")
|
||||||
|
|
||||||
echo "+-------------------------+----------+"
|
echo "+-------------------------+----------+"
|
||||||
echo "| Service Name | Port |"
|
echo "| Service Name | Port |"
|
||||||
echo "+-------------------------+----------+"
|
echo "+-------------------------+----------+"
|
||||||
|
|
||||||
for index in "${!service_names}"; do
|
for ((index=0; index < half_length; index++)); do
|
||||||
printf "| %-23s | %-8s |\n" "${!service_names[$index]}" "${!service_ports[$index]}"
|
printf "| %-23s | %-8s |\n" "${service_names[$index]}" "${service_ports[$index]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "+-------------------------+----------+"
|
echo "+-------------------------+----------+"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Assuming OPENIM_SERVER_NAME_TARGETS and OPENIM_SERVER_PORT_TARGETS are defined
|
||||||
|
# Similarly for OPENIM_DEPENDENCY_TARGETS and OPENIM_DEPENDENCY_PORT_TARGETS
|
||||||
|
|
||||||
# Print out services and their ports
|
# Print out services and their ports
|
||||||
print_services_and_ports OPENIM_SERVER_NAME_TARGETS OPENIM_SERVER_PORT_TARGETS
|
print_services_and_ports "${OPENIM_SERVER_NAME_TARGETS[@]}" "${OPENIM_SERVER_PORT_TARGETS[@]}"
|
||||||
|
|
||||||
# Print out dependencies and their ports
|
# Print out dependencies and their ports
|
||||||
print_services_and_ports OPENIM_DEPENDENCY_TARGETS OPENIM_DEPENDENCY_PORT_TARGETS
|
print_services_and_ports "${OPENIM_DEPENDENCY_TARGETS[@]}" "${OPENIM_DEPENDENCY_PORT_TARGETS[@]}"
|
||||||
|
|
||||||
|
|
||||||
# OpenIM check
|
# OpenIM check
|
||||||
echo "++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
echo "++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}"
|
||||||
|
|||||||
@ -285,7 +285,6 @@ readonly ALERTMANAGER_SEND_RESOLVED=${ALERTMANAGER_SEND_RESOLVED:-"{SEND_RESOLVE
|
|||||||
###################### Grafana 配置信息 ######################
|
###################### Grafana 配置信息 ######################
|
||||||
def "GRAFANA_PORT" "13000" # Grafana的端口
|
def "GRAFANA_PORT" "13000" # Grafana的端口
|
||||||
def "GRAFANA_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Grafana的地址
|
def "GRAFANA_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Grafana的地址
|
||||||
|
|
||||||
###################### RPC Port Configuration Variables ######################
|
###################### RPC Port Configuration Variables ######################
|
||||||
# For launching multiple programs, just fill in multiple ports separated by commas
|
# For launching multiple programs, just fill in multiple ports separated by commas
|
||||||
# For example:
|
# For example:
|
||||||
@ -378,8 +377,8 @@ def "CALLBACK_TIMEOUT" "5" # 最长超时时间
|
|||||||
def "CALLBACK_FAILED_CONTINUE" "true" # 失败后是否继续
|
def "CALLBACK_FAILED_CONTINUE" "true" # 失败后是否继续
|
||||||
###################### Prometheus 配置信息 ######################
|
###################### Prometheus 配置信息 ######################
|
||||||
# 是否启用 Prometheus
|
# 是否启用 Prometheus
|
||||||
readonly PROMETHEUS_ENABLE=${PROMETHEUS_ENABLE:-'false'}
|
readonly PROMETHEUS_ENABLE=${PROMETHEUS_ENABLE:-'true'}
|
||||||
def "PROMETHEUS_URL" "${GRAFANA_ADDRESS}:${GRAFANA_PORT}"
|
readonly GRAFANA_URL=${GRAFANA_URL:-"http://${OPENIM_IP}:${GRAFANA_PORT}/"}
|
||||||
# Api 服务的 Prometheus 端口
|
# Api 服务的 Prometheus 端口
|
||||||
readonly API_PROM_PORT=${API_PROM_PORT:-'20100'}
|
readonly API_PROM_PORT=${API_PROM_PORT:-'20100'}
|
||||||
# User 服务的 Prometheus 端口
|
# User 服务的 Prometheus 端口
|
||||||
|
|||||||
@ -223,8 +223,8 @@ func checkMinio() (string, error) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
if minioClient.IsOffline() {
|
if minioClient.IsOffline() {
|
||||||
str := fmt.Sprintf("Minio server is offline;%s", str)
|
// str := fmt.Sprintf("Minio server is offline;%s", str)
|
||||||
return "", ErrComponentStart.Wrap(str)
|
// return "", ErrComponentStart.Wrap(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for localhost in API URL and Minio SignEndpoint
|
// Check for localhost in API URL and Minio SignEndpoint
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user