parent
342c85fafa
commit
d7ce413fc3
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
internet_ip=`curl ifconfig.me -s`
|
||||
echo $internet_ip
|
||||
|
||||
source .env
|
||||
echo $MINIO_ENDPOINT
|
||||
if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then
|
||||
sed -i "s/127.0.0.1/${internet_ip}/" .env
|
||||
|
||||
fi
|
||||
|
||||
cd script ;
|
||||
chmod +x *.sh ;
|
||||
./init_pwd.sh
|
||||
./env_check.sh;
|
||||
cd .. ;
|
||||
docker-compose up -d;
|
||||
cd script ;
|
||||
./docker_check_service.sh
|
@ -1,3 +0,0 @@
|
||||
USER=root
|
||||
PASSWORD=openIMPassword
|
||||
DATA_DIR=./
|
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
version=errcode
|
||||
repository=${1}
|
||||
if [[ -z ${repository} ]]
|
||||
then
|
||||
echo "repository is empty"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
set +e
|
||||
echo "repository: ${repository}"
|
||||
source ./path_info.cfg
|
||||
echo "start to build docker images"
|
||||
currentPwd=`pwd`
|
||||
echo ${currentPwd}
|
||||
i=0
|
||||
for path in ${service_source_root[*]}
|
||||
do
|
||||
cd ${path}
|
||||
make build
|
||||
image="${repository}/${image_names[${i}]}:$version"
|
||||
echo ${image}
|
||||
docker build -t $image . -f ./deploy.Dockerfile
|
||||
echo "build ${image} success"
|
||||
docker push ${image}
|
||||
echo "push ${image} success"
|
||||
echo "=============================="
|
||||
i=$((i + 1))
|
||||
cd ${currentPwd}
|
||||
done
|
||||
|
||||
echo "build all images success"
|
@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}')
|
||||
if [ ${switch} != "true" ]; then
|
||||
echo -e ${YELLOW_PREFIX}" demo service switch is false not start demo "${COLOR_SUFFIX}
|
||||
exit 0
|
||||
fi
|
||||
list1=$(cat $config_path | grep openImDemoPort | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $list1
|
||||
api_ports=($ports_array)
|
||||
|
||||
#Check if the service exists
|
||||
#If it is exists,kill this process
|
||||
check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l)
|
||||
if [ $check -ge 1 ]; then
|
||||
oldPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}')
|
||||
kill -9 $oldPid
|
||||
fi
|
||||
#Waiting port recycling
|
||||
sleep 1
|
||||
cd ${demo_server_binary_root}
|
||||
|
||||
for ((i = 0; i < ${#api_ports[@]}; i++)); do
|
||||
nohup ./${demo_server_name} -port ${api_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||
done
|
||||
|
||||
sleep 3
|
||||
#Check launched service process
|
||||
check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l)
|
||||
if [ $check -ge 1 ]; then
|
||||
newPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}')
|
||||
ports=$(netstat -netulp | grep -w ${newPid} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
|
||||
allPorts=""
|
||||
|
||||
for i in $ports; do
|
||||
allPorts=${allPorts}"$i "
|
||||
done
|
||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX}
|
||||
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX}
|
||||
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
||||
else
|
||||
echo -e ${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR, PLEASE CHECK openIM.log"${COLOR_SUFFIX}
|
||||
fi
|
@ -0,0 +1,11 @@
|
||||
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
|
||||
|
||||
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
|
@ -0,0 +1,12 @@
|
||||
mongo -- "$MONGO_INITDB_DATABASE" <<EOF
|
||||
db = db.getSiblingDB('admin')
|
||||
db.auth('$MONGO_INITDB_ROOT_USERNAME', '$MONGO_INITDB_ROOT_PASSWORD')
|
||||
db = db.getSiblingDB('$MONGO_INITDB_DATABASE')
|
||||
db.createUser({
|
||||
user: "$MONGO_USERNAME",
|
||||
pwd: "$MONGO_PASSWORD",
|
||||
roles: [
|
||||
{ role: 'root', db: '$MONGO_INITDB_DATABASE' }
|
||||
]
|
||||
})
|
||||
EOF
|
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
source ./function.sh
|
||||
|
||||
#define database attributes
|
||||
address=$(cat $config_path | grep -w dbMysqlAddress)
|
||||
list_to_string ${address}
|
||||
hostAndPort=($ports_array)
|
||||
DATABASE_HOST=$(echo $hostAndPort | awk -F '[:]' '{print $1}')
|
||||
DATABASE_PORT=$(echo $hostAndPort | awk -F '[:]' '{print $NF}')
|
||||
DATABASE_USERNAME=$(cat $config_path | grep -w dbMysqlUserName | awk -F '[:]' '{print $NF}')
|
||||
DATABASE_PWD=`eval echo $(cat $config_path | grep -w dbMysqlPassword | awk -F '[:]' '{print $NF}')`
|
||||
DATABASE_NAME=$(cat $config_path | grep -w dbMysqlDatabaseName | awk -F '[:]' '{print $NF}')
|
||||
SQL_FILE="../config/mysql_sql_file/openIM.sql"
|
||||
|
||||
|
||||
create_data_sql="create database IF NOT EXISTS $DATABASE_NAME"
|
||||
set_character_code_sql="alter database $DATABASE_NAME character set utf8mb4 collate utf8mb4_general_ci"
|
||||
|
||||
echo -e "${SKY_BLUE_PREFIX}start to create database.....$COLOR_SUFFIX"
|
||||
mysql -h $DATABASE_HOST -P $DATABASE_PORT -u $DATABASE_USERNAME -p$DATABASE_PWD -e "$create_data_sql"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${SKY_BLUE_PREFIX}create database ${DATABASE_NAME} successfully$COLOR_SUFFIX"
|
||||
mysql -h $DATABASE_HOST -P $DATABASE_PORT -u $DATABASE_USERNAME -p$DATABASE_PWD -e "$set_character_code_sql"
|
||||
else
|
||||
echo -e "${RED_PREFIX}create database failed or exists the database$COLOR_SUFFIX\n"
|
||||
fi
|
||||
|
||||
echo -e "${SKY_BLUE_PREFIX}start to source openIM.sql .....$COLOR_SUFFIX"
|
||||
mysql -h $DATABASE_HOST -P $DATABASE_PORT -u $DATABASE_USERNAME -p$DATABASE_PWD -D $DATABASE_NAME <$SQL_FILE
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${SKY_BLUE_PREFIX}source openIM.sql successfully$COLOR_SUFFIX"
|
||||
else
|
||||
echo -e "${RED_PREFIX}source openIM.sql failed$COLOR_SUFFIX\n"
|
||||
fi
|
@ -1,86 +1,92 @@
|
||||
#Don't put the space between "="
|
||||
msg_gateway_name="open_im_msg_gateway"
|
||||
msg_gateway_binary_root="../bin/"
|
||||
msg_gateway_source_root="../cmd/open_im_msg_gateway/"
|
||||
msg_gateway_source_root="../cmd/msggateway/"
|
||||
|
||||
msg_name="open_im_msg"
|
||||
msg_binary_root="../bin/"
|
||||
msg_source_root="../cmd/rpc/open_im_msg/"
|
||||
msg_source_root="../cmd/rpc/msg/"
|
||||
|
||||
push_name="open_im_push"
|
||||
push_binary_root="../bin/"
|
||||
push_source_root="../cmd/open_im_push/"
|
||||
push_source_root="../cmd/push/"
|
||||
|
||||
|
||||
|
||||
msg_transfer_name="open_im_msg_transfer"
|
||||
msg_transfer_binary_root="../bin/"
|
||||
msg_transfer_source_root="../cmd/open_im_msg_transfer/"
|
||||
msg_transfer_service_num=2
|
||||
msg_transfer_source_root="../cmd/msgtransfer/"
|
||||
msg_transfer_service_num=4
|
||||
|
||||
|
||||
timer_task_name="open_im_timer_task"
|
||||
timer_task_binary_root="../bin/"
|
||||
timer_task_source_root="../cmd/open_im_timer_task/"
|
||||
|
||||
sdk_server_name="open_im_sdk_server"
|
||||
sdk_server_binary_root="../bin/"
|
||||
sdk_server_source_root="../cmd/Open-IM-SDK-Core/"
|
||||
|
||||
demo_server_name="open_im_demo"
|
||||
demo_server_binary_root="../bin/"
|
||||
demo_server_source_root="../cmd/open_im_demo/"
|
||||
|
||||
cron_task_name="open_im_cron_task"
|
||||
cron_task_binary_root="../bin/"
|
||||
cron_task_source_root="../cmd/crontask/"
|
||||
|
||||
|
||||
cmd_utils_name="open_im_cmd_utils"
|
||||
cmd_utils_binary_root="../bin/"
|
||||
cmd_utils_source_root="../cmd/cmduitls/"
|
||||
|
||||
#Global configuration file default dir
|
||||
config_path="../config/config.yaml"
|
||||
|
||||
#servicefile dir path
|
||||
service_source_root=(
|
||||
#api service file
|
||||
../cmd/open_im_api/
|
||||
../cmd/open_im_cms_api/
|
||||
../cmd/api/
|
||||
#rpc service file
|
||||
../cmd/rpc/open_im_user/
|
||||
../cmd/rpc/open_im_friend/
|
||||
../cmd/rpc/open_im_group/
|
||||
../cmd/rpc/open_im_auth/
|
||||
../cmd/rpc/open_im_admin_cms/
|
||||
../cmd/rpc/open_im_message_cms/
|
||||
../cmd/rpc/open_im_statistics/
|
||||
../cmd/rpc/open_im_office/
|
||||
../cmd/rpc/open_im_organization/
|
||||
../cmd/rpc/open_im_conversation/
|
||||
../cmd/rpc/user/
|
||||
../cmd/rpc/friend/
|
||||
../cmd/rpc/group/
|
||||
../cmd/rpc/auth/
|
||||
../cmd/rpc/conversation/
|
||||
../cmd/rpc/third/
|
||||
../cmd/crontask
|
||||
${msg_gateway_source_root}
|
||||
${msg_transfer_source_root}
|
||||
${msg_transfer_source_root/}
|
||||
${msg_source_root}
|
||||
${push_source_root}
|
||||
${sdk_server_source_root}
|
||||
${demo_server_source_root}
|
||||
# ${sdk_server_source_root}
|
||||
)
|
||||
#service filename
|
||||
service_names=(
|
||||
#api service filename
|
||||
open_im_api
|
||||
open_im_cms_api
|
||||
#rpc service filename
|
||||
open_im_user
|
||||
open_im_friend
|
||||
open_im_group
|
||||
open_im_auth
|
||||
open_im_admin_cms
|
||||
open_im_message_cms
|
||||
open_im_statistics
|
||||
open_im_office
|
||||
open_im_organization
|
||||
open_im_conversation
|
||||
open_im_third
|
||||
open_im_cron_task
|
||||
${msg_gateway_name}
|
||||
${msg_transfer_name}
|
||||
${msg_name}
|
||||
${push_name}
|
||||
${sdk_server_name}
|
||||
${demo_server_name}
|
||||
# ${sdk_server_name}
|
||||
)
|
||||
|
||||
|
||||
|
||||
image_names=(
|
||||
#api service file
|
||||
api
|
||||
#rpc service file
|
||||
user
|
||||
friend
|
||||
group
|
||||
auth
|
||||
conversation
|
||||
third
|
||||
cron_task
|
||||
msg_gateway
|
||||
msg_transfer
|
||||
msg
|
||||
push
|
||||
# sdk_server
|
||||
)
|
@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#Include shell font styles and some basic information
|
||||
source ./style_info.cfg
|
||||
source ./path_info.cfg
|
||||
|
||||
|
||||
|
||||
#Check if the service exists
|
||||
#If it is exists,kill this process
|
||||
check=`ps aux | grep -w ./${timer_task_name} | grep -v grep| wc -l`
|
||||
if [ $check -ge 1 ]
|
||||
then
|
||||
oldPid=`ps aux | grep -w ./${timer_task_name} | grep -v grep|awk '{print $2}'`
|
||||
kill -9 $oldPid
|
||||
fi
|
||||
#Waiting port recycling
|
||||
sleep 1
|
||||
|
||||
cd ${timer_task_binary_root}
|
||||
nohup ./${timer_task_name} >>../logs/openIM.log 2>&1 &
|
||||
|
||||
|
||||
#Check launched service process
|
||||
check=`ps aux | grep -w ./${timer_task_name} | grep -v grep| wc -l`
|
||||
if [ $check -ge 1 ]
|
||||
then
|
||||
newPid=`ps aux | grep -w ./${timer_task_name} | grep -v grep|awk '{print $2}'`
|
||||
allPorts=""
|
||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
||||
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${timer_task_name}${COLOR_SUFFIX}
|
||||
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX}
|
||||
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
||||
else
|
||||
echo -e ${YELLOW_PREFIX}${timer_task_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR, PLEASE CHECK openIM.log"${COLOR_SUFFIX}
|
||||
fi
|
Loading…
Reference in new issue