🚀 Enhancements in Offline Deployment Documentation, CICD Process Upgrades, Deployment Optimization, and Additional Fixes (#1721)

* feat: support openim prom enbels

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

* feat: support openim prom enbels

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

* feat: support openim prom enbels

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

* feat: support openim prom enbels

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

* feat: support openim prom enbels

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

* feat: support openim prom enbels

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

* feat: support openim prom enbels

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

* feat: support openim prom enbels

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

* feat: add go formity checker

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

* feat: add openim offline deployment docs

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

* feat: add openim offline deployment docs

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

* feat: add openim offline deployment docs

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

* feat: add openim support arm arch

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

* fix: fox openim support arm arch

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

* fix: fox openim support arm arch

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

* feat: add openim v3.4 and v3.5 changelog

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

* feat: add devcontainer.json file

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

* feat: add openim v3.4 and v3.5 changelog

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

* feat: add openim v3.4 and v3.5 changelog

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

* Update util.sh

amend shell get pid command fd on mac.

* feat: Add To start developing OpenIM Docs

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

* docs: update openim readme and dov container

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

* feat: set openim lint

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

* feat: fix go release scripts

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

* feat: fix go release scripts

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

* docs(changelog): add CHANGELOG-3.5.0+6.a09200e.md

* docs(changelog): add CHANGELOG-3.5.0+2.e0bd54f.md

* docs(changelog): add CHANGELOG-3.5.0+2.e0bd54f-1-g4ce6a0fa6.md

* feat: set openim lint

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

* docs(changelog): add CHANGELOG-3.5.0+2.e0bd54f-3-g52f9fc209.md

* docs(changelog): add CHANGELOG-3.5.0+2.e0bd54f-4-g87f685b17.md

* docs(changelog): add CHANGELOG-3.5.0.md

* feat: set openim lint

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

* fix: fix scripts functions upload

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

* fix: fix scripts functions upload

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

* docs(changelog): add CHANGELOG-3.5.0.md

* fix: fix scripts functions upload

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

* fix: fix scripts functions upload

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

* feat: set openim lint

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

---------

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
Co-authored-by: mrwenhui <mr.wenhui@gmail.com>
This commit is contained in:
Xinwei Xiong
2024-01-12 18:04:06 +08:00
committed by GitHub
parent bf46412c5a
commit c795304df1
58 changed files with 3090 additions and 336 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ var (
{"template", "template"},
{"etcd", "server"},
{"pod", "node"},
{"hack/", "hack"},
{"scripts/", "hack"},
{"e2e", "test"},
{"integration", "test"},
{"cluster", "cluster"},
+20 -14
View File
@@ -33,19 +33,20 @@ import (
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio-go/v7"
"github.com/redis/go-redis/v9"
"gopkg.in/yaml.v3"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/redis/go-redis/v9"
"gopkg.in/yaml.v3"
)
const (
// defaultCfgPath is the default path of the configuration file.
defaultCfgPath = "../../../../../config/config.yaml"
minioHealthCheckDuration = 1
maxRetry = 100
maxRetry = 300
componentStartErrCode = 6000
configErrCode = 6001
mongoConnTimeout = 30 * time.Second
)
const (
@@ -55,8 +56,7 @@ const (
)
var (
cfgPath = flag.String("c", defaultCfgPath, "Path to the configuration file")
cfgPath = flag.String("c", defaultCfgPath, "Path to the configuration file")
ErrComponentStart = errs.NewCodeError(componentStartErrCode, "ComponentStartErr")
ErrConfig = errs.NewCodeError(configErrCode, "Config file is incorrect")
)
@@ -95,7 +95,7 @@ func main() {
for i := 0; i < maxRetry; i++ {
if i != 0 {
time.Sleep(3 * time.Second)
time.Sleep(1 * time.Second)
}
fmt.Printf("Checking components Round %v...\n", i+1)
@@ -141,19 +141,25 @@ func getEnv(key, fallback string) string {
return fallback
}
// checkMongo checks the MongoDB connection
// checkMongo checks the MongoDB connection without retries
func checkMongo() (string, error) {
// Use environment variables or fallback to config
uri := getEnv("MONGO_URI", buildMongoURI())
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))
ctx, cancel := context.WithTimeout(context.Background(), mongoConnTimeout)
defer cancel()
str := "ths addr is:" + strings.Join(config.Config.Mongo.Address, ",")
client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri))
if err != nil {
return "", errs.Wrap(errStr(err, str))
}
defer client.Disconnect(context.TODO())
defer client.Disconnect(context.Background())
if err = client.Ping(context.TODO(), nil); err != nil {
ctx, cancel = context.WithTimeout(context.Background(), mongoConnTimeout)
defer cancel()
if err = client.Ping(ctx, nil); err != nil {
return "", errs.Wrap(errStr(err, str))
}
@@ -222,8 +228,8 @@ func checkMinio() (string, error) {
defer cancel()
if minioClient.IsOffline() {
// str := fmt.Sprintf("Minio server is offline;%s", str)
// return "", ErrComponentStart.Wrap(str)
str := fmt.Sprintf("Minio server is offline;%s", str)
return "", ErrComponentStart.Wrap(str)
}
// Check for localhost in API URL and Minio SignEndpoint
+102
View File
@@ -0,0 +1,102 @@
# Development of a Go-Based Conformity Checker for Project File and Directory Naming Standards
### 1. Project Overview
#### Project Name
- `GoConformityChecker`
#### Functionality Description
- Checks if the file and subdirectory names in a specified directory adhere to specific naming conventions.
- Supports specific file types (e.g., `.go`, `.yml`, `.yaml`, `.md`, `.sh`, etc.).
- Allows users to specify directories to be checked and directories to be ignored.
- More read https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/code-conventions.md
#### Naming Conventions
- Go files: Only underscores are allowed.
- YAML, YML, and Markdown files: Only hyphens are allowed.
- Directories: Only underscores are allowed.
### 2. File Structure
- `main.go`: Entry point of the program, handles command-line arguments.
- `checker/checker.go`: Contains the core logic.
- `config/config.go`: Parses and stores configuration information.
### 3. Core Code Design
#### main.go
- Parses command-line arguments, including the directory to be checked and directories to be ignored.
- Calls the `checker` module for checking.
#### config.go
- Defines a configuration structure, such as directories to check and ignore.
#### checker.go
- Iterates through the specified directory.
- Applies different naming rules based on file types and directory names.
- Records files or directories that do not conform to the standards.
### 4. Pseudocode Example
#### main.go
```go
package main
import (
"flag"
"fmt"
"GoConformityChecker/checker"
)
func main() {
// Parse command-line arguments
var targetDir string
var ignoreDirs string
flag.StringVar(&targetDir, "target", ".", "Directory to check")
flag.StringVar(&ignoreDirs, "ignore", "", "Directories to ignore")
flag.Parse()
// Call the checker
err := checker.CheckDirectory(targetDir, ignoreDirs)
if err != nil {
fmt.Println("Error:", err)
}
}
```
#### checker.go
```go
package checker
import (
// Import necessary packages
)
func CheckDirectory(targetDir, ignoreDirs string) error {
// Iterate through the directory, applying rules to check file and directory names
// Return any found errors or non-conformities
return nil
}
```
### 5. Implementation Details
- **File and Directory Traversal**: Use Go's `path/filepath` package to traverse directories and subdirectories.
- **Naming Rules Checking**: Apply different regex expressions for naming checks based on file extensions.
- **Error Handling and Reporting**: Record files or directories that do not conform and report to the user.
### 6. Future Development and Extensions
- Support more file types and naming rules.
- Provide more detailed error reports, such as showing line numbers and specific naming mistakes.
- Add a graphical or web interface for non-command-line users.
The above is an overview of the entire project's design. Following this design, specific coding implementation can begin. Note that the actual implementation may need adjustments based on real-world conditions.
+97
View File
@@ -0,0 +1,97 @@
package checker
import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/openimsdk/open-im-server/tools/formitychecker/config"
)
var (
underscoreRegex = regexp.MustCompile(`^[a-zA-Z0-9_]+\.[a-zA-Z0-9]+$`)
hyphenRegex = regexp.MustCompile(`^[a-zA-Z0-9\-]+\.[a-zA-Z0-9]+$`)
)
// CheckDirectoCheckDirectoryries initiates the checking process for the specified directories using configuration from config.Config.
func CheckDirectory(cfg *config.Config) error {
ignoreMap := make(map[string]struct{})
for _, dir := range cfg.IgnoreDirs {
ignoreMap[dir] = struct{}{}
}
for _, targetDir := range cfg.TargetDirs {
err := filepath.Walk(targetDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
// Skip if the directory is in the ignore list
dirName := filepath.Base(filepath.Dir(path))
if _, ok := ignoreMap[dirName]; ok && info.IsDir() {
return filepath.SkipDir
}
// Check the naming convention
if err := checkNamingConvention(path, info); err != nil {
fmt.Println(err)
}
return nil
})
if err != nil {
return fmt.Errorf("error checking directory '%s': %w", targetDir, err)
}
}
return nil
}
// checkNamingConvention checks if the file or directory name conforms to the standard naming conventions.
func checkNamingConvention(path string, info os.FileInfo) error {
fileName := info.Name()
// Handle special cases for directories like .git
if info.IsDir() && strings.HasPrefix(fileName, ".") {
return nil // Skip special directories
}
// Extract the main part of the name (without extension for files)
mainName := fileName
if !info.IsDir() {
mainName = strings.TrimSuffix(fileName, filepath.Ext(fileName))
}
// Determine the type of file and apply corresponding naming rule
switch {
case info.IsDir():
if !isValidName(mainName, "_") { // Directory names must only contain underscores
return fmt.Errorf("!!! invalid directory name: %s", path)
}
case strings.HasSuffix(fileName, ".go"):
if !isValidName(mainName, "_") { // Go files must only contain underscores
return fmt.Errorf("!!! invalid Go file name: %s", path)
}
case strings.HasSuffix(fileName, ".yml"), strings.HasSuffix(fileName, ".yaml"), strings.HasSuffix(fileName, ".md"):
if !isValidName(mainName, "-") { // YML, YAML, and Markdown files must only contain hyphens
return fmt.Errorf("!!! invalid file name: %s", path)
}
}
return nil
}
// isValidName checks if the file name conforms to the specified rule (underscore or hyphen).
func isValidName(name, charType string) bool {
switch charType {
case "_":
return underscoreRegex.MatchString(name)
case "-":
return hyphenRegex.MatchString(name)
default:
return false
}
}
+27
View File
@@ -0,0 +1,27 @@
package config
import (
"strings"
)
// Config holds all the configuration parameters for the checker.
type Config struct {
TargetDirs []string // Directories to check
IgnoreDirs []string // Directories to ignore
}
// NewConfig creates and returns a new Config instance.
func NewConfig(targetDirs, ignoreDirs string) *Config {
return &Config{
TargetDirs: parseDirs(targetDirs),
IgnoreDirs: parseDirs(ignoreDirs),
}
}
// parseDirs splits a comma-separated string into a slice of directory names.
func parseDirs(dirs string) []string {
if dirs == "" {
return nil
}
return strings.Split(dirs, ",")
}
+27
View File
@@ -0,0 +1,27 @@
package main
import (
"flag"
"fmt"
"github.com/openimsdk/open-im-server/tools/formitychecker/checker"
"github.com/openimsdk/open-im-server/tools/formitychecker/config"
)
func main() {
defaultTargetDirs := "."
defaultIgnoreDirs := "components,.git"
var targetDirs string
var ignoreDirs string
flag.StringVar(&targetDirs, "target", defaultTargetDirs, "Directories to check (default: current directory)")
flag.StringVar(&ignoreDirs, "ignore", defaultIgnoreDirs, "Directories to ignore (default: A/, B/)")
flag.Parse()
conf := config.NewConfig(targetDirs, ignoreDirs)
err := checker.CheckDirectory(conf)
if err != nil {
fmt.Println("Error:", err)
}
}
+3
View File
@@ -0,0 +1,3 @@
module github.com/openimsdk/open-im-server/tools/formitychecker
go 1.19
+8
View File
@@ -0,0 +1,8 @@
package main
import "fmt"
func main() {
fmt.Println("imctl")
}
+35 -35
View File
@@ -17,16 +17,16 @@ package pkg
import (
"time"
mongoModel "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
mysqlModel "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/mysql/v3"
mongoModelRtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
mysqlModelRtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mysql"
mongomodel "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
mysqlmodel "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/mysql/v3"
mongomodelrtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
mysqlmodelrtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mysql"
)
type convert struct{}
func (convert) User(v mysqlModel.UserModel) mongoModel.UserModel {
return mongoModel.UserModel{
func (convert) User(v mysqlmodel.UserModel) mongomodel.UserModel {
return mongomodel.UserModel{
UserID: v.UserID,
Nickname: v.Nickname,
FaceURL: v.FaceURL,
@@ -37,8 +37,8 @@ func (convert) User(v mysqlModel.UserModel) mongoModel.UserModel {
}
}
func (convert) Friend(v mysqlModel.FriendModel) mongoModel.FriendModel {
return mongoModel.FriendModel{
func (convert) Friend(v mysqlmodel.FriendModel) mongomodel.FriendModel {
return mongomodel.FriendModel{
OwnerUserID: v.OwnerUserID,
FriendUserID: v.FriendUserID,
Remark: v.Remark,
@@ -49,8 +49,8 @@ func (convert) Friend(v mysqlModel.FriendModel) mongoModel.FriendModel {
}
}
func (convert) FriendRequest(v mysqlModel.FriendRequestModel) mongoModel.FriendRequestModel {
return mongoModel.FriendRequestModel{
func (convert) FriendRequest(v mysqlmodel.FriendRequestModel) mongomodel.FriendRequestModel {
return mongomodel.FriendRequestModel{
FromUserID: v.FromUserID,
ToUserID: v.ToUserID,
HandleResult: v.HandleResult,
@@ -63,8 +63,8 @@ func (convert) FriendRequest(v mysqlModel.FriendRequestModel) mongoModel.FriendR
}
}
func (convert) Black(v mysqlModel.BlackModel) mongoModel.BlackModel {
return mongoModel.BlackModel{
func (convert) Black(v mysqlmodel.BlackModel) mongomodel.BlackModel {
return mongomodel.BlackModel{
OwnerUserID: v.OwnerUserID,
BlockUserID: v.BlockUserID,
CreateTime: v.CreateTime,
@@ -74,8 +74,8 @@ func (convert) Black(v mysqlModel.BlackModel) mongoModel.BlackModel {
}
}
func (convert) Group(v mysqlModel.GroupModel) mongoModel.GroupModel {
return mongoModel.GroupModel{
func (convert) Group(v mysqlmodel.GroupModel) mongomodel.GroupModel {
return mongomodel.GroupModel{
GroupID: v.GroupID,
GroupName: v.GroupName,
Notification: v.Notification,
@@ -94,8 +94,8 @@ func (convert) Group(v mysqlModel.GroupModel) mongoModel.GroupModel {
}
}
func (convert) GroupMember(v mysqlModel.GroupMemberModel) mongoModel.GroupMemberModel {
return mongoModel.GroupMemberModel{
func (convert) GroupMember(v mysqlmodel.GroupMemberModel) mongomodel.GroupMemberModel {
return mongomodel.GroupMemberModel{
GroupID: v.GroupID,
UserID: v.UserID,
Nickname: v.Nickname,
@@ -110,8 +110,8 @@ func (convert) GroupMember(v mysqlModel.GroupMemberModel) mongoModel.GroupMember
}
}
func (convert) GroupRequest(v mysqlModel.GroupRequestModel) mongoModel.GroupRequestModel {
return mongoModel.GroupRequestModel{
func (convert) GroupRequest(v mysqlmodel.GroupRequestModel) mongomodel.GroupRequestModel {
return mongomodel.GroupRequestModel{
UserID: v.UserID,
GroupID: v.GroupID,
HandleResult: v.HandleResult,
@@ -126,8 +126,8 @@ func (convert) GroupRequest(v mysqlModel.GroupRequestModel) mongoModel.GroupRequ
}
}
func (convert) Conversation(v mysqlModel.ConversationModel) mongoModel.ConversationModel {
return mongoModel.ConversationModel{
func (convert) Conversation(v mysqlmodel.ConversationModel) mongomodel.ConversationModel {
return mongomodel.ConversationModel{
OwnerUserID: v.OwnerUserID,
ConversationID: v.ConversationID,
ConversationType: v.ConversationType,
@@ -149,9 +149,9 @@ func (convert) Conversation(v mysqlModel.ConversationModel) mongoModel.Conversat
}
}
func (convert) Object(engine string) func(v mysqlModel.ObjectModel) mongoModel.ObjectModel {
return func(v mysqlModel.ObjectModel) mongoModel.ObjectModel {
return mongoModel.ObjectModel{
func (convert) Object(engine string) func(v mysqlmodel.ObjectModel) mongomodel.ObjectModel {
return func(v mysqlmodel.ObjectModel) mongomodel.ObjectModel {
return mongomodel.ObjectModel{
Name: v.Name,
UserID: v.UserID,
Hash: v.Hash,
@@ -165,8 +165,8 @@ func (convert) Object(engine string) func(v mysqlModel.ObjectModel) mongoModel.O
}
}
func (convert) Log(v mysqlModel.Log) mongoModel.LogModel {
return mongoModel.LogModel{
func (convert) Log(v mysqlmodel.Log) mongomodel.LogModel {
return mongomodel.LogModel{
LogID: v.LogID,
Platform: v.Platform,
UserID: v.UserID,
@@ -179,8 +179,8 @@ func (convert) Log(v mysqlModel.Log) mongoModel.LogModel {
}
}
func (convert) SignalModel(v mysqlModelRtc.SignalModel) mongoModelRtc.SignalModel {
return mongoModelRtc.SignalModel{
func (convert) SignalModel(v mysqlmodelrtc.SignalModel) mongomodelrtc.SignalModel {
return mongomodelrtc.SignalModel{
SID: v.SID,
InviterUserID: v.InviterUserID,
CustomData: v.CustomData,
@@ -202,8 +202,8 @@ func (convert) SignalModel(v mysqlModelRtc.SignalModel) mongoModelRtc.SignalMode
}
}
func (convert) SignalInvitationModel(v mysqlModelRtc.SignalInvitationModel) mongoModelRtc.SignalInvitationModel {
return mongoModelRtc.SignalInvitationModel{
func (convert) SignalInvitationModel(v mysqlmodelrtc.SignalInvitationModel) mongomodelrtc.SignalInvitationModel {
return mongomodelrtc.SignalInvitationModel{
SID: v.SID,
UserID: v.UserID,
Status: v.Status,
@@ -212,8 +212,8 @@ func (convert) SignalInvitationModel(v mysqlModelRtc.SignalInvitationModel) mong
}
}
func (convert) Meeting(v mysqlModelRtc.MeetingInfo) mongoModelRtc.MeetingInfo {
return mongoModelRtc.MeetingInfo{
func (convert) Meeting(v mysqlmodelrtc.MeetingInfo) mongomodelrtc.MeetingInfo {
return mongomodelrtc.MeetingInfo{
RoomID: v.RoomID,
MeetingName: v.MeetingName,
HostUserID: v.HostUserID,
@@ -225,16 +225,16 @@ func (convert) Meeting(v mysqlModelRtc.MeetingInfo) mongoModelRtc.MeetingInfo {
}
}
func (convert) MeetingInvitationInfo(v mysqlModelRtc.MeetingInvitationInfo) mongoModelRtc.MeetingInvitationInfo {
return mongoModelRtc.MeetingInvitationInfo{
func (convert) MeetingInvitationInfo(v mysqlmodelrtc.MeetingInvitationInfo) mongomodelrtc.MeetingInvitationInfo {
return mongomodelrtc.MeetingInvitationInfo{
RoomID: v.RoomID,
UserID: v.UserID,
CreateTime: v.CreateTime,
}
}
func (convert) MeetingVideoRecord(v mysqlModelRtc.MeetingVideoRecord) mongoModelRtc.MeetingVideoRecord {
return mongoModelRtc.MeetingVideoRecord{
func (convert) MeetingVideoRecord(v mysqlmodelrtc.MeetingVideoRecord) mongomodelrtc.MeetingVideoRecord {
return mongomodelrtc.MeetingVideoRecord{
RoomID: v.RoomID,
FileURL: v.FileURL,
CreateTime: v.CreateTime,
+8 -8
View File
@@ -29,14 +29,14 @@ import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
gormMysql "gorm.io/driver/mysql"
gormmysql "gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/mgo"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/unrelation"
rtcMgo "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/mgo"
rtcmgo "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/mgo"
)
const (
@@ -56,7 +56,7 @@ func InitConfig(path string) error {
func GetMysql() (*gorm.DB, error) {
conf := config.Config.Mysql
mysqlDSN := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", conf.Username, conf.Password, conf.Address[0], conf.Database)
return gorm.Open(gormMysql.Open(mysqlDSN), &gorm.Config{Logger: logger.Discard})
return gorm.Open(gormmysql.Open(mysqlDSN), &gorm.Config{Logger: logger.Discard})
}
func GetMongo() (*mongo.Database, error) {
@@ -116,11 +116,11 @@ func Main(path string) error {
func() error { return NewTask(mysqlDB, mongoDB, mgo.NewS3Mongo, c.Object(config.Config.Object.Enable)) },
func() error { return NewTask(mysqlDB, mongoDB, mgo.NewLogMongo, c.Log) },
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewSignal, c.SignalModel) },
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewSignalInvitation, c.SignalInvitationModel) },
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewMeeting, c.Meeting) },
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewMeetingInvitation, c.MeetingInvitationInfo) },
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewMeetingRecord, c.MeetingVideoRecord) },
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewSignal, c.SignalModel) },
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewSignalInvitation, c.SignalInvitationModel) },
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewMeeting, c.Meeting) },
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewMeetingInvitation, c.MeetingInvitationInfo) },
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewMeetingRecord, c.MeetingVideoRecord) },
)
for _, task := range tasks {
-10
View File
@@ -1,10 +0,0 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- cubxxw
- kubbot
approvers:
- cubxxw
labels:
- sig/testing
- sig/contributor-experience