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