mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-07 19:50:07 +08:00
install sh
This commit is contained in:
parent
32343e17f8
commit
33be38339e
4
.env
Normal file
4
.env
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
USER=root
|
||||||
|
PASSWORD=openIM123
|
||||||
|
MINIO_ENDPOINT=http://127.0.0.1:10005
|
||||||
|
DATA_DIR=./
|
1
Open-IM-Server
Submodule
1
Open-IM-Server
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 32343e17f88b7ce90c5358aa34f17db78ca39210
|
172
install_guide.sh
Normal file
172
install_guide.sh
Normal file
@ -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
|
||||||
|
|
142
quick_install.sh
142
quick_install.sh
@ -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
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user