diff --git a/Dockerfile b/Dockerfile index 76b2a4c14..5df672921 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 --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 diff --git a/Makefile b/Makefile index 5fcc3b8c3..d1c733717 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ fmt: vet: @$(GO) vet ./... -lint: Check syntax and styling of go sources. ✨ +## lint: Check syntax and styling of go sources. ✨ .PHONY: lint lint: @$(MAKE) go.lint @@ -184,4 +184,4 @@ help: Makefile ## help-all: Show all help details info. ✨ .PHONY: help-all help-all: go.help copyright.help tools.help image.help dependencies.help gen.help release.help swagger.help help - $(call makeallhelp) \ No newline at end of file + $(call makeallhelp) diff --git a/docker-compose.yaml b/docker-compose.yaml index 4b87306f5..c78e4a63b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -100,8 +100,8 @@ services: openim_server: - image: openim/open_im_server:v3.0.1 - container_name: open_im_server + image: ghcr.io/openimsdk/openim-server:v3.0.0 + container_name: openim-server volumes: - ./logs:/Open-IM-Server/logs - ./config/config.yaml:/Open-IM-Server/config/config.yaml diff --git a/pkg/common/cmd/root.go b/pkg/common/cmd/root.go index 4a5744033..b15d984a0 100644 --- a/pkg/common/cmd/root.go +++ b/pkg/common/cmd/root.go @@ -84,6 +84,7 @@ func (r *RootCmd) GetPrometheusPortFlag() int { func (r *RootCmd) getConfFromCmdAndInit(cmdLines *cobra.Command) error { configFolderPath, _ := cmdLines.Flags().GetString(constant.FlagConf) + fmt.Println("configFolderPath:", configFolderPath) return config.InitConfig(configFolderPath) } diff --git a/scripts/check_all.sh b/scripts/check_all.sh index c4f5dd490..84dabb1eb 100755 --- a/scripts/check_all.sh +++ b/scripts/check_all.sh @@ -57,10 +57,11 @@ for i in ${service_port_name[*]}; do done #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 echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImMsgTransfer"${COLOR_SUFFIX} 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}"please check $OPENIM_ROOT/logs/openIM.log "${COLOR_SUFFIX} exit -1 diff --git a/scripts/docker_start_all.sh b/scripts/docker_start_all.sh index 98e5a131c..421900ef4 100755 --- a/scripts/docker_start_all.sh +++ b/scripts/docker_start_all.sh @@ -16,6 +16,10 @@ #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 +#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 need_to_start_server_shell=( start_rpc_service.sh diff --git a/scripts/msg_gateway_start.sh b/scripts/msg_gateway_start.sh index c66bd8460..f99ce9017 100755 --- a/scripts/msg_gateway_start.sh +++ b/scripts/msg_gateway_start.sh @@ -61,7 +61,7 @@ sleep 1 cd ${msg_gateway_binary_root} for ((i = 0; i < ${#ws_ports[@]}; i++)); do 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 #Check launched service process diff --git a/scripts/msg_transfer_start.sh b/scripts/msg_transfer_start.sh index e61492f34..e2034388b 100755 --- a/scripts/msg_transfer_start.sh +++ b/scripts/msg_transfer_start.sh @@ -52,9 +52,9 @@ sleep 1 cd ${msg_transfer_binary_root} for ((i = 0; i < ${msg_transfer_service_num}; i++)); do prome_port=${prome_ports[$i]} - cmd="nohup ./${openim_msgtransfer}" + cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path}" if [ $prome_port != "" ]; then - cmd="$cmd --prometheus_port $prome_port" + cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path}" fi echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log $cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 & diff --git a/scripts/path_info.sh b/scripts/path_info.sh index 5351a43db..595137566 100755 --- a/scripts/path_info.sh +++ b/scripts/path_info.sh @@ -65,8 +65,12 @@ cmd_utils_name="openim-cmdutils" cmd_utils_binary_root="$OPENIM_ROOT/$BIN_DIR" cmd_utils_source_root="$OPENIM_ROOT/cmd/openim-cmdutils/" +echo "debug========> config_path=$config_path" # Global configuration file default dir config_path="$OPENIM_ROOT/config/config.yaml" +configfile_path="$OPENIM_ROOT/config" + +echo "BUG: debug========> config_path=$config_path" # servicefile dir path service_source_root=( @@ -104,4 +108,4 @@ service_names=( "${msg_name}" "${push_name}" # "${sdk_server_name}" -) \ No newline at end of file +) diff --git a/scripts/start_all.sh b/scripts/start_all.sh index 4e7db6e3e..3554b7d14 100755 --- a/scripts/start_all.sh +++ b/scripts/start_all.sh @@ -50,6 +50,8 @@ echo -e "${BOLD_PREFIX}${CYAN_PREFIX}Server Start Time: ${time}${COLOR_SUFFIX}" # Print section separator echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}" +cd $SCRIPTS_ROOT + # FIXME Put the shell script names here need_to_start_server_shell=( start_rpc_service.sh @@ -82,4 +84,4 @@ done echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}" # Print completion message -echo -e "${GREEN_PREFIX}${BOLD_PREFIX}OpenIM Server has been started successfully!${COLOR_SUFFIX}" \ No newline at end of file +echo -e "${GREEN_PREFIX}${BOLD_PREFIX}OpenIM Server has been started successfully!${COLOR_SUFFIX}" diff --git a/scripts/start_rpc_service.sh b/scripts/start_rpc_service.sh index 132afdfe5..cafbb254e 100755 --- a/scripts/start_rpc_service.sh +++ b/scripts/start_rpc_service.sh @@ -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}') list_to_string $portList2 + echo -e "debug========>cmd=$cmd AAAAA" prome_ports=($ports_array) #Start related rpc services based on the number of ports for ((j = 0; j < ${#service_ports[*]}; j++)); do #Start the service in the background 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 - 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 if [ $i -eq 0 -o $i -eq 1 ]; then cmd="./${service_filename[$i]} --port ${service_ports[$j]}" fi echo $cmd + echo -e "debug========>cmd=$cmd" echo "=====================start ${service_filename[$i]}======================">>$OPENIM_ROOT/logs/openIM.log nohup $cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 & + echo -e "debug========>OpenIMROOT=$OPENIM_ROOT" sleep 1 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" diff --git a/scripts/stop_all.sh b/scripts/stop_all.sh index 4e3537ea7..f413d2a66 100755 --- a/scripts/stop_all.sh +++ b/scripts/stop_all.sh @@ -14,6 +14,7 @@ # limitations under the License. #Include shell font styles and some basic information +SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. #Include shell font styles and some basic information @@ -25,7 +26,7 @@ bin_dir="$BIN_DIR" logs_dir="$OPENIM_ROOT/logs" sdk_db_dir="$OPENIM_ROOT/sdk/db/" -cd "$OPENIM_ROOT/scripts/" +cd "$SCRIPTS_ROOT" for i in ${service_names[*]}; do #Check whether the service exists