From 8c55ad1f025bcfe94bc5171aa01b9dd47a3edf64 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Fri, 4 Aug 2023 15:23:29 +0800 Subject: [PATCH] fix: docker release v3.1.1 images optimize Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- Dockerfile | 2 ++ docker-compose.yaml | 4 ++-- scripts/enterprise/function.sh | 12 ++++++------ scripts/enterprise/path_info.cfg | 16 +++++++--------- scripts/msg_transfer_start.sh | 8 ++++---- scripts/push_start.sh | 8 ++++---- scripts/start_all.sh | 8 ++++---- scripts/start_cron.sh | 8 ++++---- scripts/start_rpc_service.sh | 2 +- scripts/stop_all.sh | 2 +- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c030921e..8c2772fc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,4 +28,6 @@ COPY --from=builder ${OPENIM_SERVER_CMDDIR} /openim/openim-server/scripts COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config COPY --from=builder ${SERVER_WORKDIR}/_output/bin/platforms /openim/openim-server/_output/bin/platforms +VOLUME ["/openim/openim-server/logs","/openim/openim-server/config","/openim/openim-server/scripts"] + CMD ["bash","-c","${OPENIM_SERVER_CMDDIR}/docker_start_all.sh"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 57240cf19..dc9a4378b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -100,7 +100,7 @@ services: openim_server: - image: openim-server:v1 #ghcr.io/openimsdk/openim-server:latels + image: ghcr.io/openim-sigs/openim-server:v1.0.0-debug.0 #ghcr.io/openimsdk/openim-server:latels container_name: openim-server volumes: - ./logs:/openim/openim-server/logs @@ -122,7 +122,7 @@ services: max-file: "2" openim_chat: - image: openim-chat:v1.3 #ghcr.io/openimsdk/openim-chat:latels + image: ghcr.io/openim-sigs/openim-chat:v1.0.0-debug.0 #ghcr.io/openimsdk/openim-chat:latels container_name: openim_chat # volumes: # - ./_output/openim/openim-chat/logs:/openim/openim-chat/logs diff --git a/scripts/enterprise/function.sh b/scripts/enterprise/function.sh index e2dc96a25..8b5cb0b2b 100755 --- a/scripts/enterprise/function.sh +++ b/scripts/enterprise/function.sh @@ -16,12 +16,12 @@ #input:[10023,2323,3434] #output:10023 2323 3434 list_to_string(){ -ports_list=$* -sub_s1=`echo $ports_list | sed 's/ //g'` -sub_s2=${sub_s1//,/ } -sub_s3=${sub_s2#*[} -sub_s4=${sub_s3%]*} -ports_array=$sub_s4 + ports_list=$* + sub_s1=`echo $ports_list | sed 's/ //g'` + sub_s2=${sub_s1//,/ } + sub_s3=${sub_s2#*[} + sub_s4=${sub_s3%]*} + ports_array=$sub_s4 } remove_space(){ value=$* diff --git a/scripts/enterprise/path_info.cfg b/scripts/enterprise/path_info.cfg index a64e95bfc..3b18bbf90 100644 --- a/scripts/enterprise/path_info.cfg +++ b/scripts/enterprise/path_info.cfg @@ -1,6 +1,6 @@ #Don't put the space between "=" -demo_server_name="openim_chat_api" +demo_server_name="chat-api" demo_server_binary_root="$BIN_DIR/" #Global configuration file default dir @@ -12,16 +12,14 @@ service_source_root=( ../cmd/api/chat/ ../cmd/api/admin/ #rpc service file - ../cmd/openim-rpc/admin/ - ../cmd/openim-rpc/chat/ + ../cmd/rpc/admin/ + ../cmd/rpc/chat/ ) #service filename service_names=( - #api service filename - openim_chat_api - openim_admin_api - #rpc service filename - openim_admin - openim_chat + chat-api + admin-api + admin-rpc + chat-rpc ) diff --git a/scripts/msg_transfer_start.sh b/scripts/msg_transfer_start.sh index b1e17769d..7221ffa49 100755 --- a/scripts/msg_transfer_start.sh +++ b/scripts/msg_transfer_start.sh @@ -38,10 +38,10 @@ prome_ports=($ports_array) #Check if the service exists #If it is exists,kill this process -check=`ps aux | grep -w ./${openim_msgtransfer} | grep -v grep| wc -l` +check=`ps | grep -w ./${openim_msgtransfer} | grep -v grep| wc -l` if [ $check -ge 1 ] then -oldPid=`ps aux | grep -w ./${openim_msgtransfer} | grep -v grep|awk '{print $2}'` +oldPid=`ps | grep -w ./${openim_msgtransfer} | grep -v grep|awk '{print $2}'` kill -9 $oldPid fi #Waiting port recycling @@ -59,10 +59,10 @@ for ((i = 0; i < ${msg_transfer_service_num}; i++)); do done #Check launched service process -check=`ps aux | grep -w ./${openim_msgtransfer} | grep -v grep| wc -l` +check=`ps | grep -w ./${openim_msgtransfer} | grep -v grep| wc -l` if [ $check -ge 1 ] then -newPid=`ps aux | grep -w ./${openim_msgtransfer} | grep -v grep|awk '{print $2}'` +newPid=`ps | grep -w ./${openim_msgtransfer} | 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}${BACKGROUND_GREEN}${openim_msgtransfer}${COLOR_SUFFIX} diff --git a/scripts/push_start.sh b/scripts/push_start.sh index 74b9aedc9..6b26c3022 100755 --- a/scripts/push_start.sh +++ b/scripts/push_start.sh @@ -45,9 +45,9 @@ prome_ports=($ports_array) #Check if the service exists #If it is exists,kill this process -check=$(ps aux | grep -w ./${push_name} | grep -v grep | wc -l) +check=$(ps | grep -w ./${push_name} | grep -v grep | wc -l) if [ $check -ge 1 ]; then - oldPid=$(ps aux | grep -w ./${push_name} | grep -v grep | awk '{print $2}') + oldPid=$(ps | grep -w ./${push_name} | grep -v grep | awk '{print $2}') kill -9 $oldPid fi #Waiting port recycling @@ -61,9 +61,9 @@ done sleep 3 #Check launched service process -check=$(ps aux | grep -w ./${push_name} | grep -v grep | wc -l) +check=$(ps | grep -w ./${push_name} | grep -v grep | wc -l) if [ $check -ge 1 ]; then - newPid=$(ps aux | grep -w ./${push_name} | grep -v grep | awk '{print $2}') + newPid=$(ps | grep -w ./${push_name} | grep -v grep | awk '{print $2}') ports=$(netstat -netulp | grep -w ${newPid} | awk '{print $4}' | awk -F '[:]' '{print $NF}') allPorts="" diff --git a/scripts/start_all.sh b/scripts/start_all.sh index 6470ae910..87363c547 100755 --- a/scripts/start_all.sh +++ b/scripts/start_all.sh @@ -27,15 +27,15 @@ source $SCRIPTS_ROOT/function.sh cd $SCRIPTS_ROOT +echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}" +echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}" +echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}" + if [ ! -d "${OPENIM_ROOT}/_output/bin/platforms" ]; then # exec build_all_service.sh "${SCRIPTS_ROOT}/build_all_service.sh" fi -echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}" -echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}" -echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}" - bin_dir="$OPENIM_ROOT/_output/bin" logs_dir="$OPENIM_ROOT/logs" sdk_db_dir="$OPENIM_ROOT/sdk/db/" diff --git a/scripts/start_cron.sh b/scripts/start_cron.sh index 79b5b9c31..2f27801be 100755 --- a/scripts/start_cron.sh +++ b/scripts/start_cron.sh @@ -34,10 +34,10 @@ sdk_db_dir="$OPENIM_ROOT/sdk/db/" #Check if the service exists #If it is exists,kill this process -check=`ps aux | grep -w ./${cron_task_name} | grep -v grep| wc -l` +check=`ps | grep -w ./${cron_task_name} | grep -v grep| wc -l` if [ $check -ge 1 ] then -oldPid=`ps aux | grep -w ./${cron_task_name} | grep -v grep|awk '{print $2}'` +oldPid=`ps | grep -w ./${cron_task_name} | grep -v grep|awk '{print $2}'` kill -9 $oldPid fi #Waiting port recycling @@ -50,10 +50,10 @@ nohup ./${cron_task_name} >>$OPENIM_ROOT/logs/openIM.log 2>&1 & #done #Check launched service process -check=`ps aux | grep -w ./${cron_task_name} | grep -v grep| wc -l` +check=`ps | grep -w ./${cron_task_name} | grep -v grep| wc -l` if [ $check -ge 1 ] then -newPid=`ps aux | grep -w ./${cron_task_name} | grep -v grep|awk '{print $2}'` +newPid=`ps | grep -w ./${cron_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}${BACKGROUND_GREEN}${cron_task_name}${COLOR_SUFFIX} diff --git a/scripts/start_rpc_service.sh b/scripts/start_rpc_service.sh index f5c512b21..f42f536c2 100755 --- a/scripts/start_rpc_service.sh +++ b/scripts/start_rpc_service.sh @@ -74,7 +74,7 @@ service_prometheus_port_name=( for ((i = 0; i < ${#service_filename[*]}; i++)); do #Check whether the service exists - service_name="ps -aux |grep -w ${service_filename[$i]} |grep -v grep" + service_name="ps |grep -w ${service_filename[$i]} |grep -v grep" count="${service_name}| wc -l" if [ $(eval ${count}) -gt 0 ]; then diff --git a/scripts/stop_all.sh b/scripts/stop_all.sh index 8bd5aaf34..4fd327407 100755 --- a/scripts/stop_all.sh +++ b/scripts/stop_all.sh @@ -29,7 +29,7 @@ cd "$SCRIPTS_ROOT" for i in ${service_names[*]}; do #Check whether the service exists - name="ps -aux |grep -w $i |grep -v grep" + name="ps |grep -w $i |grep -v grep" count="${name}| wc -l" if [ $(eval ${count}) -gt 0 ]; then pid="${name}| awk '{print \$2}'"