From d55bb2c529e4dfe772d46ab66598025775931a72 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 18:25:56 +0800 Subject: [PATCH 01/16] script --- deployk8s/auth/auth.Dockerfile | 2 +- .../conversation/conversation.Dockerfile | 2 +- deployk8s/k8s_openim_deploy.md | 2 +- quick_install.sh | 139 ++++++++++++++++++ script/.env | 4 - script/init_pwd.sh | 17 +-- sd/Open-IM-Server | 1 + 7 files changed, 151 insertions(+), 16 deletions(-) create mode 100644 quick_install.sh delete mode 100644 script/.env create mode 160000 sd/Open-IM-Server 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/quick_install.sh b/quick_install.sh new file mode 100644 index 000000000..b0bb45fa7 --- /dev/null +++ b/quick_install.sh @@ -0,0 +1,139 @@ +#!/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 "4. 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 +} + +edit_config() { + 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 "1. vi edit enterprise config" + echo "2. do not edit enterprise config" + read choice + case $choice in + 1) + vi dockker-compose_cfg/config.yaml + ;; + 2) + echo "do not edit enterprise config" + ;; + esac +} + +install_docker_compose() { + echo "Please enter the installation path, default is $(pwd)" + read install_path + is_empyt $install_path + if [ $? -eq 1 ]; then + install_path="./" + fi + echo "Installing Open-IM-Server to $install_path..." + is_path $install_path + mkdir -p $install_path + cd $install_path + 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" + echo "Please enter the data directory, deault is $(pwd), press enter to use default" + read data_dir + is_empyt $data_dir + if [ $? -eq 1 ]; then + data_dir="./" + fi + + echo "Please enter the user, deault is root, press enter to use default" + read user + is_empyt $user + if [ $? -eq 1 ]; then + user="root" + fi + + echo "Please enter the password, default is openIM123, press enter to use default" + read password + is_empyt $password + if [ $? -eq 1 ]; then + password="openIM123" + fi + + echo "Please enter the minio_endpoint, default will detect auto, press enter to use default:" + read minio_endpoint + is_empyt $minio_endpoint + if [ $? -eq 1 ]; then + internet_ip=`curl ifconfig.me -s` + minio_endpoint="http://${internet_ip}:10005" + + fi + + echo $minio_endpoint + echo $user + echo $password + 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/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/init_pwd.sh b/script/init_pwd.sh index e61ccc628..acdc9a2ca 100644 --- a/script/init_pwd.sh +++ b/script/init_pwd.sh @@ -1,11 +1,10 @@ -source ../.env -echo "your user is:$USER" -echo "your password is:$PASSWORD" -echo "your minio endPoint is:$MINIO_ENDPOINT" +echo "your user is:$user" +echo "your password is:$password" +echo "your minio endPoint is:$minio_endpoint" -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:]]*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 -sed -i "/\([[:space:]]*dbPassWord: *\).*/s//\1$PASSWORD/;" ../config/config.yaml -sed -i "/\([[:space:]]*secret: *\).*/s//\1$PASSWORD/;" ../docker-compose_cfg/config.yaml +sed -i "/\([[:space:]]*endpoint: *\).*/s##\1$minio_endpoint#;" ../config/config.yaml +sed -i "/\([[:space:]]*dbPassWord: *\).*/s//\1$password/;" ../config/config.yaml +sed -i "/\([[:space:]]*secret: *\).*/s//\1$password/;" ../docker-compose_cfg/config.yaml diff --git a/sd/Open-IM-Server b/sd/Open-IM-Server new file mode 160000 index 000000000..47a5d3010 --- /dev/null +++ b/sd/Open-IM-Server @@ -0,0 +1 @@ +Subproject commit 47a5d3010a16e5b9bca0f54e3d21921b5db64c0f From 2fbe46eb6ce2c6923bf03ba383f529ffc8be2917 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 18:31:01 +0800 Subject: [PATCH 02/16] script --- pkg/rpcclient/check/group.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 From 0dec7e3a3cc0f030bb730cac1f9d1674b101b5f3 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 18:39:32 +0800 Subject: [PATCH 03/16] script --- quick_install.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/quick_install.sh b/quick_install.sh index b0bb45fa7..e0bda2ac0 100644 --- a/quick_install.sh +++ b/quick_install.sh @@ -5,7 +5,7 @@ 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 "4. exit" +echo "2. exit" clear_openimlog() { rm -rf ./logs/* @@ -28,6 +28,7 @@ is_empyt() { } edit_config() { + echo "is edit config.yaml?" echo "1. vi edit config" echo "2. do not edit config" read choice @@ -42,6 +43,7 @@ edit_config() { } edit_enterprise_config() { + echo "is edit enterprise config.yaml?" echo "1. vi edit enterprise config" echo "2. do not edit enterprise config" read choice @@ -98,12 +100,12 @@ install_docker_compose() { if [ $? -eq 1 ]; then internet_ip=`curl ifconfig.me -s` minio_endpoint="http://${internet_ip}:10005" - fi - echo $minio_endpoint - echo $user - echo $password + export minio_endpoint + export user + export password + edit_config edit_enterprise_config From fe517070f9ae9ef6f2d93cb929d13438f7fdcae2 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 19:29:11 +0800 Subject: [PATCH 04/16] script --- Open-IM-Server | 1 + script/init_pwd.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 160000 Open-IM-Server diff --git a/Open-IM-Server b/Open-IM-Server new file mode 160000 index 000000000..0dec7e3a3 --- /dev/null +++ b/Open-IM-Server @@ -0,0 +1 @@ +Subproject commit 0dec7e3a3cc0f030bb730cac1f9d1674b101b5f3 diff --git a/script/init_pwd.sh b/script/init_pwd.sh index acdc9a2ca..f5611fcb4 100644 --- a/script/init_pwd.sh +++ b/script/init_pwd.sh @@ -2,7 +2,7 @@ echo "your user is:$user" echo "your password is:$password" echo "your minio endPoint is:$minio_endpoint" -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 From b5234ad226b7380d0a88caf30b60ff30dcfceb65 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 19:40:51 +0800 Subject: [PATCH 05/16] errcode --- Open-IM-Server | 1 - docker-compose.yaml | 2 +- script/docker_check_service.sh | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) delete mode 160000 Open-IM-Server diff --git a/Open-IM-Server b/Open-IM-Server deleted file mode 160000 index 0dec7e3a3..000000000 --- a/Open-IM-Server +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0dec7e3a3cc0f030bb730cac1f9d1674b101b5f3 diff --git a/docker-compose.yaml b/docker-compose.yaml index 0abdab9ad..e9130c915 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -100,7 +100,7 @@ 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 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 From 2409d178920fcececd5db3edd074a8741e0e5f0e Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 19:42:24 +0800 Subject: [PATCH 06/16] compose --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index e9130c915..38a37cdc6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -105,7 +105,7 @@ services: 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 From c0219222136b7447b5f6699dc3fb8bf72d922cdb Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 19:46:47 +0800 Subject: [PATCH 07/16] script --- quick_install.sh | 30 +++++++++++++++--------------- script/init_pwd.sh | 16 ++++++++-------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/quick_install.sh b/quick_install.sh index e0bda2ac0..65bdeeef2 100644 --- a/quick_install.sh +++ b/quick_install.sh @@ -74,37 +74,37 @@ install_docker_compose() { git checkout errcode echo "git clone success" echo "Please enter the data directory, deault is $(pwd), press enter to use default" - read data_dir - is_empyt $data_dir + read DATA_DIR + is_empyt $DATA_DIR if [ $? -eq 1 ]; then - data_dir="./" + DATA_DIR="./" fi echo "Please enter the user, deault is root, press enter to use default" - read user - is_empyt $user + read USER + is_empyt $USER if [ $? -eq 1 ]; then - user="root" + USER="root" fi echo "Please enter the password, default is openIM123, press enter to use default" - read password - is_empyt $password + read PASSWORD + is_empyt $PASSWORD if [ $? -eq 1 ]; then - password="openIM123" + PASSWORD="openIM123" fi echo "Please enter the minio_endpoint, default will detect auto, press enter to use default:" - read minio_endpoint - is_empyt $minio_endpoint + read MINIO_ENDPOINT + is_empyt $MINIO_ENDPOINT if [ $? -eq 1 ]; then internet_ip=`curl ifconfig.me -s` - minio_endpoint="http://${internet_ip}:10005" + MINIO_ENDPOINT="http://${internet_ip}:10005" fi - export minio_endpoint - export user - export password + export MINIO_ENDPOINT + export USER + export PASSWORD edit_config edit_enterprise_config diff --git a/script/init_pwd.sh b/script/init_pwd.sh index f5611fcb4..930de1aae 100644 --- a/script/init_pwd.sh +++ b/script/init_pwd.sh @@ -1,10 +1,10 @@ -echo "your user is:$user" -echo "your password is:$password" -echo "your minio endPoint is:$minio_endpoint" +echo "your user is:$USER" +echo "your password is:$PASSWORD" +echo "your minio endPoint is:$MINIO_ENDPOINT" -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:]]*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 -sed -i "/\([[:space:]]*dbPassWord: *\).*/s//\1$password/;" ../config/config.yaml -sed -i "/\([[:space:]]*secret: *\).*/s//\1$password/;" ../docker-compose_cfg/config.yaml +sed -i "/\([[:space:]]*endpoint: *\).*/s##\1$MINIO_ENDPOINT#;" ../config/config.yaml +sed -i "/\([[:space:]]*dbPassWord: *\).*/s//\1$PASSWORD/;" ../config/config.yaml +sed -i "/\([[:space:]]*secret: *\).*/s//\1$PASSWORD/;" ../docker-compose_cfg/config.yaml From 00282652eaf0c8ce2d91f89da49d49c2f38eea2f Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 19:50:09 +0800 Subject: [PATCH 08/16] script --- quick_install.sh | 1 + sd/Open-IM-Server | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 160000 sd/Open-IM-Server diff --git a/quick_install.sh b/quick_install.sh index 65bdeeef2..03cb857c1 100644 --- a/quick_install.sh +++ b/quick_install.sh @@ -105,6 +105,7 @@ install_docker_compose() { export MINIO_ENDPOINT export USER export PASSWORD + export DATA_DIR edit_config edit_enterprise_config diff --git a/sd/Open-IM-Server b/sd/Open-IM-Server deleted file mode 160000 index 47a5d3010..000000000 --- a/sd/Open-IM-Server +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 47a5d3010a16e5b9bca0f54e3d21921b5db64c0f From f5b618f76d705e65ee490c11a4d85fa30382bbdc Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 19:53:59 +0800 Subject: [PATCH 09/16] script --- script/init_pwd.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/script/init_pwd.sh b/script/init_pwd.sh index 930de1aae..f99eb999b 100644 --- a/script/init_pwd.sh +++ b/script/init_pwd.sh @@ -1,6 +1,7 @@ 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:]]*dbMysqlPassword: *\).*/s//\1$PASSWORD/;/\([[:space:]]*dbPassword: *\).*/s//\1$PASSWORD/;/\([[:space:]]*secret: *\).*/s//\1$PASSWORD/;/\([[:space:]]*secretAccessKey: *\).*/s//\1$PASSWORD/;" ../config/config.yaml From b0c06e9ee7ba239ebe0c0cfea7893f5ceecaadaa Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 20:02:21 +0800 Subject: [PATCH 10/16] script --- Open-IM-Server | 1 + quick_install.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 160000 Open-IM-Server diff --git a/Open-IM-Server b/Open-IM-Server new file mode 160000 index 000000000..f5b618f76 --- /dev/null +++ b/Open-IM-Server @@ -0,0 +1 @@ +Subproject commit f5b618f76d705e65ee490c11a4d85fa30382bbdc diff --git a/quick_install.sh b/quick_install.sh index 03cb857c1..863340350 100644 --- a/quick_install.sh +++ b/quick_install.sh @@ -79,7 +79,7 @@ install_docker_compose() { if [ $? -eq 1 ]; then DATA_DIR="./" fi - + echo "Please enter the user, deault is root, press enter to use default" read USER is_empyt $USER From c90eb511777cfdfb2a358bc9bd544b734c69e85c Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 20:16:28 +0800 Subject: [PATCH 11/16] script --- quick_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_install.sh b/quick_install.sh index 863340350..6df6a97e5 100644 --- a/quick_install.sh +++ b/quick_install.sh @@ -77,7 +77,7 @@ install_docker_compose() { read DATA_DIR is_empyt $DATA_DIR if [ $? -eq 1 ]; then - DATA_DIR="./" + DATA_DIR="." fi echo "Please enter the user, deault is root, press enter to use default" From 5ece607224f76d106aa6b087b90aa7fbe98a32e8 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 20:25:39 +0800 Subject: [PATCH 12/16] script --- .env | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 7fdf0e3b3..000000000 --- a/.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 From 97c1b235b5829da8b4ea337c98fd9779f972030d Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 20:34:03 +0800 Subject: [PATCH 13/16] script --- Open-IM-Server | 1 - quick_install.sh | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 160000 Open-IM-Server diff --git a/Open-IM-Server b/Open-IM-Server deleted file mode 160000 index f5b618f76..000000000 --- a/Open-IM-Server +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f5b618f76d705e65ee490c11a4d85fa30382bbdc diff --git a/quick_install.sh b/quick_install.sh index 6df6a97e5..784abba1f 100644 --- a/quick_install.sh +++ b/quick_install.sh @@ -77,9 +77,9 @@ install_docker_compose() { read DATA_DIR is_empyt $DATA_DIR if [ $? -eq 1 ]; then - DATA_DIR="." + DATA_DIR=$(pwd) fi - + echo $DATA_DIR echo "Please enter the user, deault is root, press enter to use default" read USER is_empyt $USER From 32343e17f88b7ce90c5358aa34f17db78ca39210 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 10 Apr 2023 20:59:51 +0800 Subject: [PATCH 14/16] script --- script/docker_start_all.sh | 1 + 1 file changed, 1 insertion(+) 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 From 33be38339efe43b495b815b881fce887f54b9c0c Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 11 Apr 2023 14:28:51 +0800 Subject: [PATCH 15/16] install sh --- .env | 4 ++ Open-IM-Server | 1 + install_guide.sh | 172 +++++++++++++++++++++++++++++++++++++++++++++++ quick_install.sh | 142 -------------------------------------- 4 files changed, 177 insertions(+), 142 deletions(-) create mode 100644 .env create mode 160000 Open-IM-Server create mode 100644 install_guide.sh delete mode 100644 quick_install.sh diff --git a/.env b/.env new file mode 100644 index 000000000..75f9707da --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +USER=root +PASSWORD=openIM123 +MINIO_ENDPOINT=http://127.0.0.1:10005 +DATA_DIR=./ diff --git a/Open-IM-Server b/Open-IM-Server new file mode 160000 index 000000000..32343e17f --- /dev/null +++ b/Open-IM-Server @@ -0,0 +1 @@ +Subproject commit 32343e17f88b7ce90c5358aa34f17db78ca39210 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/quick_install.sh b/quick_install.sh deleted file mode 100644 index 784abba1f..000000000 --- a/quick_install.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/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 -} - -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 dockker-compose_cfg/config.yaml - ;; - 2) - echo "do not edit enterprise config" - ;; - esac -} - -install_docker_compose() { - echo "Please enter the installation path, default is $(pwd)" - read install_path - is_empyt $install_path - if [ $? -eq 1 ]; then - install_path="./" - fi - echo "Installing Open-IM-Server to $install_path..." - is_path $install_path - mkdir -p $install_path - cd $install_path - 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" - echo "Please enter the data directory, deault is $(pwd), press enter to use default" - read DATA_DIR - is_empyt $DATA_DIR - if [ $? -eq 1 ]; then - DATA_DIR=$(pwd) - fi - echo $DATA_DIR - echo "Please enter the user, deault is root, press enter to use default" - read USER - is_empyt $USER - if [ $? -eq 1 ]; then - USER="root" - fi - - echo "Please enter the password, default is openIM123, press enter to use default" - read PASSWORD - is_empyt $PASSWORD - if [ $? -eq 1 ]; then - PASSWORD="openIM123" - fi - - echo "Please enter the minio_endpoint, default will detect auto, press enter to use default:" - read MINIO_ENDPOINT - is_empyt $MINIO_ENDPOINT - if [ $? -eq 1 ]; then - internet_ip=`curl ifconfig.me -s` - MINIO_ENDPOINT="http://${internet_ip}:10005" - fi - - export MINIO_ENDPOINT - export USER - export PASSWORD - export DATA_DIR - - 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 - From 20c20ce01a522c61dd25956f9b945b088ae3941b Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 11 Apr 2023 14:29:44 +0800 Subject: [PATCH 16/16] sh --- Open-IM-Server | 1 - 1 file changed, 1 deletion(-) delete mode 160000 Open-IM-Server diff --git a/Open-IM-Server b/Open-IM-Server deleted file mode 160000 index 32343e17f..000000000 --- a/Open-IM-Server +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 32343e17f88b7ce90c5358aa34f17db78ca39210