From c0e71c28c9a97af8b43482c4af9f4c8f0e84a8ce Mon Sep 17 00:00:00 2001 From: zyyang Date: Fri, 31 Dec 2021 16:16:02 +0800 Subject: [PATCH] change --- packaging/cfg/prodb.service | 21 ++++++++++++++ packaging/sed_pro.sh | 41 +++++++++++++++++--------- packaging/tools/makepkg.sh | 58 ++++++++++++++++++++++++------------- 3 files changed, 86 insertions(+), 34 deletions(-) create mode 100644 packaging/cfg/prodb.service diff --git a/packaging/cfg/prodb.service b/packaging/cfg/prodb.service new file mode 100644 index 0000000000..666bda84ff --- /dev/null +++ b/packaging/cfg/prodb.service @@ -0,0 +1,21 @@ +[Unit] +Description=ProDB server service +After=network-online.target taosadapter.service +Wants=network-online.target taosadapter.service + +[Service] +Type=simple +ExecStart=/usr/bin/prodbs +ExecStartPre=/usr/local/ProDB/bin/startPre.sh +TimeoutStopSec=1000000s +LimitNOFILE=infinity +LimitNPROC=infinity +LimitCORE=infinity +TimeoutStartSec=0 +StandardOutput=null +Restart=always +StartLimitBurst=3 +StartLimitInterval=60s + +[Install] +WantedBy=multi-user.target diff --git a/packaging/sed_pro.sh b/packaging/sed_pro.sh index eedca112fd..bc10782319 100755 --- a/packaging/sed_pro.sh +++ b/packaging/sed_pro.sh @@ -1,6 +1,6 @@ #!/bin/bash -function replace_community_pro(){ +function replace_community_pro() { # cmake/install.inc sed -i "s/C:\/TDengine/C:\/ProDB/g" ${top_dir}/cmake/install.inc sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/cmake/install.inc @@ -12,21 +12,21 @@ function replace_community_pro(){ # src/inc/taosdef.h sed -i "s/\"taosdata\"/\"prodb\"/g" ${top_dir}/src/inc/taosdef.h # src/util/src/tconfig.c - sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/src/util/src/tconfig.c - sed -i "s/etc\/taos/etc\/ProDB/g" ${top_dir}/src/util/src/tconfig.c + sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/src/util/src/tconfig.c + sed -i "s/etc\/taos/etc\/ProDB/g" ${top_dir}/src/util/src/tconfig.c # src/util/src/tlog.c - sed -i "s/log\/taos/log\/ProDB/g" ${top_dir}/src/util/src/tlog.c + sed -i "s/log\/taos/log\/ProDB/g" ${top_dir}/src/util/src/tlog.c # src/dnode/src/dnodeSystem.c sed -i "s/TDengine/ProDB/g" ${top_dir}/src/dnode/src/dnodeSystem.c - sed -i "s/TDengine/ProDB/g" ${top_dir}/src/dnode/src/dnodeMain.c - sed -i "s/taosdlog/prodlog/g" ${top_dir}/src/dnode/src/dnodeMain.c + sed -i "s/TDengine/ProDB/g" ${top_dir}/src/dnode/src/dnodeMain.c + sed -i "s/taosdlog/prodlog/g" ${top_dir}/src/dnode/src/dnodeMain.c # src/client/src/tscSystem.c - sed -i "s/taoslog/prolog/g" ${top_dir}/src/client/src/tscSystem.c + sed -i "s/taoslog/prolog/g" ${top_dir}/src/client/src/tscSystem.c # src/util/src/tnote.c - sed -i "s/taosinfo/proinfo/g" ${top_dir}/src/util/src/tnote.c + sed -i "s/taosinfo/proinfo/g" ${top_dir}/src/util/src/tnote.c # src/dnode/CMakeLists.txt - sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/src/dnode/CMakeLists.txt - echo "SET_TARGET_PROPERTIES(taosd PROPERTIES OUTPUT_NAME prodbs)" >> ${top_dir}/src/dnode/CMakeLists.txt + sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/src/dnode/CMakeLists.txt + echo "SET_TARGET_PROPERTIES(taosd PROPERTIES OUTPUT_NAME prodbs)" >>${top_dir}/src/dnode/CMakeLists.txt # src/os/src/linux/linuxEnv.c sed -i "s/etc\/taos/etc\/ProDB/g" ${top_dir}/src/os/src/linux/linuxEnv.c sed -i "s/lib\/taos/lib\/ProDB/g" ${top_dir}/src/os/src/linux/linuxEnv.c @@ -53,14 +53,27 @@ function replace_community_pro(){ sed -i "s/taosd is quiting/prodbs is quiting/g" ${top_dir}/src/plugins/monitor/src/monMain.c } -function replace_enterprise_pro(){ +function replace_enterprise_pro() { # enterprise/src/kit/perfMonitor/perfMonitor.c sed -i "s/\"taosdata\"/\"prodb\"/g" ${top_dir}/../enterprise/src/kit/perfMonitor/perfMonitor.c sed -i "s/TDengine/ProDB/g" ${top_dir}/../enterprise/src/kit/perfMonitor/perfMonitor.c # enterprise/src/plugins/admin/src/httpAdminHandle.c - sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/../enterprise/src/plugins/admin/src/httpAdminHandle.c + sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/../enterprise/src/plugins/admin/src/httpAdminHandle.c # enterprise/src/plugins/grant/src/grantMain.c - sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/../enterprise/src/plugins/grant/src/grantMain.c + sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/../enterprise/src/plugins/grant/src/grantMain.c # enterprise/src/plugins/module/src/moduleMain.c - sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/../enterprise/src/plugins/module/src/moduleMain.c + sed -i "s/taos\.cfg/prodb\.cfg/g" ${top_dir}/../enterprise/src/plugins/module/src/moduleMain.c + + # enterprise/src/plugins/web + sed -i -e 's/www.taosdata.com/www.hanatech.com.cn/g' $(grep -r 'www.taosdata.com' ${top_dir}/../enterprise/src/plugins/web | sed -r "s/(.*\.html):\s*(.*)/\1/g") + sed -i -e 's/TAOS Data/Hanatech/g' $(grep -r 'TAOS Data' ${top_dir}/../enterprise/src/plugins/web | sed -r "s/(.*\.html):\s*(.*)/\1/g") + sed -i -e 's/taosd/prodbs/g' $(grep -r 'taosd' ${top_dir}/../enterprise/src/plugins/web | grep -E '*\.js\s*.*' | sed -r -e 's/(.*\.js):\s*(.*)/\1/g' | sort | uniq) + # enterprise/src/plugins/web/admin/monitor.html + sed -i -e 's/taosd<\/th>/prodbs<\/th>/g' ${top_dir}/../enterprise/src/plugins/web/admin/monitor.html + sed -i -e "s/data:\['taosd', 'system'\],/data:\['prodbs', 'system'\],/g" ${top_dir}/../enterprise/src/plugins/web/admin/monitor.html + sed -i -e "s/name: 'taosd',/name: 'prodbs',/g" ${top_dir}/../enterprise/src/plugins/web/admin/monitor.html + # enterprise/src/plugins/web/admin/*.html + sed -i "s/TDengine/ProDB/g" ${top_dir}/../enterprise/src/plugins/web/admin/*.html + # enterprise/src/plugins/web/admin/js/*.js + sed -i "s/TDengine/ProDB/g" ${top_dir}/../enterprise/src/plugins/web/admin/js/*.js } diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 11fd73c350..e1e46512fc 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -1,6 +1,7 @@ #!/bin/bash # # Generate tar.gz package for all os system +source ./sed_replace.sh set -e #set -x @@ -27,16 +28,40 @@ release_dir="${top_dir}/release" if [ $dbName == "power" ]; then productName="PowerDB" + serverName="powerd" + clientName="power" + cfgDirName="power.cfg" + tarName="power.tar.gz" elif [ $dbName == "tq" ]; then productName="TQ" + serverName="tqd" + clientName="tq" + cfgDirName="tq.cfg" + tarName="tq.tar.gz" elif [ $dbName == "pro" ]; then productName="ProDB" + serverName="prodbs" + clientName="prodbc" + cfgDirName="prodb.cfg" + tarName="prodb.tar.gz" elif [ $dbName == "kh" ]; then productName="KingHistorian" + serverName="khserver" + clientName="khclient" + cfgDirName="kinghistorian.cfg" + tarName="kinghistorian.tar.gz" elif [ $dbName == "jh" ]; then productName="jh_iot" + serverName="jh_taosd" + clientName="jh_taos" + cfgDirName="jh_taos.cfg" + tarName="jh_taos.tar.gz" else productName="TDengine" + serverName="taosd" + clientName="taos" + cfgDirName="taos.cfg" + tarName="taos.tar.gz" fi #package_name='linux' @@ -60,14 +85,14 @@ fi # Directories and files if [ "$pagMode" == "lite" ]; then - strip ${build_dir}/bin/taosd + strip ${build_dir}/bin/${serverName} strip ${build_dir}/bin/taos # lite version doesn't include taosadapter, which will lead to no restful interface - bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${script_dir}/remove.sh ${script_dir}/startPre.sh" + bin_files="${build_dir}/bin/${serverName} ${build_dir}/bin/${clientName} ${script_dir}/remove.sh ${script_dir}/startPre.sh" taostools_bin_files="" else - bin_files="${build_dir}/bin/taosd \ - ${build_dir}/bin/taos \ + bin_files="${build_dir}/bin/${serverName} \ + ${build_dir}/bin/${clientName} \ ${build_dir}/bin/taosadapter \ ${build_dir}/bin/tarbitrator\ ${script_dir}/remove.sh \ @@ -91,22 +116,15 @@ fi install_files="${script_dir}/install.sh" nginx_dir="${code_dir}/../../enterprise/src/plugins/web" -# Init file -#init_dir=${script_dir}/deb -#if [ $package_type = "centos" ]; then -# init_dir=${script_dir}/rpm -#fi -#init_files=${init_dir}/taosd -# temp use rpm's taosd. TODO: later modify according to os type -init_file_deb=${script_dir}/../deb/taosd -init_file_rpm=${script_dir}/../rpm/taosd +init_file_deb=${script_dir}/../deb/${serverName} +init_file_rpm=${script_dir}/../rpm/${serverName} init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord # make directories. mkdir -p ${install_dir} mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc -mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/taos.cfg ${install_dir}/cfg/taos.cfg +mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/${cfgDirName} ${install_dir}/cfg/${cfgDirName} if [ -f "${compile_dir}/test/cfg/taosadapter.toml" ]; then cp ${compile_dir}/test/cfg/taosadapter.toml ${install_dir}/cfg || : @@ -116,8 +134,8 @@ if [ -f "${compile_dir}/test/cfg/taosadapter.service" ]; then cp ${compile_dir}/test/cfg/taosadapter.service ${install_dir}/cfg || : fi -if [ -f "${cfg_dir}/taosd.service" ]; then - cp ${cfg_dir}/taosd.service ${install_dir}/cfg || : +if [ -f "${cfg_dir}/${serverName}.service" ]; then + cp ${cfg_dir}/${serverName}.service ${install_dir}/cfg || : fi if [ -f "${cfg_dir}/tarbitratord.service" ]; then @@ -129,8 +147,8 @@ if [ -f "${cfg_dir}/nginxd.service" ]; then fi mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : -mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/taosd.deb -mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/taosd.rpm +mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/${serverName}.deb +mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/${serverName}.rpm mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_deb} ${install_dir}/init.d/tarbitratord.deb || : mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir}/init.d/tarbitratord.rpm || : @@ -209,10 +227,10 @@ if [ "$verMode" == "cluster" ]; then fi cd ${install_dir} -tar -zcv -f taos.tar.gz * --remove-files || : +tar -zcv -f ${tarName} * --remove-files || : exitcode=$? if [ "$exitcode" != "0" ]; then - echo "tar taos.tar.gz error !!!" + echo "tar ${tarName} error !!!" exit $exitcode fi -- GitLab