diff --git a/.env b/.env index 7fdf0e3b3..75f9707da 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ USER=root PASSWORD=openIM123 MINIO_ENDPOINT=http://127.0.0.1:10005 -DATA_DIR=./ \ No newline at end of file +DATA_DIR=./ diff --git a/deployk8s/auth/auth.Dockerfile b/deployk8s/auth/auth.Dockerfile index 15eafd782..16e6d9058 100644 --- a/deployk8s/auth/auth.Dockerfile +++ b/deployk8s/auth/auth.Dockerfile @@ -12,7 +12,7 @@ ADD ./open_im_auth $WORKDIR/cmd/main RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \ chmod +x $WORKDIR/cmd/main -VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"] +VOLUME ["/Open-IM-Server/config","/Open-IM-Server/script"] WORKDIR $CMDDIR diff --git a/deployk8s/conversation/conversation.Dockerfile b/deployk8s/conversation/conversation.Dockerfile index bea8d4b00..4576fc98a 100644 --- a/deployk8s/conversation/conversation.Dockerfile +++ b/deployk8s/conversation/conversation.Dockerfile @@ -12,7 +12,7 @@ ADD ./open_im_conversation $WORKDIR/cmd/main RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \ chmod +x $WORKDIR/cmd/main -VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"] +VOLUME ["/Open-IM-Server/config","/Open-IM-Server/script"] WORKDIR $CMDDIR CMD ./main \ No newline at end of file diff --git a/deployk8s/k8s_openim_deploy.md b/deployk8s/k8s_openim_deploy.md index f637f8272..7da7b1815 100644 --- a/deployk8s/k8s_openim_deploy.md +++ b/deployk8s/k8s_openim_deploy.md @@ -1,4 +1,4 @@ -#### openIM k8s部署文档 +# openIM k8s部署文档 ### 1. 修改配置文件 在Open-IM-SERVER根目录下修改config/config.yaml配置文件, 请确保以下修改的所有地址必须保证k8s pod能够访问 1. 修改ETCD配置为自己的ETCD ip地址, 最好和k8s本身使用的ETCD分开 diff --git a/docker-compose.yaml b/docker-compose.yaml index 0abdab9ad..38a37cdc6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -100,12 +100,12 @@ services: open_im_server: - image: openim/open_im_server:v2.3.6 + image: openim/open_im_server:v3.0.0 container_name: open_im_server volumes: - ./logs:/Open-IM-Server/logs - ./config/config.yaml:/Open-IM-Server/config/config.yaml - - ./config/usualConfig.yaml:/Open-IM-Server/config/usualConfig.yaml + - ./config/notification.yaml:/Open-IM-Server/config/notification.yaml - ${DATA_DIR}/db/sdk:/Open-IM-Server/db/sdk - ./script:/Open-IM-Server/script restart: always diff --git a/install_guide.sh b/install_guide.sh new file mode 100644 index 000000000..f1f424494 --- /dev/null +++ b/install_guide.sh @@ -0,0 +1,172 @@ +#!/bin/bash + +echo "Welcome to the Open-IM-Server installation script." +echo "Please select an deploy option:" +echo "1. docker-compose install" +# echo "2. source code install" +# echo "3. source code install with docker-compose dependence" +echo "2. exit" + +clear_openimlog() { + rm -rf ./logs/* +} + +is_path() { + if [ -e "$1" ]; then + return 1 + else + return 0 + fi +} + +is_empyt() { + if [ -z "$1" ]; then + return 1 + else + return 0 + fi +} + +is_directory_exists() { + if [ -d "$1" ]; then + return 1 + else + return 0 + fi +} + +edit_config() { + echo "Is edit config.yaml?" + echo "1. vi edit config" + echo "2. do not edit config" + read choice + case $choice in + 1) + vi config/config.yaml + ;; + 2) + echo "do not edit config" + ;; + esac +} + +edit_enterprise_config() { + echo "Is edit enterprise config.yaml?" + echo "1. vi edit enterprise config" + echo "2. do not edit enterprise config" + read choice + case $choice in + 1) + vi docker-compose_cfg/config.yaml + ;; + 2) + echo "Do not edit enterprise config" + ;; + esac +} + +install_docker_compose() { + echo "Please input the installation path, default is $(pwd)/Open-IM-Server, press enter to use default" + read install_path + is_empyt $install_path + if [ $? -eq 1 ]; then + install_path="." + fi + echo "Installing Open-IM-Server to ${install_path}/Open-IM-Server..." + is_path $install_path + mkdir -p $install_path + cd $install_path + is_directory_exists "${install_path}/Open-IM-Server" + if [ $? -eq 1 ]; then + echo "Error: Directory $install_path/Open-IM-Server exist, please ensure your path" + echo "1. delete the directory and install" + echo "2. exit" + read choice + case $choice in + 1) + rm -rf "${install_path}/Open-IM-Server" + ;; + 2) + exit 1 + ;; + esac + fi + rm -rf ./Open-IM-Server + git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive; + cd ./Open-IM-Server + git checkout errcode + echo "======== git clone success ========" + source .env + echo "Please input the components data directory, deault is ${DATA_DIR} press enter to use default" + read NEW_DATA_DIR + is_empyt $NEW_DATA_DIR + if [ $? -eq 0 ]; then + DATA_DIR=$NEW_DATA_DIR + fi + echo "Please input the user, deault is root, press enter to use default" + read NEW_USER + is_empyt $NEW_USER + if [ $? -eq 0 ]; then + USER=$NEW_USER + fi + + echo "Please input the password, default is openIM123, press enter to use default" + read NEW_PASSWORD + is_empyt $NEW_PASSWORD + if [ $? -eq 0 ]; then + PASSWORD=$NEW_PASSWORD + fi + + echo "Please input the minio_endpoint, default will detect auto, press enter to use default:" + read NEW_MINIO_ENDPOINT + is_empyt $NEW_MINIO_ENDPOINT + if [ $? -eq 1 ]; then + internet_ip=`curl ifconfig.me -s` + MINIO_ENDPOINT="http://${internet_ip}:10005" + else + MINIO_ENDPOINT=$NEW_MINIO_ENDPOINT + fi + + export MINIO_ENDPOINT + export USER + export PASSWORD + export DATA_DIR + sed -i "s/^MINIO_ENDPOINT=.*/MINIO_ENDPOINT=$MINIO_ENDPOINT/" .env + sed -i "s/^USER=.*/USER=$USER/" .env + sed -i "s/^PASSWORD=.*/PASSWORD=$PASSWORD/" .env + sed -i "s/^DATA_DIR=.*/DATA_DIR=$DATA_DIR/" .env + + + edit_config + edit_enterprise_config + + cd script; + chmod +x *.sh; + ./init_pwd.sh; + ./env_check.sh; + cd ..; + docker-compose up -d; + cd script; + ./docker_check_service.sh; +} + +read choice + +case $choice in + 1) + install_docker_compose + ;; + 2) + + ;; + 3) + ;; + 4) + echo "Exiting installation script..." + exit 0 + ;; + *) + echo "Invalid option, please try again." + ;; +esac + diff --git a/pkg/rpcclient/check/group.go b/pkg/rpcclient/check/group.go index d415fc1e9..994b5349e 100644 --- a/pkg/rpcclient/check/group.go +++ b/pkg/rpcclient/check/group.go @@ -2,6 +2,8 @@ package check import ( "context" + "strings" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" discoveryRegistry "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" @@ -10,7 +12,6 @@ import ( sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "google.golang.org/grpc" - "strings" ) type GroupChecker struct { @@ -73,7 +74,7 @@ func (g *GroupChecker) GetGroupMemberInfos(ctx context.Context, groupID string, } resp, err := group.NewGroupClient(cc).GetGroupMembersInfo(ctx, &group.GetGroupMembersInfoReq{ GroupID: groupID, - Members: userIDs, + UserIDs: userIDs, }) if err != nil { return nil, err diff --git a/script/.env b/script/.env deleted file mode 100644 index 7fdf0e3b3..000000000 --- a/script/.env +++ /dev/null @@ -1,4 +0,0 @@ -USER=root -PASSWORD=openIM123 -MINIO_ENDPOINT=http://127.0.0.1:10005 -DATA_DIR=./ \ No newline at end of file diff --git a/script/docker_check_service.sh b/script/docker_check_service.sh index c1cca764a..235fad353 100644 --- a/script/docker_check_service.sh +++ b/script/docker_check_service.sh @@ -7,6 +7,6 @@ sleep 30 echo "check OpenIM................................" ./check_all.sh -chmod +x ./enterprise/*.sh -./enterprise/check_all.sh +# chmod +x ./enterprise/*.sh +# ./enterprise/check_all.sh diff --git a/script/docker_start_all.sh b/script/docker_start_all.sh index f3b8801a5..b7b24dd4b 100644 --- a/script/docker_start_all.sh +++ b/script/docker_start_all.sh @@ -9,6 +9,7 @@ need_to_start_server_shell=( push_start.sh msg_transfer_start.sh sdk_svr_start.sh + start_cron.sh ) #fixme The 10 second delay to start the project is for the docker-compose one-click to start openIM when the infrastructure dependencies are not started diff --git a/script/init_pwd.sh b/script/init_pwd.sh index e61ccc628..f99eb999b 100644 --- a/script/init_pwd.sh +++ b/script/init_pwd.sh @@ -1,9 +1,9 @@ -source ../.env echo "your user is:$USER" echo "your password is:$PASSWORD" echo "your minio endPoint is:$MINIO_ENDPOINT" +echo "your data dir is $DATA_DIR" -sed -i "/^\([[:space:]]*dbMysqlUserName: *\).*/s//\1$USER/;0,/\([[:space:]]*dbUserName: *\).*/s//\1 $USER/;/\([[:space:]]*accessKeyID: *\).*/s//\1$USER/;/\([[:space:]]*endpoint: *\).*/s//\1\"abc\"/;" ../config/config.yaml +sed -i "/^\([[:space:]]*dbMysqlUserName: *\).*/s//\1$USER/;0,/\([[:space:]]*dbUserName: *\).*/s//\1 $USER/;/\([[:space:]]*accessKeyID: *\).*/s//\1 $USER/;/\([[:space:]]*endpoint: *\).*/s//\1\"abc\"/;" ../config/config.yaml sed -i "/^\([[:space:]]*dbMysqlPassword: *\).*/s//\1$PASSWORD/;/\([[:space:]]*dbPassword: *\).*/s//\1$PASSWORD/;/\([[:space:]]*secret: *\).*/s//\1$PASSWORD/;/\([[:space:]]*secretAccessKey: *\).*/s//\1$PASSWORD/;" ../config/config.yaml sed -i "/\([[:space:]]*endpoint: *\).*/s##\1$MINIO_ENDPOINT#;" ../config/config.yaml