From 3f69f06cea85318acd14ff29aa34a82c02c0276e Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 16:09:59 +0800 Subject: [PATCH 01/42] =?UTF-8?q?=E6=B7=BB=E5=8A=A0author?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 261eeb9e9..f37a89ca4 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright [midoks] [midoks of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 798e51a1c175a7be484b2bca06ba9be310983536 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 16:33:05 +0800 Subject: [PATCH 02/42] =?UTF-8?q?=E9=81=BF=E5=85=8D=E9=A2=91=E7=B9=81?= =?UTF-8?q?=E6=89=A7=E8=A1=8Cacme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/site_api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/class/core/site_api.py b/class/core/site_api.py index 9ab00f1dc..6978c96e1 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -599,7 +599,11 @@ class site_api: if not os.path.exists(acem): return mw.returnJson(False, '尝试自动安装ACME失败,请通过以下命令尝试手动安装

安装命令: curl https://get.acme.sh | sh

' + acem) - force_bool = False + # 避免频繁执行 + checkAcmeRun = mw.execShell('ps -ef|grep acme.sh |grep -v grep') + if checkAcmeRun[0] != '': + return mw.returnJson(False, '正在申请或更新SSL中...') + if force == 'true': force_bool = True @@ -973,7 +977,7 @@ class site_api: "-START(.|\n)+BINDING-" + domain + "-END" tmp = re.search(rep, conf).group() dirConf = tmp.replace('rewrite/' + site['name'] + '.conf;', 'rewrite/' + site[ - 'name'] + '_' + find['path'] + '.conf;') + 'name'] + '_' + find['path'] + '.conf;') conf = conf.replace(tmp, dirConf) mw.writeFile(file, conf) data = {} From eb740d7d1b1d3872d6acb40a453c5b8bf5175947 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 16:36:12 +0800 Subject: [PATCH 03/42] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/task.py b/task.py index 62ba5f4ef..ad284595b 100755 --- a/task.py +++ b/task.py @@ -452,8 +452,8 @@ def checkPHPVersion(version): try: url = 'http://127.0.0.1/phpfpm_status_' + version result = mw.httpGet(url) - # print version,result - # 检查nginx + # print(version,result) + # 检查openresty if result.find('Bad Gateway') != -1: return False if result.find('HTTP Error 404: Not Found') != -1: @@ -466,9 +466,16 @@ def checkPHPVersion(version): isStatus = mw.readFile(isTask) if isStatus == 'True': return True - filename = '/etc/init.d/openresty' - if os.path.exists(filename): - os.system(filename + ' start') + + # systemd + systemd = '/lib/systemd/system/openresty.service' + if os.path.exists(systemd): + execShell('systemctl reload openresty') + return True + # initd + initd = '/etc/init.d/openresty' + if os.path.exists(initd): + os.system(initd + ' reload') return True except: return True From 701bdbbe84e54e89ae4c03e6d01969fda41cb54a Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 16:37:10 +0800 Subject: [PATCH 04/42] Update task.py --- task.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/task.py b/task.py index ad284595b..4d54a4331 100755 --- a/task.py +++ b/task.py @@ -388,7 +388,8 @@ def check502Task(): def check502(): try: - phpversions = ['53', '54', '55', '56', '70', '71', '72', '73', '74'] + phpversions = ['52', '53', '54', '55', '56', '70', + '71', '72', '73', '74', '80', '81'] for version in phpversions: sdir = mw.getServerDir() php_path = sdir + '/php/' + version + '/sbin/php-fpm' From 110a59466c318aa22a1add1d926a9953391aed35 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 16:37:32 +0800 Subject: [PATCH 05/42] Update task.py --- task.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/task.py b/task.py index 4d54a4331..3ec03afbf 100755 --- a/task.py +++ b/task.py @@ -388,9 +388,9 @@ def check502Task(): def check502(): try: - phpversions = ['52', '53', '54', '55', '56', '70', - '71', '72', '73', '74', '80', '81'] - for version in phpversions: + verlist = ['52', '53', '54', '55', '56', '70', + '71', '72', '73', '74', '80', '81'] + for version in verlist: sdir = mw.getServerDir() php_path = sdir + '/php/' + version + '/sbin/php-fpm' if not os.path.exists(php_path): From e47545edf6f971ea967b07d056515c9339e48fbf Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 16:37:56 +0800 Subject: [PATCH 06/42] Update task.py --- task.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/task.py b/task.py index 3ec03afbf..4130ff396 100755 --- a/task.py +++ b/task.py @@ -390,16 +390,16 @@ def check502(): try: verlist = ['52', '53', '54', '55', '56', '70', '71', '72', '73', '74', '80', '81'] - for version in verlist: + for ver in verlist: sdir = mw.getServerDir() - php_path = sdir + '/php/' + version + '/sbin/php-fpm' + php_path = sdir + '/php/' + ver + '/sbin/php-fpm' if not os.path.exists(php_path): continue - if checkPHPVersion(version): + if checkPHPVersion(ver): continue - if startPHPVersion(version): - print('检测到PHP-' + version + '处理异常,已自动修复!') - mw.writeLog('PHP守护程序', '检测到PHP-' + version + '处理异常,已自动修复!') + if startPHPVersion(ver): + print('检测到PHP-' + ver + '处理异常,已自动修复!') + mw.writeLog('PHP守护程序', '检测到PHP-' + ver + '处理异常,已自动修复!') except Exception as e: print(str(e)) From c8cadbda2eddab2bfe014c4dc6f7df0c5638cc49 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 16:57:58 +0800 Subject: [PATCH 07/42] =?UTF-8?q?=E4=BC=98=E5=8C=96task=EF=BC=8C=E6=AF=8F?= =?UTF-8?q?=E5=A4=A9=E9=87=8D=E5=90=AF=E4=B8=80=E6=AC=A1openresty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task.py | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/task.py b/task.py index 4130ff396..c1dcb1590 100755 --- a/task.py +++ b/task.py @@ -75,7 +75,6 @@ def execShell(cmdstring, cwd=None, timeout=None, shell=True): import shlex import datetime import subprocess - import time if timeout: end_time = datetime.datetime.now() + datetime.timedelta(seconds=timeout) @@ -226,7 +225,6 @@ def systemTask(): try: import system_api import psutil - import time sm = system_api.system_api() filename = 'data/control.conf' @@ -368,7 +366,7 @@ def systemTask(): mw.writeFile('logs/sys_interrupt.pl', str(ex)) restartMw() - import time + time.sleep(30) systemTask() @@ -483,8 +481,35 @@ def checkPHPVersion(version): # --------------------------------------PHP监控 end--------------------------------------------- # + +# --------------------------------------OpenResty Auto Restart Start --------------------------------------------- # +# 解决acme.sh续签后,未起效。 +def openrestyAutoRestart(): + try: + while True: + # 检查是否安装 + odir = mw.getServerDir() + '/openresty' + if os.path.exists(odir): + continue + + # systemd + systemd = '/lib/systemd/system/openresty.service' + initd = '/etc/init.d/openresty' + if os.path.exists(systemd): + execShell('systemctl reload openresty') + elif os.path.exists(initd): + os.system(initd + ' reload') + time.sleep(86400) + except Exception as e: + print(str(e)) + time.sleep(86400) + +# --------------------------------------OpenResty Auto Restart End --------------------------------------------- # + + if __name__ == "__main__": + # 系统监控 t = threading.Thread(target=systemTask) if sys.version_info.major == 3 and sys.version_info.minor >= 10: t.daemon = True @@ -492,12 +517,20 @@ if __name__ == "__main__": t.setDaemon(True) t.start() + # PHP 502错误检查线程 p = threading.Thread(target=check502Task) if sys.version_info.major == 3 and sys.version_info.minor >= 10: p.daemon = True else: p.setDaemon(True) - p.start() + # OpenResty Auto Restart Start + oar = threading.Thread(target=openrestyAutoRestart) + if sys.version_info.major == 3 and sys.version_info.minor >= 10: + oar.daemon = True + else: + oar.setDaemon(True) + oar.start() + startTask() From 9acf8edd8b35535a8d78a297794fed8a59625796 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 17:20:09 +0800 Subject: [PATCH 08/42] Update task.py --- task.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/task.py b/task.py index c1dcb1590..5cee97a14 100755 --- a/task.py +++ b/task.py @@ -489,7 +489,8 @@ def openrestyAutoRestart(): while True: # 检查是否安装 odir = mw.getServerDir() + '/openresty' - if os.path.exists(odir): + if not os.path.exists(odir): + time.sleep(86400) continue # systemd @@ -499,7 +500,7 @@ def openrestyAutoRestart(): execShell('systemctl reload openresty') elif os.path.exists(initd): os.system(initd + ' reload') - time.sleep(86400) + time.sleep(86400) except Exception as e: print(str(e)) time.sleep(86400) From 24d08f8f83fb63ec47c8b6a18ad0de447b0ca754 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 18:19:31 +0800 Subject: [PATCH 09/42] Update lib.sh --- scripts/lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index 7f33fc0e7..4574326a9 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -303,8 +303,9 @@ elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then apt install -y libxml2 libxml2-dev libbz2-dev libmcrypt-dev libpspell-dev librecode-dev apt install -y libgmp-dev libgmp3-dev libreadline-dev libxpm-dev apt install -y zlib1g-dev dia pkg-config - apt install -y libjpeg62-turbo-dev libjpeg-dev libpng-dev + apt install -y libjpeg-dev libpng-dev apt install -y libfreetype6 + apt install -y libjpeg62-turbo-dev apt install -y libfreetype6-dev apt install -y libevent-dev libncurses5-dev libldap2-dev From d96c3105a4683fc2cfdd18e4127e4d4287698d2a Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 18:30:19 +0800 Subject: [PATCH 10/42] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=BF=AE=E6=94=B9servi?= =?UTF-8?q?ce=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/varnish/index.html | 1 + plugins/varnish/index.py | 6 ++++ plugins/varnish/js/varnish.js | 61 +++++++++++++++++++++++++++++++++-- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/plugins/varnish/index.html b/plugins/varnish/index.html index df23818be..d250b0686 100755 --- a/plugins/varnish/index.html +++ b/plugins/varnish/index.html @@ -4,6 +4,7 @@

服务

自启动

VCL

+

服务配置

日志

状态

diff --git a/plugins/varnish/index.py b/plugins/varnish/index.py index 21cfa828a..78f3df281 100755 --- a/plugins/varnish/index.py +++ b/plugins/varnish/index.py @@ -172,6 +172,10 @@ def initdUinstall(): def runLog(): return "/var/log/varnish/varnishncsa.log" + +def confService(): + return '/lib/systemd/system/varnish.service' + if __name__ == "__main__": func = sys.argv[1] if func == 'status': @@ -194,6 +198,8 @@ if __name__ == "__main__": print(runInfo()) elif func == 'conf': print(getConf()) + elif func == 'conf_service': + print(confService()) elif func == 'run_log': print(runLog()) elif func == 'config_tpl': diff --git a/plugins/varnish/js/varnish.js b/plugins/varnish/js/varnish.js index 607289aca..5a0ffbcec 100644 --- a/plugins/varnish/js/varnish.js +++ b/plugins/varnish/js/varnish.js @@ -9,7 +9,7 @@ function pRead(){ } -//redis负载状态 start +//varnish负载状态 start function varnishStatus() { var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); $.post('/plugins/run', {name:'varnish', func:'run_info'}, function(data) { @@ -41,4 +41,61 @@ function varnishStatus() { $(".soft-man-con").html(Con); },'json'); } -//redis负载状态 end \ No newline at end of file +//varnish负载状态 end + + +//varnish service --- +function varnishPluginConfig(_name, version, func){ + if ( typeof(version) == 'undefined' ){ + version = ''; + } + + var func_name = 'conf'; + if ( typeof(func) != 'undefined' ){ + func_name = func; + } + + var con = '

提示:Ctrl+F 搜索关键字,Ctrl+G 查找下一个,Ctrl+S 保存,Ctrl+Shift+R 查找替换!

\ + \ + \ +
    \ +
  • 此处为'+ _name + version +'主配置文件,若您不了解配置规则,请勿随意修改。
  • \ +
'; + $(".soft-man-con").html(con); + + var loadT = layer.msg('配置文件路径获取中...',{icon:16,time:0,shade: [0.3, '#000']}); + $.post('/plugins/run', {name:_name, func:func_name,version:version},function (data) { + layer.close(loadT); + + var loadT2 = layer.msg('文件内容获取中...',{icon:16,time:0,shade: [0.3, '#000']}); + var fileName = data.data; + $.post('/files/get_body', 'path=' + fileName, function(rdata) { + layer.close(loadT2); + if (!rdata.status){ + layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + return; + } + $("#textBody").empty().text(rdata.data.data); + $(".CodeMirror").remove(); + var editor = CodeMirror.fromTextArea(document.getElementById("textBody"), { + extraKeys: { + "Ctrl-Space": "autocomplete", + "Ctrl-F": "findPersistent", + "Ctrl-H": "replaceAll", + "Ctrl-S": function() { + $("#textBody").text(editor.getValue()); + pluginConfigSave(fileName); + } + }, + lineNumbers: true, + matchBrackets:true, + }); + editor.focus(); + $(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0}); + $("#onlineEditFileBtn").click(function(){ + $("#textBody").text(editor.getValue()); + pluginConfigSave(fileName); + }); + },'json'); + },'json'); +} From 3a24753299ec70d04ed48e22327c86f32b6b14f3 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 19:13:25 +0800 Subject: [PATCH 11/42] =?UTF-8?q?PHP5.2=20=E9=AB=98=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=A3=80=E6=9F=A5,=E6=97=A0=E6=B3=95=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/php/versions/52/install.sh | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/plugins/php/versions/52/install.sh b/plugins/php/versions/52/install.sh index 5bacea599..9cdb35703 100755 --- a/plugins/php/versions/52/install.sh +++ b/plugins/php/versions/52/install.sh @@ -11,6 +11,46 @@ sysName=`uname` install_tmp=${rootPath}/tmp/mw_install.pl + +_os=`uname` +echo "use system: ${_os}" + +if [ ${_os} == "Darwin" ]; then + OSNAME='macos' +elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then + OSNAME='centos' +elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then + OSNAME='fedora' +elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then + OSNAME='rocky' +elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then + OSNAME='alma' +elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then + OSNAME='debian' +elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then + OSNAME='ubuntu' +elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then + OSNAME='raspbian' +else + OSNAME='unknow' +fi + + +if [ "$OSNAME" == 'ubuntu' ] || [ "$OSNAME" == 'debian' ] ;then + apt install bison=2.4.1 + if [ "$?" != "0" ]; then + echo 'The system version is too high to install' + exit 1 + fi + + apt install flex=2.5.4 + if [ "$?" != "0" ]; then + echo 'The system version is too high to install' + exit 1 + fi +fi + + version=5.2.17 PHP_VER=52 Install_php() From fb358f18486373a9bd4d2bfb8862da532d9cbf20 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:01:43 +0800 Subject: [PATCH 12/42] debian11 mysqlclient remove --- scripts/install/debian.sh | 2 ++ scripts/update/debian.sh | 1 + 2 files changed, 3 insertions(+) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index e5338111f..d7744973b 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -70,6 +70,8 @@ fi pip install --upgrade pip pip install --upgrade setuptools + +sed -i "/mysqlclient/d" /www/server/mdserver-web/requirements.txt cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt pip3 install gunicorn==20.1.0 diff --git a/scripts/update/debian.sh b/scripts/update/debian.sh index 5029b36ca..1e2d8156c 100644 --- a/scripts/update/debian.sh +++ b/scripts/update/debian.sh @@ -21,6 +21,7 @@ fi pip install --upgrade pip pip install --upgrade setuptools +sed -i "/mysqlclient/d" /www/server/mdserver-web/requirements.txt cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt pip3 install gunicorn==20.1.0 From dde66366edd692f00a568a100fb2b493250bdb4c Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:02:25 +0800 Subject: [PATCH 13/42] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9f607da48..4b1870f88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,6 +22,6 @@ zmq==0.0.0 pymongo pillow Jinja2>=2.11.2 -mysqlclient>=2.0.3 flask-caching>=1.10.1 mysql-connector-python +mysqlclient>=2.0.3 From 373b7ebadac5668424a2df9c70586a503d6b98e6 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:05:39 +0800 Subject: [PATCH 14/42] Update requirements.txt --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4b1870f88..818b46e69 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,4 +24,3 @@ pillow Jinja2>=2.11.2 flask-caching>=1.10.1 mysql-connector-python -mysqlclient>=2.0.3 From b23a8ebef3b3efdf398646d6e7a7adbe95e87825 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:06:59 +0800 Subject: [PATCH 15/42] Update debian.sh --- scripts/install/debian.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index d7744973b..b9ebed2ab 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -80,6 +80,7 @@ pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 pip3 install flask-socketio==5.2.0 +pip3 install mysqlclient==2.0.3 pip3 install pymongo pip3 install psutil @@ -95,6 +96,7 @@ if [ ! -f /www/server/mdserver-web/bin/activate ];then pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 pip3 install flask-socketio==5.2.0 + pip3 install mysqlclient==2.0.3 pip3 install pymongo pip3 install psutil fi From 833ce4583430e1de48fee9ca16d4d0c9bd5d4d08 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:08:08 +0800 Subject: [PATCH 16/42] Update debian.sh --- scripts/install/debian.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index b9ebed2ab..031467152 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -79,10 +79,10 @@ pip3 install gevent==21.1.2 pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 -pip3 install flask-socketio==5.2.0 pip3 install mysqlclient==2.0.3 pip3 install pymongo pip3 install psutil +pip3 install flask-socketio==5.2.0 if [ ! -f /www/server/mdserver-web/bin/activate ];then cd /www/server/mdserver-web && python3 -m venv . @@ -95,10 +95,10 @@ if [ ! -f /www/server/mdserver-web/bin/activate ];then pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 - pip3 install flask-socketio==5.2.0 pip3 install mysqlclient==2.0.3 pip3 install pymongo - pip3 install psutil + pip3 install psutil + pip3 install flask-socketio==5.2.0 fi From 96201fb21d83d69c1d6a346dde461385fd34187f Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:08:31 +0800 Subject: [PATCH 17/42] Update debian.sh --- scripts/install/debian.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 031467152..5a8199ec2 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -68,8 +68,6 @@ if [ ! -f /usr/local/bin/pip3 ];then fi pip install --upgrade pip -pip install --upgrade setuptools - sed -i "/mysqlclient/d" /www/server/mdserver-web/requirements.txt cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt @@ -89,7 +87,6 @@ if [ ! -f /www/server/mdserver-web/bin/activate ];then cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate pip install --upgrade pip pip3 install -r /www/server/mdserver-web/requirements.txt - pip install --upgrade setuptools pip3 install gunicorn==20.1.0 pip3 install gevent==21.1.2 pip3 install gevent-websocket==0.10.1 From b52cd332860124f7b4da746eaa0962b46bcec433 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:24:23 +0800 Subject: [PATCH 18/42] Update zlib.sh --- plugins/php/lib/zlib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/php/lib/zlib.sh b/plugins/php/lib/zlib.sh index 56e159a18..ab6b4c50a 100644 --- a/plugins/php/lib/zlib.sh +++ b/plugins/php/lib/zlib.sh @@ -13,7 +13,7 @@ rootPath=$(dirname "$rootPath") SERVER_ROOT=$rootPath/lib SOURCE_ROOT=$rootPath/source/lib -if [ ! -d ${SERVER_ROOT}/libiconv ];then +if [ ! -d ${SERVER_ROOT}/zlib ];then cd $SOURCE_ROOT if [ ! -f ${SOURCE_ROOT}/zlib-1.2.11.tar.gz ];then From 655e239ecf811e642e3abd456ebb14e7ff4f8123 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:34:02 +0800 Subject: [PATCH 19/42] =?UTF-8?q?openresty=20zlib=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=87=AA=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/openresty/install.sh | 10 ++++++++-- plugins/openresty/lib/zlib.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 plugins/openresty/lib/zlib.sh diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 53ae30979..409d2be2a 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -24,11 +24,14 @@ else useradd -g www -s /bin/bash www fi +# cd /www/server/mdserver-web/plugins/openresty && /bin/bash install.sh install 1.21.4.1 Install_openresty() { mkdir -p ${openrestyDir} echo '正在安装脚本文件...' > $install_tmp + cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh + if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then wget -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz fi @@ -41,9 +44,12 @@ Install_openresty() --with-http_v2_module \ --with-http_ssl_module \ --with-http_slice_module \ - --with-http_stub_status_module && make && make install && \ + --with-http_stub_status_module \ + --with-zlib=$serverPath/lib/zlib + + make && make install && make clean echo "${VERSION}" > $serverPath/openresty/version.pl - echo "" > $serverPath/web_conf/nginx/enable-php-00.conf + echo "" > $serverPath/openresty/nginx/conf/enable-php-00.conf echo '安装完成' > $install_tmp } diff --git a/plugins/openresty/lib/zlib.sh b/plugins/openresty/lib/zlib.sh new file mode 100644 index 000000000..ab6b4c50a --- /dev/null +++ b/plugins/openresty/lib/zlib.sh @@ -0,0 +1,31 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") + +# echo $rootPath + +SERVER_ROOT=$rootPath/lib +SOURCE_ROOT=$rootPath/source/lib + +if [ ! -d ${SERVER_ROOT}/zlib ];then + + cd $SOURCE_ROOT + if [ ! -f ${SOURCE_ROOT}/zlib-1.2.11.tar.gz ];then + wget -O zlib-1.2.11.tar.gz --no-check-certificate https://github.com/madler/zlib/archive/v1.2.11.tar.gz -T 20 + fi + + tar -zxvf zlib-1.2.11.tar.gz + cd zlib-1.2.11 + + ./configure --prefix=${SERVER_ROOT}/zlib && make && make install + + #cd $SOURCE_ROOT + #rm -rf zlib-1.2.11 + #rm -rf zlib-1.2.11.tar.gz +fi \ No newline at end of file From c126f87322e31d0f2772fa48348cf00f99797131 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 20:46:10 +0800 Subject: [PATCH 20/42] Update install.sh --- plugins/openresty/install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 409d2be2a..e2c0fb068 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -46,10 +46,13 @@ Install_openresty() --with-http_slice_module \ --with-http_stub_status_module \ --with-zlib=$serverPath/lib/zlib - + make && make install && make clean echo "${VERSION}" > $serverPath/openresty/version.pl - echo "" > $serverPath/openresty/nginx/conf/enable-php-00.conf + + if [ -d $serverPath/openresty/nginx/conf ];then + echo "" > $serverPath/openresty/nginx/conf/enable-php-00.conf + fi echo '安装完成' > $install_tmp } From 53a7761b10978e1db757d27e0404ffeb76b71e79 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 22:12:52 +0800 Subject: [PATCH 21/42] #87 --- plugins/redis/index.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/redis/index.py b/plugins/redis/index.py index 0a7f24910..5c57d2fef 100755 --- a/plugins/redis/index.py +++ b/plugins/redis/index.py @@ -96,9 +96,12 @@ def initDreplace(): # config replace dst_conf = getServerDir() + '/redis.conf' - conf_content = mw.readFile(getConfTpl()) - conf_content = conf_content.replace('{$SERVER_PATH}', service_path) - mw.writeFile(dst_conf, conf_content) + dst_conf_init = getServerDir() + '/init.pl' + if not os.path.exists(dst_conf_init): + conf_content = mw.readFile(getConfTpl()) + conf_content = conf_content.replace('{$SERVER_PATH}', service_path) + mw.writeFile(dst_conf, conf_content) + mw.writeFile(dst_conf_init, 'ok') # systemd systemDir = '/lib/systemd/system' From 79d6fd3a2b66443d7ca78fa2565a8265d44aec98 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 00:48:52 +0800 Subject: [PATCH 22/42] debug zlib1g --- plugins/openresty/install.sh | 16 +++++++--------- plugins/openresty/lib/zlib.sh | 31 ------------------------------- scripts/install/debian.sh | 22 ++++++++++++++++++++++ scripts/install_dev.sh | 1 + scripts/lib.sh | 3 ++- 5 files changed, 32 insertions(+), 41 deletions(-) delete mode 100644 plugins/openresty/lib/zlib.sh diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index e2c0fb068..92954192e 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -30,8 +30,6 @@ Install_openresty() mkdir -p ${openrestyDir} echo '正在安装脚本文件...' > $install_tmp - cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh - if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then wget -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz fi @@ -40,19 +38,19 @@ Install_openresty() cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz # --with-openssl=$serverPath/source/lib/openssl-1.0.2q - cd ${openrestyDir}/openresty-${VERSION} && ./configure --prefix=$serverPath/openresty \ + cd ${openrestyDir}/openresty-${VERSION} && ./configure \ + --prefix=$serverPath/openresty \ --with-http_v2_module \ --with-http_ssl_module \ --with-http_slice_module \ - --with-http_stub_status_module \ - --with-zlib=$serverPath/lib/zlib + --with-http_stub_status_module - make && make install && make clean - echo "${VERSION}" > $serverPath/openresty/version.pl + gmake && gmake install && make clean - if [ -d $serverPath/openresty/nginx/conf ];then + if [ -d $serverPath/openresty ];then + echo "${VERSION}" > $serverPath/openresty/version.pl echo "" > $serverPath/openresty/nginx/conf/enable-php-00.conf - fi + fi echo '安装完成' > $install_tmp } diff --git a/plugins/openresty/lib/zlib.sh b/plugins/openresty/lib/zlib.sh deleted file mode 100644 index ab6b4c50a..000000000 --- a/plugins/openresty/lib/zlib.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -curPath=`pwd` -rootPath=$(dirname "$curPath") -rootPath=$(dirname "$rootPath") -rootPath=$(dirname "$rootPath") -rootPath=$(dirname "$rootPath") - -# echo $rootPath - -SERVER_ROOT=$rootPath/lib -SOURCE_ROOT=$rootPath/source/lib - -if [ ! -d ${SERVER_ROOT}/zlib ];then - - cd $SOURCE_ROOT - if [ ! -f ${SOURCE_ROOT}/zlib-1.2.11.tar.gz ];then - wget -O zlib-1.2.11.tar.gz --no-check-certificate https://github.com/madler/zlib/archive/v1.2.11.tar.gz -T 20 - fi - - tar -zxvf zlib-1.2.11.tar.gz - cd zlib-1.2.11 - - ./configure --prefix=${SERVER_ROOT}/zlib && make && make install - - #cd $SOURCE_ROOT - #rm -rf zlib-1.2.11 - #rm -rf zlib-1.2.11.tar.gz -fi \ No newline at end of file diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 5a8199ec2..d792c083e 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -3,6 +3,14 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH LANG=en_US.UTF-8 +# RED='\e[1;31m' # 红色 +# GREEN='\e[1;32m' # 绿色 +# YELLOW='\e[1;33m' # 黄色 +# BLUE='\e[1;34m' # 蓝色 +# PURPLE='\e[1;35m' # 紫色 +# CYAN='\e[1;36m' # 蓝绿色 +# WHITE='\e[1;37m' # 白色 +# NC='\e[0m' # 没有颜色 apt update -y @@ -63,6 +71,20 @@ systemctl stop firewalld cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data + +#fix zlib1g-dev fail +echo -e "\e[0;32mfix zlib1g-dev install question\e[0m" +Install_TmpFile=/tmp/debian-fix-zlib1g-dev.txt +apt install -y zlib1g-dev > ${Install_TmpFile} +if [ "$?" != "0" ];then + ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}') + echo "1${ZLIB1G_BASE_VER}1" +# apt install zlib1g=1:1.2.11.dfsg-2 zlib1g-dev +fi +echo "\e[0;32mfix zlib1g-dev install question\e[0m" + + + if [ ! -f /usr/local/bin/pip3 ];then python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh index 4b914988f..37462fa8b 100755 --- a/scripts/install_dev.sh +++ b/scripts/install_dev.sh @@ -44,6 +44,7 @@ elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; th yum install -y wget zip unzip elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then OSNAME='debian' + apt install -y devscripts apt install -y wget zip unzip elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then OSNAME='ubuntu' diff --git a/scripts/lib.sh b/scripts/lib.sh index 4574326a9..38bcda714 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -302,7 +302,8 @@ elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then apt install -y libxml2 libxml2-dev libbz2-dev libmcrypt-dev libpspell-dev librecode-dev apt install -y libgmp-dev libgmp3-dev libreadline-dev libxpm-dev - apt install -y zlib1g-dev dia pkg-config + apt install -y dia pkg-config + apt install -y zlib1g-dev apt install -y libjpeg-dev libpng-dev apt install -y libfreetype6 apt install -y libjpeg62-turbo-dev From bfa1fd2d88f0f8d9dc5e2eab6be3f60f5be4398a Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 00:50:32 +0800 Subject: [PATCH 23/42] Update debian.sh --- scripts/install/debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index d792c083e..5b03b264c 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -81,7 +81,7 @@ if [ "$?" != "0" ];then echo "1${ZLIB1G_BASE_VER}1" # apt install zlib1g=1:1.2.11.dfsg-2 zlib1g-dev fi -echo "\e[0;32mfix zlib1g-dev install question\e[0m" +echo -e "\e[0;32mfix zlib1g-dev install question\e[0m" From d9d7939fe98ff3f951e46864021b3cacefb5bc98 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 00:54:01 +0800 Subject: [PATCH 24/42] Update debian.sh --- scripts/install/debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 5b03b264c..41d8e9b5a 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -78,6 +78,7 @@ Install_TmpFile=/tmp/debian-fix-zlib1g-dev.txt apt install -y zlib1g-dev > ${Install_TmpFile} if [ "$?" != "0" ];then ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}') + ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"` echo "1${ZLIB1G_BASE_VER}1" # apt install zlib1g=1:1.2.11.dfsg-2 zlib1g-dev fi From a1a154cc5223231faa712efa75678b3388c53ed6 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 00:57:10 +0800 Subject: [PATCH 25/42] Update debian.sh --- scripts/install/debian.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 41d8e9b5a..563d47e4a 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -68,10 +68,6 @@ fi systemctl stop firewalld -cd /www/server/mdserver-web/scripts && bash lib.sh -chmod 755 /www/server/mdserver-web/data - - #fix zlib1g-dev fail echo -e "\e[0;32mfix zlib1g-dev install question\e[0m" Install_TmpFile=/tmp/debian-fix-zlib1g-dev.txt @@ -79,12 +75,17 @@ apt install -y zlib1g-dev > ${Install_TmpFile} if [ "$?" != "0" ];then ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}') ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"` - echo "1${ZLIB1G_BASE_VER}1" -# apt install zlib1g=1:1.2.11.dfsg-2 zlib1g-dev + # echo "1${ZLIB1G_BASE_VER}1" + apt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev fi +rm -rf ${Install_TmpFile} echo -e "\e[0;32mfix zlib1g-dev install question\e[0m" +cd /www/server/mdserver-web/scripts && bash lib.sh +chmod 755 /www/server/mdserver-web/data + + if [ ! -f /usr/local/bin/pip3 ];then python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple From c7daaf939709422d351a8b5c143dc370d6f3d5b7 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 01:00:46 +0800 Subject: [PATCH 26/42] Update debian.sh --- scripts/install/debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 563d47e4a..f3b14d382 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -76,7 +76,7 @@ if [ "$?" != "0" ];then ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}') ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"` # echo "1${ZLIB1G_BASE_VER}1" - apt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev + apt install -y zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev fi rm -rf ${Install_TmpFile} echo -e "\e[0;32mfix zlib1g-dev install question\e[0m" From c8d092636268e79043b38e255d5fce727b0880e1 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 01:02:31 +0800 Subject: [PATCH 27/42] Update debian.sh --- scripts/install/debian.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index f3b14d382..8f354878e 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -69,7 +69,7 @@ systemctl stop firewalld #fix zlib1g-dev fail -echo -e "\e[0;32mfix zlib1g-dev install question\e[0m" +echo -e "\e[0;32mfix zlib1g-dev install question start\e[0m" Install_TmpFile=/tmp/debian-fix-zlib1g-dev.txt apt install -y zlib1g-dev > ${Install_TmpFile} if [ "$?" != "0" ];then @@ -79,7 +79,7 @@ if [ "$?" != "0" ];then apt install -y zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev fi rm -rf ${Install_TmpFile} -echo -e "\e[0;32mfix zlib1g-dev install question\e[0m" +echo -e "\e[0;32mfix zlib1g-dev install question end\e[0m" cd /www/server/mdserver-web/scripts && bash lib.sh From b56d15c2f9cb3e6b6fa75b4e4d98ae1f5447107c Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 01:03:39 +0800 Subject: [PATCH 28/42] Update debian.sh --- scripts/install/debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 8f354878e..0a5768639 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -76,6 +76,7 @@ if [ "$?" != "0" ];then ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}') ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"` # echo "1${ZLIB1G_BASE_VER}1" + echo -e "\e[1;31mapt install -y zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev\e[0m" apt install -y zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev fi rm -rf ${Install_TmpFile} From a7801cb5bdc93b8041e15030444a3091b202af50 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 01:08:31 +0800 Subject: [PATCH 29/42] Update debian.sh --- scripts/install/debian.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 0a5768639..a2a4eae1d 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -76,8 +76,8 @@ if [ "$?" != "0" ];then ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}') ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"` # echo "1${ZLIB1G_BASE_VER}1" - echo -e "\e[1;31mapt install -y zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev\e[0m" - apt install -y zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev + echo -e "\e[1;31mapt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev\e[0m" + apt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev fi rm -rf ${Install_TmpFile} echo -e "\e[0;32mfix zlib1g-dev install question end\e[0m" From e0c18b74083260c0e0760b48e2f41b3fd61ec80f Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 01:16:25 +0800 Subject: [PATCH 30/42] Update debian.sh --- scripts/install/debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index a2a4eae1d..672a2af12 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -77,7 +77,7 @@ if [ "$?" != "0" ];then ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"` # echo "1${ZLIB1G_BASE_VER}1" echo -e "\e[1;31mapt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev\e[0m" - apt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev + echo "Y" | apt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev fi rm -rf ${Install_TmpFile} echo -e "\e[0;32mfix zlib1g-dev install question end\e[0m" From 43fafcdc00e91d4890b048a375141b2c6a9d1d1a Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 01:26:33 +0800 Subject: [PATCH 31/42] up --- scripts/install/debian.sh | 1 + scripts/install/ubuntu.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 672a2af12..95ffafc1f 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -17,6 +17,7 @@ apt update -y apt install -y wget curl lsof unzip apt install -y python3-pip +apt install -y python3-dev apt install -y python3-venv apt install -y cron diff --git a/scripts/install/ubuntu.sh b/scripts/install/ubuntu.sh index 9bec0dbdd..adf835437 100644 --- a/scripts/install/ubuntu.sh +++ b/scripts/install/ubuntu.sh @@ -9,6 +9,8 @@ apt update -y apt install -y wget curl lsof unzip apt install -y python3-pip apt install -y python3-venv +apt install -y python3-dev + apt install -y cron From 56d042431b346ff9ef3334714f80dc923a47f01e Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 02:49:49 +0800 Subject: [PATCH 32/42] =?UTF-8?q?=E5=85=BC=E5=AE=B9debian=E6=97=A0127.0.0.?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/openresty/index.py | 18 +++++++++++++++++- plugins/php/index.py | 14 ++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index 8875bb4e7..3fd4fc2af 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -265,9 +265,12 @@ def initdUinstall(): def runInfo(): + # 取Openresty负载状态 + try: - result = mw.httpGet('http://127.0.0.1/nginx_status') + url = 'http://' + mw.GetLocalIp() + '/nginx_status' + result = mw.httpGet(url) tmp = result.split() data = {} data['active'] = tmp[2] @@ -279,6 +282,19 @@ def runInfo(): data['Waiting'] = tmp[15] return mw.getJson(data) except Exception as e: + url = 'http://127.0.0.1/nginx_status' + result = mw.httpGet(url) + tmp = result.split() + data = {} + data['active'] = tmp[2] + data['accepts'] = tmp[9] + data['handled'] = tmp[7] + data['requests'] = tmp[8] + data['Reading'] = tmp[11] + data['Writing'] = tmp[13] + data['Waiting'] = tmp[15] + return mw.getJson(data) + else return 'oprenresty not started' diff --git a/plugins/php/index.py b/plugins/php/index.py index d23cfdff6..9bc5f19b2 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -534,8 +534,18 @@ def checkFpmStatusFile(version): def getFpmStatus(version): checkFpmStatusFile(version) - result = mw.httpGet( - 'http://127.0.0.1/phpfpm_status_' + version + '?json') + + try: + url = 'http://' + mw.getLocalIp() + '/phpfpm_status_' + version + '?json' + result = mw.httpGet(url) + except Exception as e: + url = 'http://127.0.0.1/phpfpm_status_' + version + '?json' + result = mw.httpGet(url) + else: + tmp = {} + tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) + return mw.getJson(tmp) + tmp = json.loads(result) fTime = time.localtime(int(tmp['start time'])) tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) From 4a6ec1a9b4dc6651ebfbea4013cabcd0e9d929a4 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 02:55:35 +0800 Subject: [PATCH 33/42] Update index.py --- plugins/openresty/index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index 3fd4fc2af..f48dc73f0 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -294,7 +294,7 @@ def runInfo(): data['Writing'] = tmp[13] data['Waiting'] = tmp[15] return mw.getJson(data) - else + else: return 'oprenresty not started' From a638354d2cb9bc1e45d09a47ad2836eb34a4e410 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 02:56:31 +0800 Subject: [PATCH 34/42] Update index.py --- plugins/php/index.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/php/index.py b/plugins/php/index.py index 9bc5f19b2..8d496fb36 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -542,9 +542,7 @@ def getFpmStatus(version): url = 'http://127.0.0.1/phpfpm_status_' + version + '?json' result = mw.httpGet(url) else: - tmp = {} - tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) - return mw.getJson(tmp) + return mw.getJson({}) tmp = json.loads(result) fTime = time.localtime(int(tmp['start time'])) From cd0a2df91a34998de5621877e245dd63b189b388 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 03:01:30 +0800 Subject: [PATCH 35/42] up --- plugins/openresty/index.py | 2 +- plugins/php/index.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index f48dc73f0..18a398605 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -269,7 +269,7 @@ def runInfo(): # 取Openresty负载状态 try: - url = 'http://' + mw.GetLocalIp() + '/nginx_status' + url = 'http://' + mw.getHostAddr() + '/nginx_status' result = mw.httpGet(url) tmp = result.split() data = {} diff --git a/plugins/php/index.py b/plugins/php/index.py index 8d496fb36..a7b9acf38 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -536,7 +536,7 @@ def getFpmStatus(version): checkFpmStatusFile(version) try: - url = 'http://' + mw.getLocalIp() + '/phpfpm_status_' + version + '?json' + url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json' result = mw.httpGet(url) except Exception as e: url = 'http://127.0.0.1/phpfpm_status_' + version + '?json' From 3301c68b273d52c81a03c03f2dfeaaed272b5042 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 03:08:09 +0800 Subject: [PATCH 36/42] Update index.py --- plugins/php/index.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/php/index.py b/plugins/php/index.py index a7b9acf38..219b53104 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -538,15 +538,18 @@ def getFpmStatus(version): try: url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json' result = mw.httpGet(url) + tmp = json.loads(result) + fTime = time.localtime(int(tmp['start time'])) + tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) except Exception as e: url = 'http://127.0.0.1/phpfpm_status_' + version + '?json' result = mw.httpGet(url) + tmp = json.loads(result) + fTime = time.localtime(int(tmp['start time'])) + tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) else: - return mw.getJson({}) + tmp = {} - tmp = json.loads(result) - fTime = time.localtime(int(tmp['start time'])) - tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) return mw.getJson(tmp) From 2f2ab82a7d5fd74bc5ca6f2295f48acaaa387f34 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 03:14:35 +0800 Subject: [PATCH 37/42] Update index.py --- plugins/php/index.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/plugins/php/index.py b/plugins/php/index.py index 219b53104..4213da845 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -521,15 +521,16 @@ def setFpmConfig(version): def checkFpmStatusFile(version): - if mw.isInstalledWeb(): - sdir = mw.getServerDir() - dfile = sdir + '/openresty/nginx/conf/php_status/phpfpm_status_' + version + '.conf' - if not os.path.exists(dfile): - tpl = getPluginDir() + '/conf/phpfpm_status.conf' - content = mw.readFile(tpl) - content = contentReplace(content, version) - mw.writeFile(dfile, content) - mw.restartWeb() + if not mw.isInstalledWeb(): + return False + + dfile = getServerDir() + '/nginx/conf/php_status/phpfpm_status_' + version + '.conf' + if not os.path.exists(dfile): + tpl = getPluginDir() + '/conf/phpfpm_status.conf' + content = mw.readFile(tpl) + content = contentReplace(content, version) + mw.writeFile(dfile, content) + mw.restartWeb() def getFpmStatus(version): @@ -538,19 +539,19 @@ def getFpmStatus(version): try: url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json' result = mw.httpGet(url) - tmp = json.loads(result) - fTime = time.localtime(int(tmp['start time'])) - tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) + data = json.loads(result) + fTime = time.localtime(int(data['start time'])) + data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) except Exception as e: url = 'http://127.0.0.1/phpfpm_status_' + version + '?json' result = mw.httpGet(url) - tmp = json.loads(result) - fTime = time.localtime(int(tmp['start time'])) - tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) + data = json.loads(result) + fTime = time.localtime(int(data['start time'])) + data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) else: - tmp = {} + data = {} - return mw.getJson(tmp) + return mw.getJson(data) def getDisableFunc(version): From d782d79f460eab9fc185eb74da34e83c39f8d10f Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 03:15:00 +0800 Subject: [PATCH 38/42] Update index.py --- plugins/php/index.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/php/index.py b/plugins/php/index.py index 4213da845..c4b189bf9 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -531,6 +531,7 @@ def checkFpmStatusFile(version): content = contentReplace(content, version) mw.writeFile(dfile, content) mw.restartWeb() + return True def getFpmStatus(version): From bb470e2876bb0e99d928af7e8d1b0b2c1331752d Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 03:20:45 +0800 Subject: [PATCH 39/42] up --- plugins/openresty/index.py | 4 +--- plugins/php/index.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index 18a398605..121190493 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -265,9 +265,7 @@ def initdUinstall(): def runInfo(): - # 取Openresty负载状态 - try: url = 'http://' + mw.getHostAddr() + '/nginx_status' result = mw.httpGet(url) @@ -294,7 +292,7 @@ def runInfo(): data['Writing'] = tmp[13] data['Waiting'] = tmp[15] return mw.getJson(data) - else: + except Exception as e: return 'oprenresty not started' diff --git a/plugins/php/index.py b/plugins/php/index.py index c4b189bf9..fe6be8eca 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -549,7 +549,7 @@ def getFpmStatus(version): data = json.loads(result) fTime = time.localtime(int(data['start time'])) data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime) - else: + except Exception as e: data = {} return mw.getJson(data) From f159cd9e5eaebf2966aefbd41c1a1a6c0633867d Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 03:39:23 +0800 Subject: [PATCH 40/42] fix libunwind-dev fail --- requirements.txt | 1 + scripts/install/debian.sh | 16 ++++++++++++++-- scripts/lib.sh | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 818b46e69..4b1870f88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,3 +24,4 @@ pillow Jinja2>=2.11.2 flask-caching>=1.10.1 mysql-connector-python +mysqlclient>=2.0.3 diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index 95ffafc1f..426b9c0ac 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -84,6 +84,20 @@ rm -rf ${Install_TmpFile} echo -e "\e[0;32mfix zlib1g-dev install question end\e[0m" +#fix libunwind-dev fail +echo -e "\e[0;32mfix libunwind-dev install question start\e[0m" +Install_TmpFile=/tmp/debian-fix-libunwind-dev.txt +apt install -y zlib1g-dev > ${Install_TmpFile} +if [ "$?" != "0" ];then + liblzma5_BASE_VER=$(cat ${Install_TmpFile} | grep liblzma-dev | awk -F "=" '{print $2}' | awk -F ")" '{print $1}') + liblzma5_BASE_VER=`echo ${liblzma5_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"` + echo -e "\e[1;31mapt install liblzma5=${liblzma5_BASE_VER} libunwind-dev\e[0m" + echo "Y" | apt install liblzma5=${liblzma5_BASE_VER} libunwind-dev +fi +rm -rf ${Install_TmpFile} +echo -e "\e[0;32mfix libunwind-dev install question end\e[0m" + + cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data @@ -103,7 +117,6 @@ pip3 install gevent==21.1.2 pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 -pip3 install mysqlclient==2.0.3 pip3 install pymongo pip3 install psutil pip3 install flask-socketio==5.2.0 @@ -118,7 +131,6 @@ if [ ! -f /www/server/mdserver-web/bin/activate ];then pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 - pip3 install mysqlclient==2.0.3 pip3 install pymongo pip3 install psutil pip3 install flask-socketio==5.2.0 diff --git a/scripts/lib.sh b/scripts/lib.sh index 38bcda714..cc8afa54d 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -295,7 +295,8 @@ elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then apt install -y cmake automake make apt install -y webp scons - apt install -y lzma lzma-dev libunwind-dev + apt install -y lzma lzma-dev + apt install -y libunwind-dev apt install -y libpcre3 libpcre3-dev apt install -y openssl From 6f456bfd7f942d297477b3d5d7d1f3dac33d4d8d Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 04:23:12 +0800 Subject: [PATCH 41/42] Update soft.js --- route/static/app/soft.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/route/static/app/soft.js b/route/static/app/soft.js index 34b3f3c37..020a19933 100755 --- a/route/static/app/soft.js +++ b/route/static/app/soft.js @@ -33,7 +33,7 @@ function getSList(isdisplay) { var loadT = layer.msg('正在获取列表...', { icon: 16, time: 0, shade: [0.3, '#000'] }) } if (!isdisplay || isdisplay === true) - isdisplay = getCookie('p' + getCookie('softType')); + isdisplay = getCookie('p' + getCookie('soft_type')); if (isdisplay == true || isdisplay == 'true') isdisplay = 1; var search = $("#SearchValue").val(); @@ -41,7 +41,7 @@ function getSList(isdisplay) { search = '&search=' + search; } var type = ''; - var istype = getCookie('softType'); + var istype = getCookie('soft_type'); if (istype == 'undefined' || istype == 'null' || !istype) { istype = '0'; } @@ -50,7 +50,7 @@ function getSList(isdisplay) { var page = ''; if (isdisplay) { page = '&p=' + isdisplay; - setCookie('p' + getCookie('softType'), isdisplay); + setCookie('p' + getCookie('soft_type'), isdisplay); } var condition = (search + type + page).slice(1); @@ -162,7 +162,7 @@ function getSList(isdisplay) { sBody += pBody; $("#softList").html(sBody); $(".menu-sub span").click(function() { - setCookie('softType', $(this).attr('typeid')); + setCookie('soft_type', $(this).attr('typeid')); $(this).addClass("on").siblings().removeClass("on"); getSList(); }); From 08b402d5168ec24aa98cc9820c45d175f2479838 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Jun 2022 04:40:48 +0800 Subject: [PATCH 42/42] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/mw.py | 17 +++++++++++++++++ class/core/plugins_api.py | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/class/core/mw.py b/class/core/mw.py index 5629d57ac..f8fa5ccf7 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -98,6 +98,23 @@ def isAppleSystem(): return False +def isNumber(s): + try: + float(s) + return True + except ValueError: + pass + + try: + import unicodedata + unicodedata.numeric(s) + return True + except (TypeError, ValueError): + pass + + return False + + def deleteFile(file): if os.path.exists(file): os.remove(file) diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index 3a22894f6..26f70906e 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -48,6 +48,13 @@ class plugins_api: def listApi(self): sType = request.args.get('type', '0') sPage = request.args.get('p', '1') + + if not mw.isNumber(sPage): + sPage = 1 + + if not mw.isNumber(sType): + sType = 0 + # print sPage data = self.getPluginList(sType, int(sPage)) return mw.getJson(data)