Merge branch 'OpenIMSDK:main' into main

pull/493/head
pluto 1 year ago committed by GitHub
commit 51314729fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,7 +32,7 @@ VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/scripts
#Copy scripts files and binary files to the blank image #Copy scripts files and binary files to the blank image
COPY --from=build /Open-IM-Server/scripts /Open-IM-Server/scripts COPY --from=build /Open-IM-Server/scripts /Open-IM-Server/scripts
COPY --from=build /Open-IM-Server/bin /Open-IM-Server/_output/bin/platforms/linux/amd64/ COPY --from=build /Open-IM-Server/_output/bin/platforms/linux/amd64 /Open-IM-Server/_output/bin/platforms/linux/amd64
WORKDIR /Open-IM-Server/scripts WORKDIR /Open-IM-Server/scripts

@ -87,7 +87,7 @@ fmt:
vet: vet:
@$(GO) vet ./... @$(GO) vet ./...
lint: Check syntax and styling of go sources. ✨ ## lint: Check syntax and styling of go sources. ✨
.PHONY: lint .PHONY: lint
lint: lint:
@$(MAKE) go.lint @$(MAKE) go.lint
@ -184,4 +184,4 @@ help: Makefile
## help-all: Show all help details info. ✨ ## help-all: Show all help details info. ✨
.PHONY: help-all .PHONY: help-all
help-all: go.help copyright.help tools.help image.help dependencies.help gen.help release.help swagger.help help help-all: go.help copyright.help tools.help image.help dependencies.help gen.help release.help swagger.help help
$(call makeallhelp) $(call makeallhelp)

@ -100,8 +100,8 @@ services:
openim_server: openim_server:
image: openim/open_im_server:v3.0.1 image: ghcr.io/openimsdk/openim-server:v3.0.0
container_name: open_im_server container_name: openim-server
volumes: volumes:
- ./logs:/Open-IM-Server/logs - ./logs:/Open-IM-Server/logs
- ./config/config.yaml:/Open-IM-Server/config/config.yaml - ./config/config.yaml:/Open-IM-Server/config/config.yaml

@ -84,6 +84,7 @@ func (r *RootCmd) GetPrometheusPortFlag() int {
func (r *RootCmd) getConfFromCmdAndInit(cmdLines *cobra.Command) error { func (r *RootCmd) getConfFromCmdAndInit(cmdLines *cobra.Command) error {
configFolderPath, _ := cmdLines.Flags().GetString(constant.FlagConf) configFolderPath, _ := cmdLines.Flags().GetString(constant.FlagConf)
fmt.Println("configFolderPath:", configFolderPath)
return config.InitConfig(configFolderPath) return config.InitConfig(configFolderPath)
} }

@ -57,10 +57,11 @@ for i in ${service_port_name[*]}; do
done done
#Check launched service process #Check launched service process
check=$(ps aux | grep -w ./${openim-msgtransfer} | grep -v grep | wc -l) check=$(ps aux | grep -w ./${openim_msgtransfer} | grep -v grep | wc -l)
if [ $check -eq ${msg_transfer_service_num} ]; then if [ $check -eq ${msg_transfer_service_num} ]; then
echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImMsgTransfer"${COLOR_SUFFIX} echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImMsgTransfer"${COLOR_SUFFIX}
else else
echo $check ${msg_transfer_service_num}
echo -e ${RED_PREFIX}"openImMsgTransfer service does not start normally, num err"${COLOR_SUFFIX} echo -e ${RED_PREFIX}"openImMsgTransfer service does not start normally, num err"${COLOR_SUFFIX}
echo -e ${RED_PREFIX}"please check $OPENIM_ROOT/logs/openIM.log "${COLOR_SUFFIX} echo -e ${RED_PREFIX}"please check $OPENIM_ROOT/logs/openIM.log "${COLOR_SUFFIX}
exit -1 exit -1

@ -16,6 +16,10 @@
#fixme This scripts is the total startup scripts #fixme This scripts is the total startup scripts
#fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array #fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array
#Include shell font styles and some basic information
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
#fixme Put the shell scripts name here #fixme Put the shell scripts name here
need_to_start_server_shell=( need_to_start_server_shell=(
start_rpc_service.sh start_rpc_service.sh

@ -61,7 +61,7 @@ sleep 1
cd ${msg_gateway_binary_root} cd ${msg_gateway_binary_root}
for ((i = 0; i < ${#ws_ports[@]}; i++)); do for ((i = 0; i < ${#ws_ports[@]}; i++)); do
echo "==========================start msg_gateway server===========================">>$OPENIM_ROOT/logs/openIM.log echo "==========================start msg_gateway server===========================">>$OPENIM_ROOT/logs/openIM.log
nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} >>$OPENIM_ROOT/logs/openIM.log 2>&1 & nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
done done
#Check launched service process #Check launched service process

@ -52,9 +52,9 @@ sleep 1
cd ${msg_transfer_binary_root} cd ${msg_transfer_binary_root}
for ((i = 0; i < ${msg_transfer_service_num}; i++)); do for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
prome_port=${prome_ports[$i]} prome_port=${prome_ports[$i]}
cmd="nohup ./${openim_msgtransfer}" cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path}"
if [ $prome_port != "" ]; then if [ $prome_port != "" ]; then
cmd="$cmd --prometheus_port $prome_port" cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path}"
fi fi
echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log
$cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 & $cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 &

@ -65,8 +65,12 @@ cmd_utils_name="openim-cmdutils"
cmd_utils_binary_root="$OPENIM_ROOT/$BIN_DIR" cmd_utils_binary_root="$OPENIM_ROOT/$BIN_DIR"
cmd_utils_source_root="$OPENIM_ROOT/cmd/openim-cmdutils/" cmd_utils_source_root="$OPENIM_ROOT/cmd/openim-cmdutils/"
echo "debug========> config_path=$config_path"
# Global configuration file default dir # Global configuration file default dir
config_path="$OPENIM_ROOT/config/config.yaml" config_path="$OPENIM_ROOT/config/config.yaml"
configfile_path="$OPENIM_ROOT/config"
echo "BUG: debug========> config_path=$config_path"
# servicefile dir path # servicefile dir path
service_source_root=( service_source_root=(
@ -104,4 +108,4 @@ service_names=(
"${msg_name}" "${msg_name}"
"${push_name}" "${push_name}"
# "${sdk_server_name}" # "${sdk_server_name}"
) )

@ -50,6 +50,8 @@ echo -e "${BOLD_PREFIX}${CYAN_PREFIX}Server Start Time: ${time}${COLOR_SUFFIX}"
# Print section separator # Print section separator
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}" echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
cd $SCRIPTS_ROOT
# FIXME Put the shell script names here # FIXME Put the shell script names here
need_to_start_server_shell=( need_to_start_server_shell=(
start_rpc_service.sh start_rpc_service.sh
@ -82,4 +84,4 @@ done
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}" echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
# Print completion message # Print completion message
echo -e "${GREEN_PREFIX}${BOLD_PREFIX}OpenIM Server has been started successfully!${COLOR_SUFFIX}" echo -e "${GREEN_PREFIX}${BOLD_PREFIX}OpenIM Server has been started successfully!${COLOR_SUFFIX}"

@ -95,21 +95,24 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
portList2=$(cat $config_path | grep ${service_prometheus_port_name[$i]} | awk -F '[:]' '{print $NF}') portList2=$(cat $config_path | grep ${service_prometheus_port_name[$i]} | awk -F '[:]' '{print $NF}')
list_to_string $portList2 list_to_string $portList2
echo -e "debug========>cmd=$cmd AAAAA"
prome_ports=($ports_array) prome_ports=($ports_array)
#Start related rpc services based on the number of ports #Start related rpc services based on the number of ports
for ((j = 0; j < ${#service_ports[*]}; j++)); do for ((j = 0; j < ${#service_ports[*]}; j++)); do
#Start the service in the background #Start the service in the background
if [ -z "${prome_ports[$j]}" ]; then if [ -z "${prome_ports[$j]}" ]; then
cmd="./${service_filename[$i]} --port ${service_ports[$j]}" cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path}"
else else
cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]}" cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path}"
fi fi
if [ $i -eq 0 -o $i -eq 1 ]; then if [ $i -eq 0 -o $i -eq 1 ]; then
cmd="./${service_filename[$i]} --port ${service_ports[$j]}" cmd="./${service_filename[$i]} --port ${service_ports[$j]}"
fi fi
echo $cmd echo $cmd
echo -e "debug========>cmd=$cmd"
echo "=====================start ${service_filename[$i]}======================">>$OPENIM_ROOT/logs/openIM.log echo "=====================start ${service_filename[$i]}======================">>$OPENIM_ROOT/logs/openIM.log
nohup $cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 & nohup $cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 &
echo -e "debug========>OpenIMROOT=$OPENIM_ROOT"
sleep 1 sleep 1
pid="netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1" pid="netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1"
echo -e "${GREEN_PREFIX}${service_filename[$i]} start success,port number:${service_ports[$j]} pid:$(eval $pid)$COLOR_SUFFIX" echo -e "${GREEN_PREFIX}${service_filename[$i]} start success,port number:${service_ports[$j]} pid:$(eval $pid)$COLOR_SUFFIX"

@ -14,6 +14,7 @@
# limitations under the License. # limitations under the License.
#Include shell font styles and some basic information #Include shell font styles and some basic information
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
#Include shell font styles and some basic information #Include shell font styles and some basic information
@ -25,7 +26,7 @@ bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/" sdk_db_dir="$OPENIM_ROOT/sdk/db/"
cd "$OPENIM_ROOT/scripts/" cd "$SCRIPTS_ROOT"
for i in ${service_names[*]}; do for i in ${service_names[*]}; do
#Check whether the service exists #Check whether the service exists

Loading…
Cancel
Save